blob: b7e1486a061ed97888f90c176bcbc1eb37953061 [file] [log] [blame]
george8201f76872006-03-28 14:22:56 +00001/* Copyright (C) 2006 TightVNC Team. All Rights Reserved.
2 *
3 * This is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This software is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this software; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 * USA.
17 *
18 * TightVNC distribution homepage on the Web: http://www.tightvnc.com/
19 *
20 */
21
22// -=- ScaledDIBSectionBuffer.cxx
23
24#include <math.h>
25
26#include <rfb_win32/ScaledDIBSectionBuffer.h>
27
28using namespace rfb;
29using namespace win32;
30
31ScaledDIBSectionBuffer::ScaledDIBSectionBuffer(HWND window)
32 : DIBSectionBuffer(window) {
33 scaled_data = data;
34}
35
36void ScaledDIBSectionBuffer::setSrcPixelBuffer(U8 **src_data_, int w, int h, PixelFormat pf) {
37 src_data = src_data_;
38 src_width = w;
39 src_height = h;
40 scaled_width = width_ = (int)ceil(src_width * scale_ratio);
41 scaled_height = height_ = (int)ceil(src_height * scale_ratio);
42 setPF(pf); //recreateScaledBuffer() was run
43}
44
45void ScaledDIBSectionBuffer::setPF(const PixelFormat &pf) {
46 DIBSectionBuffer::setPF(pf);
47 scaled_data = data;
48}
49
50void ScaledDIBSectionBuffer::setSize(int src_width_, int src_height_) {
51 src_width = src_width_;
52 src_height = src_height_;
53 setScale(scale_ratio * 100);
54}
55
56void ScaledDIBSectionBuffer::recreateScaledBuffer() {
57 width_ = scaled_width;
58 height_ = scaled_height;
59 recreateBuffer();
60 scaled_data = data;
61}