diff options
author | Pierre Ossman <ossman@cendio.se> | 2014-01-30 17:47:31 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2014-07-07 14:50:29 +0200 |
commit | ff9eb5a949f7af0198db8c563a7d9d735ad083c3 (patch) | |
tree | ae6079de1916b1567156c7f4cb31204a634e5a31 /common | |
parent | 5c1a1536db0bd3f59e8c9ed0fd8a0a0fb8108ef2 (diff) | |
download | tigervnc-ff9eb5a949f7af0198db8c563a7d9d735ad083c3.tar.gz tigervnc-ff9eb5a949f7af0198db8c563a7d9d735ad083c3.zip |
Get rid of the direct access abuse of FullFramePixelBuffer's data
Diffstat (limited to 'common')
-rw-r--r-- | common/rfb/PixelBuffer.h | 5 | ||||
-rw-r--r-- | common/rfb/SDesktop.h | 4 | ||||
-rw-r--r-- | common/rfb/VNCSConnectionST.cxx | 16 | ||||
-rw-r--r-- | common/rfb/VNCServer.h | 2 | ||||
-rw-r--r-- | common/rfb/VNCServerST.cxx | 17 | ||||
-rw-r--r-- | common/rfb/VNCServerST.h | 2 |
6 files changed, 29 insertions, 17 deletions
diff --git a/common/rfb/PixelBuffer.h b/common/rfb/PixelBuffer.h index bff28021..94230247 100644 --- a/common/rfb/PixelBuffer.h +++ b/common/rfb/PixelBuffer.h @@ -130,11 +130,10 @@ namespace rfb { // pixel is the Pixel value to be used where mask_ is set void maskRect(const Rect& r, Pixel pixel, const void* mask_); - // *** Should this be visible? - rdr::U8* data; - protected: FullFramePixelBuffer(); + + rdr::U8* data; }; // -=- Managed pixel buffer class diff --git a/common/rfb/SDesktop.h b/common/rfb/SDesktop.h index 57ceb076..546506a9 100644 --- a/common/rfb/SDesktop.h +++ b/common/rfb/SDesktop.h @@ -93,11 +93,11 @@ namespace rfb { SStaticDesktop(const Point& size) : server(0), buffer(0) { PixelFormat pf; buffer = new ManagedPixelBuffer(pf, size.x, size.y); - if (buffer) memset(buffer->data, 0, (pf.bpp/8) * (size.x*size.y)); + if (buffer) buffer->fillRect(buffer->getRect(), 0); } SStaticDesktop(const Point& size, const PixelFormat& pf) : buffer(0) { buffer = new ManagedPixelBuffer(pf, size.x, size.y); - if (buffer) memset(buffer->data, 0, (pf.bpp/8) * (size.x*size.y)); + if (buffer) buffer->fillRect(buffer->getRect(), 0); } virtual ~SStaticDesktop() { if (buffer) delete buffer; diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx index a4b704a4..fcb678ad 100644 --- a/common/rfb/VNCSConnectionST.cxx +++ b/common/rfb/VNCSConnectionST.cxx @@ -1,5 +1,5 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. - * Copyright 2009-2011 Pierre Ossman for Cendio AB + * Copyright 2009-2014 Pierre Ossman for Cendio AB * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -737,13 +737,19 @@ void VNCSConnectionST::writeSetCursorCallback() } // Use RichCursor - rdr::U8* transData = writer()->getImageBuf(server->cursor.area()); - image_getter.translatePixels(server->cursor.data, transData, - server->cursor.area()); + rdr::U8* transBuffer; + int stride; + const rdr::U8* buffer; + + transBuffer = writer()->getImageBuf(server->cursor.area()); + + buffer = server->cursor.getBuffer(server->cursor.getRect(), &stride); + image_getter.translatePixels(buffer, transBuffer, server->cursor.area()); + writer()->writeSetCursor(server->cursor.width(), server->cursor.height(), server->cursor.hotspot, - transData, server->cursor.mask.buf); + transBuffer, server->cursor.mask.buf); } diff --git a/common/rfb/VNCServer.h b/common/rfb/VNCServer.h index 787bf8cb..c76e5c9c 100644 --- a/common/rfb/VNCServer.h +++ b/common/rfb/VNCServer.h @@ -73,7 +73,7 @@ namespace rfb { // in left-to-right order. The server takes its own copy of the data in // cursorData and mask. virtual void setCursor(int width, int height, const Point& hotspot, - void* cursorData, void* mask) = 0; + const void* cursorData, const void* mask) = 0; // setCursorPos() tells the server the current position of the cursor. virtual void setCursorPos(const Point& p) = 0; diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx index db142fe4..f1e378ed 100644 --- a/common/rfb/VNCServerST.cxx +++ b/common/rfb/VNCServerST.cxx @@ -1,4 +1,5 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. + * Copyright 2009-2014 Pierre Ossman for Cendio AB * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -408,11 +409,11 @@ void VNCServerST::add_copied(const Region& dest, const Point& delta) } void VNCServerST::setCursor(int width, int height, const Point& newHotspot, - void* data, void* mask) + const void* data, const void* mask) { cursor.hotspot = newHotspot; cursor.setSize(width, height); - memcpy(cursor.data, data, cursor.dataLen()); + cursor.imageRect(cursor.getRect(), data); memcpy(cursor.mask.buf, mask, cursor.maskLen()); cursor.crop(); @@ -621,11 +622,17 @@ bool VNCServerST::checkUpdate() comparer->getUpdateInfo(&ui, pb->getRect()); if (renderCursor) { - pb->getImage(renderedCursor.data, - renderedCursor.getRect(renderedCursorTL)); + const rdr::U8* buffer; + int stride; + + buffer = pb->getBuffer(renderedCursor.getRect(renderedCursorTL), &stride); + renderedCursor.imageRect(renderedCursor.getRect(), buffer, stride); + + buffer = cursor.getBuffer(cursor.getRect(), &stride); renderedCursor.maskRect(cursor.getRect(cursorTL() .subtract(renderedCursorTL)), - cursor.data, cursor.mask.buf); + buffer, cursor.mask.buf); + renderedCursorInvalid = false; } diff --git a/common/rfb/VNCServerST.h b/common/rfb/VNCServerST.h index 88d02559..ed7833ab 100644 --- a/common/rfb/VNCServerST.h +++ b/common/rfb/VNCServerST.h @@ -92,7 +92,7 @@ namespace rfb { virtual void add_changed(const Region ®ion); virtual void add_copied(const Region &dest, const Point &delta); virtual void setCursor(int width, int height, const Point& hotspot, - void* cursorData, void* mask); + const void* cursorData, const void* mask); virtual void setCursorPos(const Point& p); virtual void bell(); |