Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Unified Diff: include/gpu/GrContext.h

Issue 622663002: GrContext::copyTexture->GrContext::copySurface. Add a flush writes pixel ops flag. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/gpu/GrSurface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrContext.h
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 366fba993e7dadecef4fe6e46352edfb64c62c73..4500936b82076d19210207409338f627854e9d77 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -597,12 +597,15 @@ public:
* These flags can be used with the read/write pixels functions below.
*/
enum PixelOpsFlags {
- /** The GrContext will not be flushed. This means that the read or write may occur before
- previous draws have executed. */
+ /** 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 = 0x2,
+ kUnpremul_PixelOpsFlag = 0x4,
};
/**
@@ -695,15 +698,36 @@ public:
uint32_t pixelOpsFlags = 0);
/**
- * Copies a rectangle of texels from src to dst. The size of dst is the size of the rectangle
- * copied and topLeft is the position of the rect in src. The rectangle is clipped to src's
+ * Copies a rectangle of texels from src to dst.
* bounds.
- * @param src the texture to copy from.
- * @param dst the render target to copy to.
- * @param topLeft the point in src that will be copied to the top-left of dst. If NULL,
- * (0, 0) will be used.
+ * @param dst the surface to copy to.
+ * @param src the surface to copy from.
+ * @param srcRect the rectangle of the src that should be copied.
+ * @param dstPoint the translation applied when writing the srcRect's pixels to the dst.
+ * @param pixelOpsFlags see PixelOpsFlags enum above. (kUnpremul_PixelOpsFlag is not allowed).
*/
- void copyTexture(GrTexture* src, GrRenderTarget* dst, const SkIPoint* topLeft = NULL);
+ void copySurface(GrSurface* dst,
+ GrSurface* src,
+ const SkIRect& srcRect,
+ const SkIPoint& dstPoint,
+ uint32_t pixelOpsFlags = 0);
+
+ /** Helper that copies the whole surface but fails when the two surfaces are not identically
+ sized. */
+ bool copySurface(GrSurface* dst, GrSurface* src) {
+ if (NULL == dst || NULL == src || dst->width() != src->width() ||
+ dst->height() != src->height()) {
+ return false;
+ }
+ this->copySurface(dst, src, SkIRect::MakeWH(dst->width(), dst->height()),
+ SkIPoint::Make(0,0));
+ return true;
+ }
+
+ /**
+ * After this returns any pending writes to the surface will have been issued to the backend 3D API.
+ */
+ void flushSurfaceWrites(GrSurface* surface);
/**
* Resolves a render target that has MSAA. The intermediate MSAA buffer is
« no previous file with comments | « no previous file | include/gpu/GrSurface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698