From 945cddacef4ff607017cd62f580ea682cbd45806 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Tue, 28 Jan 2014 14:13:12 +0100 Subject: [PATCH] Be more consistent in referring to pixel byte streams as buffers --- common/rfb/CMsgHandler.h | 4 ++-- common/rfb/ComparingUpdateTracker.cxx | 6 +++--- common/rfb/PixelBuffer.cxx | 14 +++++++------- common/rfb/PixelBuffer.h | 10 +++++----- common/rfb/TransImageGetter.cxx | 8 ++++---- common/rfb/TransImageGetter.h | 4 ++-- common/rfb/tightDecode.h | 8 ++++---- common/rfb/tightEncode.h | 4 ++-- vncviewer/CConn.cxx | 6 +++--- vncviewer/CConn.h | 4 ++-- vncviewer/DesktopWindow.h | 4 ++-- vncviewer/Viewport.h | 4 ++-- 12 files changed, 38 insertions(+), 38 deletions(-) diff --git a/common/rfb/CMsgHandler.h b/common/rfb/CMsgHandler.h index d69d4f21..d7ffd65b 100644 --- a/common/rfb/CMsgHandler.h +++ b/common/rfb/CMsgHandler.h @@ -71,8 +71,8 @@ namespace rfb { virtual void imageRect(const Rect& r, void* pixels) = 0; virtual void copyRect(const Rect& r, int srcX, int srcY) = 0; - virtual rdr::U8* getRawPixelsRW(const Rect& r, int* stride) = 0; - virtual void releaseRawPixels(const Rect& r) = 0; + virtual rdr::U8* getRawBufferRW(const Rect& r, int* stride) = 0; + virtual void releaseRawBuffer(const Rect& r) = 0; virtual const PixelFormat &getPreferredPF(void) = 0; diff --git a/common/rfb/ComparingUpdateTracker.cxx b/common/rfb/ComparingUpdateTracker.cxx index 1c2bd383..8d4311a1 100644 --- a/common/rfb/ComparingUpdateTracker.cxx +++ b/common/rfb/ComparingUpdateTracker.cxx @@ -53,7 +53,7 @@ bool ComparingUpdateTracker::compare() for (int y=0; yheight(); y+=BLOCK_SIZE) { Rect pos(0, y, fb->width(), __rfbmin(fb->height(), y+BLOCK_SIZE)); int srcStride; - const rdr::U8* srcData = fb->getPixelsR(pos, &srcStride); + const rdr::U8* srcData = fb->getBuffer(pos, &srcStride); oldFb.imageRect(pos, srcData, srcStride); } @@ -106,7 +106,7 @@ void ComparingUpdateTracker::compareRect(const Rect& r, Region* newChanged) int bytesPerPixel = fb->getPF().bpp/8; int oldStride; - rdr::U8* oldData = oldFb.getPixelsRW(r, &oldStride); + rdr::U8* oldData = oldFb.getBufferRW(r, &oldStride); int oldStrideBytes = oldStride * bytesPerPixel; std::vector changedBlocks; @@ -116,7 +116,7 @@ void ComparingUpdateTracker::compareRect(const Rect& r, Region* newChanged) // Get a strip of the source buffer Rect pos(r.tl.x, blockTop, r.br.x, __rfbmin(r.br.y, blockTop+BLOCK_SIZE)); int fbStride; - const rdr::U8* newBlockPtr = fb->getPixelsR(pos, &fbStride); + const rdr::U8* newBlockPtr = fb->getBuffer(pos, &fbStride); int newStrideBytes = fbStride * bytesPerPixel; rdr::U8* oldBlockPtr = oldData; diff --git a/common/rfb/PixelBuffer.cxx b/common/rfb/PixelBuffer.cxx index 293403b6..9d151b97 100644 --- a/common/rfb/PixelBuffer.cxx +++ b/common/rfb/PixelBuffer.cxx @@ -48,7 +48,7 @@ ColourMap* PixelBuffer::getColourMap() const {return colourmap;} void PixelBuffer::getImage(void* imageBuf, const Rect& r, int outStride) { int inStride; - const U8* data = getPixelsR(r, &inStride); + const U8* data = getBuffer(r, &inStride); // We assume that the specified rectangle is pre-clipped to the buffer int bytesPerPixel = format.bpp/8; int inBytesPerRow = inStride * bytesPerPixel; @@ -154,7 +154,7 @@ void FullFramePixelBuffer::setPF(const PixelFormat &pf) { int FullFramePixelBuffer::getStride() const { return width(); } -rdr::U8* FullFramePixelBuffer::getPixelsRW(const Rect& r, int* stride) +rdr::U8* FullFramePixelBuffer::getBufferRW(const Rect& r, int* stride) { *stride = getStride(); return &data[(r.tl.x + (r.tl.y * *stride)) * format.bpp/8]; @@ -163,14 +163,14 @@ rdr::U8* FullFramePixelBuffer::getPixelsRW(const Rect& r, int* stride) void FullFramePixelBuffer::fillRect(const Rect& r, Pixel pix) { int stride; - U8 *buf = getPixelsRW(r, &stride); + U8 *buf = getBufferRW(r, &stride); fillRectFn(buf, stride, r, pix); } void FullFramePixelBuffer::imageRect(const Rect& r, const void* pixels, int srcStride) { int bytesPerPixel = getPF().bpp/8; int destStride; - U8* dest = getPixelsRW(r, &destStride); + U8* dest = getBufferRW(r, &destStride); int bytesPerDestRow = bytesPerPixel * destStride; if (!srcStride) srcStride = r.width(); int bytesPerSrcRow = bytesPerPixel * srcStride; @@ -188,7 +188,7 @@ void FullFramePixelBuffer::maskRect(const Rect& r, const void* pixels, const voi Rect cr = getRect().intersect(r); if (cr.is_empty()) return; int stride; - U8* data = getPixelsRW(cr, &stride); + U8* data = getBufferRW(cr, &stride); U8* mask = (U8*) mask_; int w = cr.width(); int h = cr.height(); @@ -226,7 +226,7 @@ void FullFramePixelBuffer::maskRect(const Rect& r, Pixel pixel, const void* mask Rect cr = getRect().intersect(r); if (cr.is_empty()) return; int stride; - U8* data = getPixelsRW(cr, &stride); + U8* data = getBufferRW(cr, &stride); U8* mask = (U8*) mask_; int w = cr.width(); int h = cr.height(); @@ -286,7 +286,7 @@ void FullFramePixelBuffer::copyRect(const Rect &rect, const Point &move_by_delta if (srect.is_empty()) return; - data = getPixelsRW(getRect(), &stride); + data = getBufferRW(getRect(), &stride); bytesPerPixel = getPF().bpp/8; bytesPerRow = stride * bytesPerPixel; bytesPerMemCpy = drect.width() * bytesPerPixel; diff --git a/common/rfb/PixelBuffer.h b/common/rfb/PixelBuffer.h index 0d152635..5c4f9666 100644 --- a/common/rfb/PixelBuffer.h +++ b/common/rfb/PixelBuffer.h @@ -70,8 +70,8 @@ namespace rfb { // Get a pointer into the buffer // The pointer is to the top-left pixel of the specified Rect. // The buffer stride (in pixels) is returned. - virtual const rdr::U8* getPixelsR(const Rect& r, int* stride) = 0; - virtual rdr::U8* getPixelsRW(const Rect& r, int* stride) = 0; + virtual const rdr::U8* getBuffer(const Rect& r, int* stride) = 0; + virtual rdr::U8* getBufferRW(const Rect& r, int* stride) = 0; // Get pixel data for a given part of the buffer // Data is copied into the supplied buffer, with the specified @@ -111,10 +111,10 @@ namespace rfb { virtual int getStride() const; // Get a pointer to specified pixel data - rdr::U8* getPixelsRW(const Rect& r, int* stride); - virtual const rdr::U8* getPixelsR(const Rect& r, int* stride) { - return getPixelsRW(r, stride); + virtual const rdr::U8* getBuffer(const Rect& r, int* stride) { + return getBufferRW(r, stride); } + virtual rdr::U8* getBufferRW(const Rect& r, int* stride); /////////////////////////////////////////////// // Basic rendering operations diff --git a/common/rfb/TransImageGetter.cxx b/common/rfb/TransImageGetter.cxx index c1add1ce..3900d065 100644 --- a/common/rfb/TransImageGetter.cxx +++ b/common/rfb/TransImageGetter.cxx @@ -56,18 +56,18 @@ void TransImageGetter::setColourMapEntries(int firstCol, int nCols) PixelTransformer::setColourMapEntries(firstCol, nCols); } -const rdr::U8 *TransImageGetter::getRawPixelsR(const Rect &r, int *stride) +const rdr::U8 *TransImageGetter::getRawBufferR(const Rect &r, int *stride) { if (!offset.equals(Point(0, 0))) - return pb->getPixelsR(r.translate(offset.negate()), stride); + return pb->getBuffer(r.translate(offset.negate()), stride); else - return pb->getPixelsR(r, stride); + return pb->getBuffer(r, stride); } void TransImageGetter::getImage(void* outPtr, const Rect& r, int outStride) { int inStride; - const rdr::U8* inPtr = pb->getPixelsR(r.translate(offset.negate()), &inStride); + const rdr::U8* inPtr = pb->getBuffer(r.translate(offset.negate()), &inStride); if (!outStride) outStride = r.width(); diff --git a/common/rfb/TransImageGetter.h b/common/rfb/TransImageGetter.h index f2b35b45..b241b83c 100644 --- a/common/rfb/TransImageGetter.h +++ b/common/rfb/TransImageGetter.h @@ -72,11 +72,11 @@ namespace rfb { // padding will be outStride-r.width() pixels). void getImage(void* outPtr, const Rect& r, int outStride=0); - // getRawPixelsR() gets the given rectangle of data directly from the + // getRawBufferR() gets the given rectangle of data directly from the // underlying PixelBuffer, bypassing the translation logic. Only use // this when doing something that's independent of the client's pixel // format. - const rdr::U8 *getRawPixelsR(const Rect &r, int *stride); + const rdr::U8 *getRawBufferR(const Rect &r, int *stride); // setPixelBuffer() changes the pixel buffer to be used. The new pixel // buffer MUST have the same pixel format as the old one - if not you diff --git a/common/rfb/tightDecode.h b/common/rfb/tightDecode.h index e9f5f6ba..fb39d996 100644 --- a/common/rfb/tightDecode.h +++ b/common/rfb/tightDecode.h @@ -156,7 +156,7 @@ void TIGHT_DECODE (const Rect& r) PIXEL_T *buf; int stride = r.width(); - if (directDecode) buf = (PIXEL_T *)handler->getRawPixelsRW(r, &stride); + if (directDecode) buf = (PIXEL_T *)handler->getRawBufferRW(r, &stride); else buf = (PIXEL_T *)reader->getImageBuf(r.area()); if (palSize == 0) { @@ -228,7 +228,7 @@ void TIGHT_DECODE (const Rect& r) } } - if (directDecode) handler->releaseRawPixels(r); + if (directDecode) handler->releaseRawBuffer(r); else IMAGE_RECT(r, buf); delete [] netbuf; @@ -256,10 +256,10 @@ DECOMPRESS_JPEG_RECT(const Rect& r) // We always use direct decoding with JPEG images int stride; - rdr::U8 *buf = handler->getRawPixelsRW(r, &stride); + rdr::U8 *buf = handler->getRawBufferRW(r, &stride); jd.decompress(netbuf, compressedLen, buf, stride * clientpf.bpp / 8, r, clientpf); - handler->releaseRawPixels(r); + handler->releaseRawBuffer(r); delete [] netbuf; } diff --git a/common/rfb/tightEncode.h b/common/rfb/tightEncode.h index 8f900b58..0c616f53 100644 --- a/common/rfb/tightEncode.h +++ b/common/rfb/tightEncode.h @@ -191,7 +191,7 @@ void TIGHT_ENCODE (const Rect& r, rdr::OutStream *os, bool forceSolid) { int stride; rdr::U32 solidColor; - const PIXEL_T *rawPixels = (const PIXEL_T *)ig->getRawPixelsR(r, &stride); + const PIXEL_T *rawPixels = (const PIXEL_T *)ig->getRawBufferR(r, &stride); PIXEL_T *pixels = NULL; bool grayScaleJPEG = (jpegSubsampling == SUBSAMP_GRAY && jpegQuality != -1); @@ -650,7 +650,7 @@ bool CHECK_SOLID_TILE(Rect& r, rdr::U32 *colorPtr, bool needSameColor) int w = r.width(), h = r.height(); int stride = w; - buf = (const PIXEL_T *)ig->getRawPixelsR(r, &stride); + buf = (const PIXEL_T *)ig->getRawBufferR(r, &stride); colorValue = *buf; if (needSameColor && (rdr::U32)colorValue != *colorPtr) diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx index f97b0f4c..7265062d 100644 --- a/vncviewer/CConn.cxx +++ b/vncviewer/CConn.cxx @@ -443,10 +443,10 @@ void CConn::fence(rdr::U32 flags, unsigned len, const char data[]) } } -rdr::U8* CConn::getRawPixelsRW(const rfb::Rect& r, int* stride) { - return desktop->getPixelsRW(r, stride); +rdr::U8* CConn::getRawBufferRW(const rfb::Rect& r, int* stride) { + return desktop->getBufferRW(r, stride); } -void CConn::releaseRawPixels(const rfb::Rect& r) { +void CConn::releaseRawBuffer(const rfb::Rect& r) { desktop->damageRect(r); } diff --git a/vncviewer/CConn.h b/vncviewer/CConn.h index 24fbbab4..33dcf4ab 100644 --- a/vncviewer/CConn.h +++ b/vncviewer/CConn.h @@ -67,8 +67,8 @@ public: void imageRect(const rfb::Rect& r, void* p); void copyRect(const rfb::Rect& r, int sx, int sy); - rdr::U8* getRawPixelsRW(const rfb::Rect& r, int* stride); - void releaseRawPixels(const rfb::Rect& r); + rdr::U8* getRawBufferRW(const rfb::Rect& r, int* stride); + void releaseRawBuffer(const rfb::Rect& r); const rfb::PixelFormat &getPreferredPF() { return fullColourPF; } diff --git a/vncviewer/DesktopWindow.h b/vncviewer/DesktopWindow.h index 78d9bf79..fefdd35b 100644 --- a/vncviewer/DesktopWindow.h +++ b/vncviewer/DesktopWindow.h @@ -62,8 +62,8 @@ public: viewport->copyRect(r, srcX, srcY); } - rdr::U8* getPixelsRW(const rfb::Rect& r, int* stride) { - return viewport->getPixelsRW(r, stride); + rdr::U8* getBufferRW(const rfb::Rect& r, int* stride) { + return viewport->getBufferRW(r, stride); } void damageRect(const rfb::Rect& r) { viewport->damageRect(r); diff --git a/vncviewer/Viewport.h b/vncviewer/Viewport.h index 748981ac..59839dcb 100644 --- a/vncviewer/Viewport.h +++ b/vncviewer/Viewport.h @@ -94,8 +94,8 @@ public: damageRect(r); } - rdr::U8* getPixelsRW(const rfb::Rect& r, int* stride) { - return frameBuffer->getPixelsRW(r, stride); + rdr::U8* getBufferRW(const rfb::Rect& r, int* stride) { + return frameBuffer->getBufferRW(r, stride); } void damageRect(const rfb::Rect& r) { -- 2.39.5