blob: 420a97ab9f4fe2ebefdbb97fef1f2cce7f1d895c [file] [log] [blame]
Constantin Kaplinsky729598c2006-05-25 05:12:25 +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 *
Peter Åstrand7877cd62009-02-25 16:15:48 +000018 *
Constantin Kaplinsky729598c2006-05-25 05:12:25 +000019 *
20 */
21
22// -=- ScaledDIBSectionBuffer.h
23
24#ifndef __RFB_WIN32_SCALED_DIB_SECTION_BUFFER_H__
25#define __RFB_WIN32_SCALED_DIB_SECTION_BUFFER_H__
26
27#include <rfb/ScaledPixelBuffer.h>
28
29#include <rfb_win32/DIBSectionBuffer.h>
30
31namespace rfb {
32
33 namespace win32 {
34
35 //
36 // -=- ScaledDIBSectionBuffer
37 //
38
39 class ScaledDIBSectionBuffer : public ScaledPixelBuffer, public DIBSectionBuffer {
40 public:
41 ScaledDIBSectionBuffer(HWND window);
42 virtual ~ScaledDIBSectionBuffer();
43
44 int width() const { return scaled_width; }
45 int height() const { return scaled_height; }
george82c0d28b22006-05-27 12:15:55 +000046 int area() const { return scaled_width * scaled_height; }
Constantin Kaplinsky729598c2006-05-25 05:12:25 +000047 bool isScaling() const { return scaling; }
48
49 virtual void setPF(const PixelFormat &pf);
george8270a0dc82006-09-23 07:05:16 +000050 virtual const PixelFormat& getPixelFormat() const { return pf; }
51 virtual const PixelFormat& getScaledPixelFormat() const { return getPF(); }
Constantin Kaplinsky729598c2006-05-25 05:12:25 +000052 virtual void setSize(int w, int h);
george822446ed02007-03-10 08:55:35 +000053 virtual void setScale(int scale);
george82770bbbc2007-03-12 10:48:09 +000054 virtual void setScaleWindowSize(int width, int height);
george822446ed02007-03-10 08:55:35 +000055
george8296b17b92006-09-05 15:44:35 +000056 virtual void calculateScaledBufferSize();
57
Constantin Kaplinsky729598c2006-05-25 05:12:25 +000058 Rect getRect() const { return ScaledPixelBuffer::getRect(); }
59 Rect getRect(const Point& pos) const { return ScaledPixelBuffer::getRect(pos); }
60
61 // -=- Overrides basic rendering operations of
62 // FullFramePixelBuffer class
63
64 virtual void fillRect(const Rect &dest, Pixel pix);
65 virtual void imageRect(const Rect &dest, const void* pixels, int stride=0);
66 virtual void copyRect(const Rect &dest, const Point &move_by_delta);
67 virtual void maskRect(const Rect& r, const void* pixels, const void* mask_);
68 virtual void maskRect(const Rect& r, Pixel pixel, const void* mask_);
69
70 protected:
71 virtual void recreateScaledBuffer();
george82e4b3c2c2006-09-05 06:43:28 +000072 virtual void recreateBuffers();
Constantin Kaplinsky729598c2006-05-25 05:12:25 +000073 virtual void recreateBuffer() {
74 recreateScaledBuffer();
75 };
76
77 ManagedPixelBuffer *src_buffer;
78 bool scaling;
79 };
80
81 };
82
83};
84
85#endif // __RFB_WIN32_SCALED_DIB_SECTION_BUFFER_H__