aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2014-10-13 12:32:55 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-10-13 12:32:55 -0700
commit81beccc4fb1396fe94af15bfce26e68b82b93809 (patch)
treef3b05fc07e562022e6c5e82cbaae713817021c8d /include
parent335a0ae19c3c26a934b2a25c0b8016a453c4b013 (diff)
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
Diffstat (limited to 'include')
-rw-r--r--include/gpu/GrContext.h53
-rw-r--r--include/gpu/GrRenderTarget.h12
-rw-r--r--include/gpu/GrSurface.h20
-rw-r--r--include/gpu/GrTexture.h13
4 files changed, 14 insertions, 84 deletions
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(); }