From 9fe3479104c04377dfb3ca3c66f7e51421e7ca49 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Wed, 29 Jan 2014 17:10:27 +0100 Subject: [PATCH] Remove the scaled pixel buffer classes as they are not used. There were also reports of them being broken last time we still made use of them. --- common/rfb/CMakeLists.txt | 1 - common/rfb/ScaledPixelBuffer.cxx | 225 ----------------------- common/rfb/ScaledPixelBuffer.h | 128 ------------- win/rfb_win32/CMakeLists.txt | 1 - win/rfb_win32/ScaledDIBSectionBuffer.cxx | 195 -------------------- win/rfb_win32/ScaledDIBSectionBuffer.h | 85 --------- 6 files changed, 635 deletions(-) delete mode 100644 common/rfb/ScaledPixelBuffer.cxx delete mode 100644 common/rfb/ScaledPixelBuffer.h delete mode 100644 win/rfb_win32/ScaledDIBSectionBuffer.cxx delete mode 100644 win/rfb_win32/ScaledDIBSectionBuffer.h diff --git a/common/rfb/CMakeLists.txt b/common/rfb/CMakeLists.txt index 27e3caa5..0300105a 100644 --- a/common/rfb/CMakeLists.txt +++ b/common/rfb/CMakeLists.txt @@ -52,7 +52,6 @@ set(RFB_SOURCES SSecurityStack.cxx SSecurityVncAuth.cxx SSecurityVeNCrypt.cxx - ScaledPixelBuffer.cxx ScaleFilters.cxx Timer.cxx TightDecoder.cxx diff --git a/common/rfb/ScaledPixelBuffer.cxx b/common/rfb/ScaledPixelBuffer.cxx deleted file mode 100644 index dc6096d7..00000000 --- a/common/rfb/ScaledPixelBuffer.cxx +++ /dev/null @@ -1,225 +0,0 @@ -/* Copyright (C) 2005 TightVNC Team. All Rights Reserved. - * - * This is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - * USA. - */ - -// -=- ScaledPixelBuffer.cxx - -#include -#include - -#include -#include -#include - -using namespace rdr; -using namespace rfb; - -ScaledPixelBuffer::ScaledPixelBuffer(U8 **src_data_, int src_width_, - int src_height_, int scale_, PixelFormat pf_) - : scale(scale_), scale_ratio_x(1), scale_ratio_y(1), scaleFilterID(scaleFilterBilinear), - xWeightTabs(0), yWeightTabs(0), raccum(0), gaccum(0), baccum(0), scaled_data(0) { - - setSourceBuffer(src_data_, src_width_, src_height_); - setPF(pf_); -} - -ScaledPixelBuffer::ScaledPixelBuffer() - : src_width(0), src_height(0), scaled_width(0), scaled_height(0), scale(100), - scale_ratio_x(1), scale_ratio_y(1), scaleFilterID(scaleFilterBilinear), - xWeightTabs(0), yWeightTabs(0), raccum(0), gaccum(0), baccum(0), - src_data(0), scaled_data(0) { - memset(&pf, 0, sizeof(pf)); -} - -ScaledPixelBuffer::~ScaledPixelBuffer() { - freeWeightTabs(); - if (raccum) delete [] raccum; - if (gaccum) delete [] gaccum; - if (baccum) delete [] baccum; -} - -void ScaledPixelBuffer::freeWeightTabs() { - if (xWeightTabs) { - for (int i = 0; i < scaled_width; i++) delete [] xWeightTabs[i].weight; - delete [] xWeightTabs; - xWeightTabs = 0; - } - if (yWeightTabs) { - for (int i = 0; i < scaled_height; i++) delete [] yWeightTabs[i].weight; - delete [] yWeightTabs; - yWeightTabs = 0; - } -} - -void ScaledPixelBuffer::recreateRowAccum() { - if (raccum) delete [] raccum; - if (gaccum) delete [] gaccum; - if (baccum) delete [] baccum; - raccum = new int[src_width]; - gaccum = new int[src_width]; - baccum = new int[src_width]; -} - -void ScaledPixelBuffer::setSourceBuffer(U8 **src_data_, int w, int h) { - if (w > 0 && h > 0 && src_data_ != NULL) { - freeWeightTabs(); - src_data = src_data_; - src_width = w; - src_height = h; - recreateRowAccum(); - calculateScaledBufferSize(); - scaleFilters.makeWeightTabs(scaleFilterID, src_width, scaled_width, &xWeightTabs); - scaleFilters.makeWeightTabs(scaleFilterID, src_height, scaled_height, &yWeightTabs); - } -} - -void ScaledPixelBuffer::setPF(const PixelFormat &pf_) { - ///if (pf_.depth != 24) throw rfb::UnsupportedPixelFormatException(); - pf = pf_; -} - -void ScaledPixelBuffer::setScale(int scale_) { - if (scale != scale_ && scale_ > 0) { - scale = scale_; - freeWeightTabs(); - calculateScaledBufferSize(); - scaleFilters.makeWeightTabs(scaleFilterID, src_width, scaled_width, &xWeightTabs); - scaleFilters.makeWeightTabs(scaleFilterID, src_height, scaled_height, &yWeightTabs); - } -} - -void ScaledPixelBuffer::setScaleFilter(unsigned int scaleFilterID_) { - if (scaleFilterID == scaleFilterID_ || scaleFilterID_ > scaleFilterMaxNumber) return; - - scaleFilterID = scaleFilterID_; - - if (src_width && src_height && scaled_width && scaled_height) { - freeWeightTabs(); - scaleFilters.makeWeightTabs(scaleFilterID, src_width, scaled_width, &xWeightTabs); - scaleFilters.makeWeightTabs(scaleFilterID, src_height, scaled_height, &yWeightTabs); - if (scale != 100 && pf.depth > 0 && scaled_data) scaleRect(Rect(0, 0, src_width, src_height)); - } -} - -inline U32 ScaledPixelBuffer::getSourcePixel(int x, int y) { - int bytes_per_pixel = pf.bpp / 8; - U8 *ptr = &(*src_data)[(x + y*src_width)*bytes_per_pixel]; - if (bytes_per_pixel == 1) { - return *ptr; - } else if (bytes_per_pixel == 2) { - int b0 = *ptr++; int b1 = *ptr; - return b1 << 8 | b0; - } else if (bytes_per_pixel == 4) { - int b0 = *ptr++; int b1 = *ptr++; - int b2 = *ptr++; int b3 = *ptr; - return b3 << 24 | b2 << 16 | b1 << 8 | b0; - } else { - return 0; - } -} - -void ScaledPixelBuffer::scaleRect(const Rect& rect) { - Rect changed_rect; - U8 *ptr, *ptrs, *px, *pxs; - U16 r, g, b; - int red, green, blue; - short *xweight, *yweight, weight; - - // Calculate the changed pixel rect in the scaled image - changed_rect = calculateScaleBoundary(rect); - - int bytesPerSrcPixel = pf.bpp / 8; - int bytesPerSrcRow = src_width * bytesPerSrcPixel; - int bytesPerScaledRow = scaled_width * 4; - - int bytesPerAccumRow = src_width * sizeof(int); - - ptrs = &(*scaled_data)[(changed_rect.tl.x + changed_rect.tl.y*scaled_width) * 4]; - for (int y = changed_rect.tl.y; y < changed_rect.br.y; y++) { - ptr = ptrs; - yweight = yWeightTabs[y].weight; - - // Clear the color accumulators - memset(raccum, 0, bytesPerAccumRow); - memset(gaccum, 0, bytesPerAccumRow); - memset(baccum, 0, bytesPerAccumRow); - - // Make the convolution the source image with scale filter weights - // by y axis and save results to the color accumulators. - pxs = &(*src_data)[(xWeightTabs[changed_rect.tl.x].i0 + yWeightTabs[y].i0*src_width) * bytesPerSrcPixel]; - for (int ys = yWeightTabs[y].i0; ys < yWeightTabs[y].i1; ys++) { - px = pxs; - for (int xs = xWeightTabs[changed_rect.tl.x].i0; xs < xWeightTabs[changed_rect.br.x-1].i1; xs++) { - pf.rgbFromPixel(*((U32*)px), NULL, &r, &g, &b); - weight = *yweight; - raccum[xs] += (int)(weight) * r; - gaccum[xs] += (int)(weight) * g; - baccum[xs] += (int)(weight) * b; - px += bytesPerSrcPixel; - } - yweight++; - pxs += bytesPerSrcRow; - } - - // Make the convolution the color accumulators with scale filter weights - // by x axis and save results to the scaled image. - for (int x = changed_rect.tl.x; x < changed_rect.br.x; x++) { - // Init the sum of colors with (1 << (shift-1)) for rounding. - red = green = blue = 1 << (FINALSHIFT-1); - xweight = xWeightTabs[x].weight; - for (int xs = xWeightTabs[x].i0; xs < xWeightTabs[x].i1; xs++) { - weight = *xweight; - red += (int)(weight) * (raccum[xs] >> BITS_OF_CHANEL); - green += (int)(weight) * (gaccum[xs] >> BITS_OF_CHANEL); - blue += (int)(weight) * (baccum[xs] >> BITS_OF_CHANEL); - xweight++; - } - *ptr++ = U8(blue >> FINALSHIFT); - *ptr++ = U8(green >> FINALSHIFT); - *ptr++ = U8(red >> FINALSHIFT); - ptr++; - } - ptrs += bytesPerScaledRow; - } -} - -Rect ScaledPixelBuffer::calculateScaleBoundary(const Rect& r) { - int x_start, y_start, x_end, y_end; - double translate_x = 0.5*scale_ratio_x - 0.5; - double translate_y = 0.5*scale_ratio_y - 0.5; - double sourceXScale = __rfbmax(1.0, 1.0/scale_ratio_x); - double sourceYScale = __rfbmax(1.0, 1.0/scale_ratio_y); - double sourceXRadius = __rfbmax(0.5, sourceXScale*scaleFilters[scaleFilterID].radius); - double sourceYRadius = __rfbmax(0.5, sourceYScale*scaleFilters[scaleFilterID].radius); - x_start = (int)ceil(scale_ratio_x*(r.tl.x-sourceXRadius) + translate_x + SCALE_ERROR); - y_start = (int)ceil(scale_ratio_y*(r.tl.y-sourceYRadius) + translate_y + SCALE_ERROR); - x_end = (int)floor(scale_ratio_x*((r.br.x-1)+sourceXRadius) + translate_x - SCALE_ERROR) + 1; - y_end = (int)floor(scale_ratio_y*((r.br.y-1)+sourceXRadius) + translate_y - SCALE_ERROR) + 1; - if (x_start < 0) x_start = 0; - if (y_start < 0) y_start = 0; - if (x_end > scaled_width) x_end = scaled_width; - if (y_end > scaled_height) y_end = scaled_height; - return Rect(x_start, y_start, x_end, y_end); -} - -void ScaledPixelBuffer::calculateScaledBufferSize() { - double scale_ratio = (double)scale / 100; - scaled_width = (int)ceil(src_width * scale_ratio); - scaled_height = (int)ceil(src_height * scale_ratio); - scale_ratio_x = (double)scaled_width / src_width; - scale_ratio_y = (double)scaled_height / src_height; -} diff --git a/common/rfb/ScaledPixelBuffer.h b/common/rfb/ScaledPixelBuffer.h deleted file mode 100644 index 453ab78c..00000000 --- a/common/rfb/ScaledPixelBuffer.h +++ /dev/null @@ -1,128 +0,0 @@ -/* Copyright (C) 2005 TightVNC Team. All Rights Reserved. - * - * This is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - * USA. - */ - -// -=- ScaledPixelBuffer.h -// -// The ScaledPixelBuffer class allows to scale the image data -// from the source buffer to destination buffer using bilinear -// interpolation. - -#ifndef __RFB_SCALEDPIXELBUFFER_H__ -#define __RFB_SCALEDPIXELBUFFER_H__ - -#include -#include -#include -#include -#include - -using namespace rdr; - -namespace rfb { - - struct UnsupportedPixelFormatException : public Exception { - UnsupportedPixelFormatException(const char* s="Now supported only true colour pixel data in the scaling mode.") - : Exception(s) {} - }; - - class ScaledPixelBuffer { - public: - ScaledPixelBuffer(U8 **data, int width, int height, int scale, PixelFormat pf); - ScaledPixelBuffer(); - virtual ~ScaledPixelBuffer(); - - // Get width, height, number of pixels and scale - int width() const { return scaled_width; } - int height() const { return scaled_height; } - int getSrcWidth() const { return src_width; } - int getSrcHeight() const { return src_height; } - int area() const { return scaled_width * scaled_height; } - int getScale() const { return scale; } - double getScaleRatioX() const { return scale_ratio_x; } - double getScaleRatioY() const { return scale_ratio_y; } - - // Pixel manipulation routines - inline U32 getSourcePixel(int x, int y); - - // Get rectangle encompassing this buffer - // Top-left of rectangle is either at (0,0), or the specified point. - Rect getRect() const { return Rect(0, 0, scaled_width, scaled_height); } - Rect getRect(const Point& pos) const { - return Rect(pos, pos.translate(Point(scaled_width, scaled_height))); - } - - // Set the new source buffer and its parameters - void setSourceBuffer(U8 **src_data, int w, int h); - - void setScaledBuffer(U8 **scaled_data_) { - scaled_data = scaled_data_; - }; - - // Set the new pixel format - void setPF(const PixelFormat &pf); - - // Set the new scale, in percent - virtual void setScale(int scale); - - // Set/get the scale method - virtual void setScaleFilter(unsigned int scaleFilterID); - unsigned int getScaleFilterID() const { return scaleFilterID; } - - // Scale rect from the source image buffer to the destination buffer - // using the current interpolation method - virtual void scaleRect(const Rect& r); - - // Calculate the scaled image rectangle which depend on the source - // image rectangle. - Rect calculateScaleBoundary(const Rect& r); - - protected: - - // Calculate the scaled buffer size depending on the source buffer - // parameters (width, height, pixel format) - virtual void calculateScaledBufferSize(); - - // Free the weight tabs for x and y - virtual void freeWeightTabs(); - - // Recreates the row accumulators. - virtual void recreateRowAccum(); - - - int src_width; - int src_height; - int scaled_width; - int scaled_height; - int scale; - double scale_ratio_x; - double scale_ratio_y; - PixelFormat pf; - unsigned int scaleFilterID; - ScaleFilters scaleFilters; - SFilterWeightTab *xWeightTabs; - SFilterWeightTab *yWeightTabs; - int *raccum; - int *gaccum; - int *baccum; - U8 **src_data; - U8 **scaled_data; - }; - -}; - -#endif diff --git a/win/rfb_win32/CMakeLists.txt b/win/rfb_win32/CMakeLists.txt index 83d7f1c6..b3c7dcef 100644 --- a/win/rfb_win32/CMakeLists.txt +++ b/win/rfb_win32/CMakeLists.txt @@ -19,7 +19,6 @@ set(RFB_WIN32_SOURCES ProgressControl.cxx RegConfig.cxx Registry.cxx - ScaledDIBSectionBuffer.cxx SecurityPage.cxx SDisplayCorePolling.cxx SDisplayCoreWMHooks.cxx diff --git a/win/rfb_win32/ScaledDIBSectionBuffer.cxx b/win/rfb_win32/ScaledDIBSectionBuffer.cxx deleted file mode 100644 index 752cd784..00000000 --- a/win/rfb_win32/ScaledDIBSectionBuffer.cxx +++ /dev/null @@ -1,195 +0,0 @@ -/* Copyright (C) 2006 TightVNC Team. All Rights Reserved. - * - * This is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - * USA. - * - * - * - */ - -// -=- ScaledDIBSectionBuffer.cxx - -#include - -#include - -using namespace rfb; -using namespace win32; - -const PixelFormat RGB24(32, 24, 0, 1, 255, 255, 255, 16, 8, 0); - -ScaledDIBSectionBuffer::ScaledDIBSectionBuffer(HWND window) - : DIBSectionBuffer(window), src_buffer(0), scaling(false) { - scaled_data = &data; -} - -ScaledDIBSectionBuffer::~ScaledDIBSectionBuffer() { - if (src_buffer) delete src_buffer; -} - -void ScaledDIBSectionBuffer::setScale(int scale_) { - if (scale == scale_ || scale_ <= 0) return; - if (!(getPixelFormat().trueColour) && scale_ != 100) throw rfb::UnsupportedPixelFormatException(); - ScaledPixelBuffer::setScale(scale_); - if (scale == 100) scaling = false; - else scaling = true; - recreateBuffers(); -} - -void ScaledDIBSectionBuffer::setPF(const PixelFormat &pf_) { - if (memcmp(&(ScaledPixelBuffer::pf), &pf_, sizeof(pf_)) == 0) return; - - if (!pf_.trueColour && isScaling()) throw rfb::UnsupportedPixelFormatException(); - - pf = pf_; - if (scaling) { - if (src_buffer) { - src_buffer->setPF(pf); - } else { - src_buffer = new ManagedPixelBuffer(pf, src_width, src_height); - src_data = &(src_buffer->data); - } - if (memcmp(&(DIBSectionBuffer::getPF()), &RGB24, sizeof(PixelFormat)) != 0) { - DIBSectionBuffer::setPF(RGB24); - } - } else { - DIBSectionBuffer::setPF(pf); - pf = format; - } -} - -void ScaledDIBSectionBuffer::setSize(int src_width_, int src_height_) { - if (src_width == src_width_ && src_height == src_height_) return; - src_width = src_width_; - src_height = src_height_; - - // FIXME: - // Calculate the scale weight tabs must be in the ScalePixelBuffer class - recreateRowAccum(); - freeWeightTabs(); - calculateScaledBufferSize(); - scaleFilters.makeWeightTabs(scaleFilterID, src_width, scaled_width, &xWeightTabs); - scaleFilters.makeWeightTabs(scaleFilterID, src_height, scaled_height, &yWeightTabs); - - recreateBuffers(); -} - -void ScaledDIBSectionBuffer::setScaleWindowSize(int width, int height) { - if (scaled_width == width && scaled_height == height) return; - - freeWeightTabs(); - - scaled_width = width_ = width; - scaled_height = height_ = height; - - if (scaled_width == src_width && scaled_height == src_height) scaling = false; - else scaling = true; - scale_ratio_x = (double)scaled_width / src_width; - scale_ratio_y = (double)scaled_height / src_height; - scale = (int)(scale_ratio_x * 100); - - // FIXME: - // Calculate the scale weight tabs must be in the ScalePixelBuffer class - scaleFilters.makeWeightTabs(scaleFilterID, src_width, scaled_width, &xWeightTabs); - scaleFilters.makeWeightTabs(scaleFilterID, src_height, scaled_height, &yWeightTabs); - - recreateBuffers(); -} - -void ScaledDIBSectionBuffer::recreateScaledBuffer() { - if (scaling && memcmp(&(DIBSectionBuffer::getPF()), &RGB24, sizeof(PixelFormat)) != 0) { - DIBSectionBuffer::setPF(RGB24); - } else if (!scaling && (memcmp(&(DIBSectionBuffer::getPF()), &pf, sizeof(PixelFormat)) != 0)){ - DIBSectionBuffer::setPF(pf); - } else { - DIBSectionBuffer::recreateBuffer(); - } -} - -void ScaledDIBSectionBuffer::recreateBuffers() { - // Recreate the source pixel buffer - if (src_width && src_height && pf.depth > 0) { - if (scaling) { - if (src_buffer) { - if (src_buffer->width() != src_width || src_buffer->width() != src_height) - src_buffer->setSize(src_width, src_height); - } else { - src_buffer = new ManagedPixelBuffer(pf, src_width, src_height); - src_data = &(src_buffer->data); - if (data) memcpy(src_buffer->data, data, src_width * src_height * (getPF().bpp/8)); - } - } - } - // Recreate the scaled pixel buffer - recreateScaledBuffer(); - if (scaling && src_buffer && data) scaleRect(Rect(0, 0, src_width, src_height)); - else if (!scaling && src_buffer) { - if (src_buffer->data && data) memcpy(data, src_buffer->data, src_buffer->area() * (getPF().bpp/8)); - delete src_buffer; - src_buffer = 0; - src_data = 0; - } -} - -void ScaledDIBSectionBuffer::calculateScaledBufferSize() { - ScaledPixelBuffer::calculateScaledBufferSize(); - width_ = scaled_width; - height_ = scaled_height; -} - -void ScaledDIBSectionBuffer::fillRect(const Rect &dest, Pixel pix) { - if (scaling) { - src_buffer->fillRect(dest, pix); - scaleRect(dest); - } else { - DIBSectionBuffer::fillRect(dest, pix); - } -} - -void ScaledDIBSectionBuffer::imageRect(const Rect &dest, const void* pixels, int stride) { - if (scaling) { - src_buffer->imageRect(dest, pixels, stride); - scaleRect(dest); - } else { - DIBSectionBuffer::imageRect(dest, pixels, stride); - } -} - -void ScaledDIBSectionBuffer::copyRect(const Rect &dest, const Point &move_by_delta) { - if (scaling) { - src_buffer->copyRect(dest, move_by_delta); - scaleRect(dest); - } else { - DIBSectionBuffer::copyRect(dest, move_by_delta); - } -} - -void ScaledDIBSectionBuffer::maskRect(const Rect& r, const void* pixels, const void* mask_) { - if (scaling) { - src_buffer->maskRect(r, pixels, mask_); - scaleRect(r); - } else { - DIBSectionBuffer::maskRect(r, pixels, mask_); - } -} - -void ScaledDIBSectionBuffer::maskRect(const Rect& r, Pixel pixel, const void* mask_) { - if (scaling) { - src_buffer->maskRect(r, pixel, mask_); - scaleRect(r); - } else { - DIBSectionBuffer::maskRect(r, pixel, mask_); - } -} diff --git a/win/rfb_win32/ScaledDIBSectionBuffer.h b/win/rfb_win32/ScaledDIBSectionBuffer.h deleted file mode 100644 index 420a97ab..00000000 --- a/win/rfb_win32/ScaledDIBSectionBuffer.h +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright (C) 2006 TightVNC Team. All Rights Reserved. - * - * This is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - * USA. - * - * - * - */ - -// -=- ScaledDIBSectionBuffer.h - -#ifndef __RFB_WIN32_SCALED_DIB_SECTION_BUFFER_H__ -#define __RFB_WIN32_SCALED_DIB_SECTION_BUFFER_H__ - -#include - -#include - -namespace rfb { - - namespace win32 { - - // - // -=- ScaledDIBSectionBuffer - // - - class ScaledDIBSectionBuffer : public ScaledPixelBuffer, public DIBSectionBuffer { - public: - ScaledDIBSectionBuffer(HWND window); - virtual ~ScaledDIBSectionBuffer(); - - int width() const { return scaled_width; } - int height() const { return scaled_height; } - int area() const { return scaled_width * scaled_height; } - bool isScaling() const { return scaling; } - - virtual void setPF(const PixelFormat &pf); - virtual const PixelFormat& getPixelFormat() const { return pf; } - virtual const PixelFormat& getScaledPixelFormat() const { return getPF(); } - virtual void setSize(int w, int h); - virtual void setScale(int scale); - virtual void setScaleWindowSize(int width, int height); - - virtual void calculateScaledBufferSize(); - - Rect getRect() const { return ScaledPixelBuffer::getRect(); } - Rect getRect(const Point& pos) const { return ScaledPixelBuffer::getRect(pos); } - - // -=- Overrides basic rendering operations of - // FullFramePixelBuffer class - - virtual void fillRect(const Rect &dest, Pixel pix); - virtual void imageRect(const Rect &dest, const void* pixels, int stride=0); - virtual void copyRect(const Rect &dest, const Point &move_by_delta); - virtual void maskRect(const Rect& r, const void* pixels, const void* mask_); - virtual void maskRect(const Rect& r, Pixel pixel, const void* mask_); - - protected: - virtual void recreateScaledBuffer(); - virtual void recreateBuffers(); - virtual void recreateBuffer() { - recreateScaledBuffer(); - }; - - ManagedPixelBuffer *src_buffer; - bool scaling; - }; - - }; - -}; - -#endif // __RFB_WIN32_SCALED_DIB_SECTION_BUFFER_H__ -- 2.39.5