Revision: 5152 http://sourceforge.net/p/tigervnc/code/5152 Author: ossman_ Date: 2014-01-07 15:28:45 +0000 (Tue, 07 Jan 2014) Log Message: ----------- Make sure the fill function pointer gets updated if the managed pixel buffer changes format. Also add a bit more protection for switching pixel format as the base classes aren't really designed for that. Fixes a crash with the mouse pointer in WinVNC. Based on work done by Daniel Wyatt (dewyatt).
Modified Paths: -------------- trunk/common/rfb/PixelBuffer.cxx trunk/common/rfb/PixelBuffer.h Modified: trunk/common/rfb/PixelBuffer.cxx =================================================================== --- trunk/common/rfb/PixelBuffer.cxx 2014-01-04 17:28:20 UTC (rev 5151) +++ trunk/common/rfb/PixelBuffer.cxx 2014-01-07 15:28:45 UTC (rev 5152) @@ -133,6 +133,22 @@ rdr::U8* data_, ColourMap* cm) : PixelBuffer(pf, w, h, cm), data(data_) { + // Called again to configure the fill function + setPF(pf); +} + +FullFramePixelBuffer::FullFramePixelBuffer() : data(0) {} + +FullFramePixelBuffer::~FullFramePixelBuffer() {} + + +void FullFramePixelBuffer::setPF(const PixelFormat &pf) { + // We have this as a separate method for ManagedPixelBuffer's + // sake. Direct users of FullFramePixelBuffer aren't allowed + // to call it. + + PixelBuffer::setPF(pf); + switch(pf.bpp) { case 8: fillRectFn = fillRect8; @@ -148,11 +164,7 @@ } } -FullFramePixelBuffer::FullFramePixelBuffer() : data(0) {} -FullFramePixelBuffer::~FullFramePixelBuffer() {} - - int FullFramePixelBuffer::getStride() const { return width(); } rdr::U8* FullFramePixelBuffer::getPixelsRW(const Rect& r, int* stride) @@ -334,7 +346,7 @@ void ManagedPixelBuffer::setPF(const PixelFormat &pf) { - format = pf; checkDataSize(); + FullFramePixelBuffer::setPF(pf); checkDataSize(); }; void ManagedPixelBuffer::setSize(int w, int h) { Modified: trunk/common/rfb/PixelBuffer.h =================================================================== --- trunk/common/rfb/PixelBuffer.h 2014-01-04 17:28:20 UTC (rev 5151) +++ trunk/common/rfb/PixelBuffer.h 2014-01-07 15:28:45 UTC (rev 5152) @@ -44,7 +44,10 @@ // // Set/get pixel format & colourmap + protected: + // Only for subclasses that support changing parameters virtual void setPF(const PixelFormat &pf); + public: virtual const PixelFormat &getPF() const; virtual ColourMap* getColourMap() const; @@ -103,6 +106,10 @@ rdr::U8* data_, ColourMap* cm); virtual ~FullFramePixelBuffer(); + protected: + virtual void setPF(const PixelFormat &pf); + + public: // - Get the number of pixels per row in the actual pixel buffer data area // This may in some cases NOT be the same as width(). virtual int getStride() const; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Tigervnc-commits mailing list Tigervnc-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tigervnc-commits