diff options
author | 2017-04-04 16:50:22 -0400 | |
---|---|---|
committer | 2017-04-05 11:55:35 +0000 | |
commit | fb0bd98a43fa11e09705837418167dd72bb4a361 (patch) | |
tree | 67579cf4663c41d4b9ec36bbd61020aa3ccbe57f /include | |
parent | be5387b9308ad0b92a48a1272b618b6eaa08a771 (diff) |
Rm readPixels from GrSurface & move read/writeSurfacePixels to GrContextPriv
This is in service of: https://skia-review.googlesource.com/c/11125/ (Add parallel proxyID to StencilOps & RenderTargetOpList) where I want a better choke point for texture creation to improve discard handling.
Change-Id: If57a7de47edc0853dae7bc61337d9acdc03d63b0
Reviewed-on: https://skia-review.googlesource.com/11200
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/gpu/GrContext.h | 62 | ||||
-rw-r--r-- | include/gpu/GrProcessorUnitTest.h | 6 | ||||
-rw-r--r-- | include/gpu/GrSurface.h | 100 |
3 files changed, 3 insertions, 165 deletions
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index ccd27286c7..0987d96b2e 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -246,68 +246,6 @@ public: */ void flush(); - /** - * These flags can be used with the read/write pixels functions below. - */ - enum PixelOpsFlags { - /** The GrContext will not be flushed before the surface read or write. This means that - the read or write may occur before previous draws have executed. */ - kDontFlush_PixelOpsFlag = 0x1, - /** Any surface writes should be flushed to the backend 3D API after the surface operation - is complete */ - kFlushWrites_PixelOp = 0x2, - /** The src for write or dst read is unpremultiplied. This is only respected if both the - config src and dst configs are an RGBA/BGRA 8888 format. */ - kUnpremul_PixelOpsFlag = 0x4, - }; - - /** - * Reads a rectangle of pixels from a surface. - * @param surface the surface to read from. - * @param srcColorSpace color space of the surface - * @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 dstColorSpace color space of the destination buffer - * @param buffer memory to read the rectangle into. - * @param rowBytes number of bytes bewtween 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 configs - */ - bool readSurfacePixels(GrSurface* surface, SkColorSpace* srcColorSpace, - int left, int top, int width, int height, - GrPixelConfig config, SkColorSpace* dstColorSpace, void* buffer, - size_t rowBytes = 0, - uint32_t pixelOpsFlags = 0); - - /** - * Writes a rectangle of pixels to a surface. - * @param surface the surface to write to. - * @param dstColorSpace color space of the surface - * @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 srcColorSpace color space of the source buffer - * @param buffer memory to read pixels 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 surface and src configs. - */ - bool writeSurfacePixels(GrSurface* surface, SkColorSpace* dstColorSpace, - int left, int top, int width, int height, - GrPixelConfig config, SkColorSpace* srcColorSpace, const void* buffer, - size_t rowBytes, - uint32_t pixelOpsFlags = 0); - /** * An ID associated with this context, guaranteed to be unique. */ diff --git a/include/gpu/GrProcessorUnitTest.h b/include/gpu/GrProcessorUnitTest.h index 912e393ca0..d6269c85bd 100644 --- a/include/gpu/GrProcessorUnitTest.h +++ b/include/gpu/GrProcessorUnitTest.h @@ -49,12 +49,12 @@ struct GrProcessorTestData { GrProcessorTestData(SkRandom* random, GrContext* context, const GrRenderTargetContext* renderTargetContext, - GrTexture* const textures[2]) + sk_sp<GrTextureProxy> proxies[2]) : fRandom(random) , fRenderTargetContext(renderTargetContext) , fContext(context) { - fProxies[0] = GrSurfaceProxy::MakeWrapped(sk_ref_sp(textures[0])); - fProxies[1] = GrSurfaceProxy::MakeWrapped(sk_ref_sp(textures[1])); + fProxies[0] = proxies[0]; + fProxies[1] = proxies[1]; } SkRandom* fRandom; const GrRenderTargetContext* fRenderTargetContext; diff --git a/include/gpu/GrSurface.h b/include/gpu/GrSurface.h index 328731c38f..81bc215c01 100644 --- a/include/gpu/GrSurface.h +++ b/include/gpu/GrSurface.h @@ -66,106 +66,6 @@ public: virtual GrRenderTarget* asRenderTarget() { return NULL; } virtual const GrRenderTarget* asRenderTarget() const { return NULL; } - /** - * Reads a rectangle of pixels from the surface, possibly performing color space conversion. - * @param srcColorSpace color space of the source data (this surface) - * @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 dstColorSpace color space 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 the GrContext::PixelOpsFlags enum. - * - * @return true if the read succeeded, false if not. The read can fail because of an unsupported - * pixel config. - */ - bool readPixels(SkColorSpace* srcColorSpace, - int left, int top, int width, int height, - GrPixelConfig config, - SkColorSpace* dstColorSpace, - void* buffer, - size_t rowBytes = 0, - uint32_t pixelOpsFlags = 0); - - /** - * Reads a rectangle of pixels from the surface. Does not perform any color space conversion. - * @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 the GrContext::PixelOpsFlags enum. - * - * @return true if the read succeeded, false if not. The read can fail because of an unsupported - * pixel config. - */ - bool readPixels(int left, int top, int width, int height, - GrPixelConfig config, - void* buffer, - size_t rowBytes = 0, - uint32_t pixelOpsFlags = 0) { - return this->readPixels(nullptr, left, top, width, height, config, nullptr, buffer, - rowBytes, pixelOpsFlags); - } - - /** - * Copy the src pixels [buffer, rowbytes, pixelconfig] into the surface at the specified - * rectangle, possibly performing color space conversion. - * @param dstColorSpace color space of the destination (this surface) - * @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 srcColorSpace color space 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 the GrContext::PixelOpsFlags enum. - * - * @return true if the write succeeded, false if not. The write can fail because of an - * unsupported pixel config. - */ - bool writePixels(SkColorSpace* dstColorSpace, - int left, int top, int width, int height, - GrPixelConfig config, - SkColorSpace* srcColorSpace, - const void* buffer, - size_t rowBytes = 0, - uint32_t pixelOpsFlags = 0); - - /** - * Copy the src pixels [buffer, rowbytes, pixelconfig] into the surface at the specified - * rectangle. Does not perform any color space conversion. - * @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 the GrContext::PixelOpsFlags enum. - * - * @return true if the write succeeded, false if not. The write can fail because of an - * unsupported pixel config. - */ - bool writePixels(int left, int top, int width, int height, - GrPixelConfig config, - const void* buffer, - size_t rowBytes = 0, - uint32_t pixelOpsFlags = 0) { - return this->writePixels(nullptr, left, top, width, height, config, nullptr, buffer, - rowBytes, pixelOpsFlags); - } - /** Access methods that are only to be used within Skia code. */ inline GrSurfacePriv surfacePriv(); inline const GrSurfacePriv surfacePriv() const; |