aboutsummaryrefslogtreecommitdiffstats
path: root/win/rfb_win32/DIBSectionBuffer.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2020-01-03 13:10:20 +0100
committerPierre Ossman <ossman@cendio.se>2020-01-03 13:10:20 +0100
commit73014910f56278a91e796ad8eed620196e289f47 (patch)
tree90e1df0cd7d6db3cc04ba77e5e2b58f00bfe207d /win/rfb_win32/DIBSectionBuffer.cxx
parent0f1ded057dbf875e69a0d72418d95610db8fa6a3 (diff)
downloadtigervnc-73014910f56278a91e796ad8eed620196e289f47.tar.gz
tigervnc-73014910f56278a91e796ad8eed620196e289f47.zip
Clean up initialization of DIBSectionBuffer
We had an unintentional conflict with PixelBuffer::setSize() here. But we can simplify this further as this initialization is only used by the subclass DeviceFrameBuffer, and only once.
Diffstat (limited to 'win/rfb_win32/DIBSectionBuffer.cxx')
-rw-r--r--win/rfb_win32/DIBSectionBuffer.cxx18
1 files changed, 6 insertions, 12 deletions
diff --git a/win/rfb_win32/DIBSectionBuffer.cxx b/win/rfb_win32/DIBSectionBuffer.cxx
index e00cf233..57bef2dc 100644
--- a/win/rfb_win32/DIBSectionBuffer.cxx
+++ b/win/rfb_win32/DIBSectionBuffer.cxx
@@ -44,26 +44,20 @@ DIBSectionBuffer::~DIBSectionBuffer() {
}
-void DIBSectionBuffer::setPF(const PixelFormat& pf) {
- if (memcmp(&getPF(), &pf, sizeof(pf)) == 0) {
- vlog.debug("pixel format unchanged by setPF()");
- return;
- }
- if (!pf.trueColour)
- throw rfb::Exception("palette format not supported");
- format = pf;
- setSize(width(), height());
-}
-
inline void initMaxAndShift(DWORD mask, int* max, int* shift) {
for ((*shift) = 0; (mask & 1) == 0; (*shift)++) mask >>= 1;
(*max) = (rdr::U16)mask;
}
-void DIBSectionBuffer::setSize(int w, int h) {
+void DIBSectionBuffer::initBuffer(const PixelFormat& pf, int w, int h) {
HBITMAP new_bitmap = 0;
rdr::U8* new_data = 0;
+ if (!pf.trueColour)
+ throw rfb::Exception("palette format not supported");
+
+ format = pf;
+
if (w && h && (format.depth != 0)) {
BitmapInfo bi;
memset(&bi, 0, sizeof(bi));