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

Unified Diff: src/gpu/SkGrPixelRef.cpp

Issue 621073002: Revert of GrContext::copyTexture->GrContext::copySurface. Add a flush writes pixel ops flag. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « src/gpu/GrSurface.cpp ('k') | src/image/SkSurface_Gpu.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGrPixelRef.cpp
diff --git a/src/gpu/SkGrPixelRef.cpp b/src/gpu/SkGrPixelRef.cpp
index 0fe219f6f0276351d2f1822eeaa5ae33041d6881..fcf22e350b02aef0ab2b2924775993d7f9c14977 100644
--- a/src/gpu/SkGrPixelRef.cpp
+++ b/src/gpu/SkGrPixelRef.cpp
@@ -64,18 +64,19 @@
}
GrTextureDesc desc;
- SkIRect srcRect;
-
- if (!subset) {
- desc.fWidth = texture->width();
- desc.fHeight = texture->height();
- srcRect = SkIRect::MakeWH(texture->width(), texture->height());
- } else {
+ SkIPoint pointStorage;
+ SkIPoint* topLeft;
+ if (subset != NULL) {
SkASSERT(SkIRect::MakeWH(texture->width(), texture->height()).contains(*subset));
// Create a new texture that is the size of subset.
desc.fWidth = subset->width();
desc.fHeight = subset->height();
- srcRect = *subset;
+ pointStorage.set(subset->x(), subset->y());
+ topLeft = &pointStorage;
+ } else {
+ desc.fWidth = texture->width();
+ desc.fHeight = texture->height();
+ topLeft = NULL;
}
desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit;
desc.fConfig = SkImageInfo2GrPixelConfig(dstCT, kPremul_SkAlphaType);
@@ -85,12 +86,13 @@
return NULL;
}
+ context->copyTexture(texture, dst->asRenderTarget(), topLeft);
+
// Blink is relying on the above copy being sent to GL immediately in the case when the source
- // is a WebGL canvas backing store. We could have a TODO to remove this flush flag, but we have
- // a larger TODO to remove SkGrPixelRef entirely.
- context->copySurface(texture, dst->asRenderTarget(), srcRect, SkIPoint::Make(0,0),
- GrContext::kFlushWrites_PixelOp);
-
+ // is a WebGL canvas backing store. We could have a TODO to remove this flush, but we have a
+ // larger TODO to remove SkGrPixelRef entirely.
+ context->flush();
+
SkImageInfo info = SkImageInfo::Make(desc.fWidth, desc.fHeight, dstCT, kPremul_SkAlphaType);
SkGrPixelRef* pixelRef = SkNEW_ARGS(SkGrPixelRef, (info, dst));
SkSafeUnref(dst);
« no previous file with comments | « src/gpu/GrSurface.cpp ('k') | src/image/SkSurface_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698