From 81beccc4fb1396fe94af15bfce26e68b82b93809 Mon Sep 17 00:00:00 2001 From: bsalomon Date: Mon, 13 Oct 2014 12:32:55 -0700 Subject: Devirtualize read/write pixels on surface. Consolidate read/write funcs in context. Remove support for reading pixels from a surface that's not a target. It's currently broken and neither used nor tested. Review URL: https://codereview.chromium.org/648863002 --- include/gpu/GrContext.h | 53 ++++---------------------------------------- include/gpu/GrRenderTarget.h | 12 ---------- include/gpu/GrSurface.h | 20 ++++++++--------- include/gpu/GrTexture.h | 13 ----------- 4 files changed, 14 insertions(+), 84 deletions(-) (limited to 'include') diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index 6d89d4668a..2b3b814397 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -630,53 +630,8 @@ public: uint32_t pixelOpsFlags = 0); /** - * Copy the src pixels [buffer, row bytes, pixel config] into a render target at the specified - * rectangle. - * @param target the render target to write into. NULL means the current render target. - * @param left left edge of the rectangle to write (inclusive) - * @param top top edge of the rectangle to write (inclusive) - * @param width width of rectangle to write in pixels. - * @param height height of rectangle to write in pixels. - * @param config the pixel config of the source buffer - * @param buffer memory to read the rectangle from. - * @param rowBytes number of bytes between consecutive rows. Zero means rows are tightly - * packed. - * @param pixelOpsFlags see PixelOpsFlags enum above. - * - * @return true if the write succeeded, false if not. The write can fail because of an - * unsupported combination of target and pixel configs. - */ - bool writeRenderTargetPixels(GrRenderTarget* target, - int left, int top, int width, int height, - GrPixelConfig config, const void* buffer, - size_t rowBytes = 0, - uint32_t pixelOpsFlags = 0); - - /** - * Reads a rectangle of pixels from a texture. - * @param texture the texture to read from. - * @param left left edge of the rectangle to read (inclusive) - * @param top top edge of the rectangle to read (inclusive) - * @param width width of rectangle to read in pixels. - * @param height height of rectangle to read in pixels. - * @param config the pixel config of the destination buffer - * @param buffer memory to read the rectangle into. - * @param rowBytes number of bytes between consecutive rows. Zero means rows are tightly - * packed. - * @param pixelOpsFlags see PixelOpsFlags enum above. - * - * @return true if the read succeeded, false if not. The read can fail because of an unsupported - * pixel config. - */ - bool readTexturePixels(GrTexture* texture, - int left, int top, int width, int height, - GrPixelConfig config, void* buffer, - size_t rowBytes = 0, - uint32_t pixelOpsFlags = 0); - - /** - * Writes a rectangle of pixels to a texture. - * @param texture the render target to read from. + * Writes a rectangle of pixels to a surface. + * @param surface the surface to write to. * @param left left edge of the rectangle to write (inclusive) * @param top top edge of the rectangle to write (inclusive) * @param width width of rectangle to write in pixels. @@ -687,9 +642,9 @@ public: * means rows are tightly packed. * @param pixelOpsFlags see PixelOpsFlags enum above. * @return true if the write succeeded, false if not. The write can fail because of an - * unsupported combination of texture and pixel configs. + * unsupported combination of surface and src configs. */ - bool writeTexturePixels(GrTexture* texture, + bool writeSurfacePixels(GrSurface* surface, int left, int top, int width, int height, GrPixelConfig config, const void* buffer, size_t rowBytes, diff --git a/include/gpu/GrRenderTarget.h b/include/gpu/GrRenderTarget.h index 4c5ec18211..974115d91f 100644 --- a/include/gpu/GrRenderTarget.h +++ b/include/gpu/GrRenderTarget.h @@ -43,18 +43,6 @@ public: return this; } - virtual bool readPixels(int left, int top, int width, int height, - GrPixelConfig config, - void* buffer, - size_t rowBytes = 0, - uint32_t pixelOpsFlags = 0) SK_OVERRIDE; - - virtual void writePixels(int left, int top, int width, int height, - GrPixelConfig config, - const void* buffer, - size_t rowBytes = 0, - uint32_t pixelOpsFlags = 0) SK_OVERRIDE; - // GrRenderTarget /** * If this RT is multisampled, this is the multisample buffer diff --git a/include/gpu/GrSurface.h b/include/gpu/GrSurface.h index 0bbf8d9c12..ba51f3b3c8 100644 --- a/include/gpu/GrSurface.h +++ b/include/gpu/GrSurface.h @@ -87,11 +87,11 @@ public: * @return true if the read succeeded, false if not. The read can fail because of an unsupported * pixel config. */ - virtual bool readPixels(int left, int top, int width, int height, - GrPixelConfig config, - void* buffer, - size_t rowBytes = 0, - uint32_t pixelOpsFlags = 0) = 0; + bool readPixels(int left, int top, int width, int height, + GrPixelConfig config, + void* buffer, + size_t rowBytes = 0, + uint32_t pixelOpsFlags = 0); /** * Copy the src pixels [buffer, rowbytes, pixelconfig] into the surface at the specified @@ -106,11 +106,11 @@ public: * packed. * @param pixelOpsFlags See the GrContext::PixelOpsFlags enum. */ - virtual void writePixels(int left, int top, int width, int height, - GrPixelConfig config, - const void* buffer, - size_t rowBytes = 0, - uint32_t pixelOpsFlags = 0) = 0; + bool writePixels(int left, int top, int width, int height, + GrPixelConfig config, + const void* buffer, + size_t rowBytes = 0, + uint32_t pixelOpsFlags = 0); /** * After this returns any pending writes to the surface will be issued to the backend 3D API. diff --git a/include/gpu/GrTexture.h b/include/gpu/GrTexture.h index 43b69eade2..28c3fd5cde 100644 --- a/include/gpu/GrTexture.h +++ b/include/gpu/GrTexture.h @@ -25,19 +25,6 @@ public: */ virtual size_t gpuMemorySize() const SK_OVERRIDE; - // GrSurface overrides - virtual bool readPixels(int left, int top, int width, int height, - GrPixelConfig config, - void* buffer, - size_t rowBytes = 0, - uint32_t pixelOpsFlags = 0) SK_OVERRIDE; - - virtual void writePixels(int left, int top, int width, int height, - GrPixelConfig config, - const void* buffer, - size_t rowBytes = 0, - uint32_t pixelOpsFlags = 0) SK_OVERRIDE; - virtual GrTexture* asTexture() SK_OVERRIDE { return this; } virtual const GrTexture* asTexture() const SK_OVERRIDE { return this; } virtual GrRenderTarget* asRenderTarget() SK_OVERRIDE { return fRenderTarget.get(); } -- cgit v1.2.3