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

Unified Diff: src/gpu/SkGrPixelRef.cpp

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 | « 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 fcf22e350b02aef0ab2b2924775993d7f9c14977..489a418ce6387bde9a14bd6d77ff171983ccd476 100644
--- a/src/gpu/SkGrPixelRef.cpp
+++ b/src/gpu/SkGrPixelRef.cpp
@@ -64,19 +64,18 @@ static SkGrPixelRef* copy_to_new_texture_pixelref(GrTexture* texture, SkColorTyp
}
GrTextureDesc desc;
- SkIPoint pointStorage;
- SkIPoint* topLeft;
- if (subset != NULL) {
+ SkIRect srcRect;
+
+ if (!subset) {
+ desc.fWidth = texture->width();
+ desc.fHeight = texture->height();
+ srcRect = SkIRect::MakeWH(texture->width(), texture->height());
+ } else {
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();
- pointStorage.set(subset->x(), subset->y());
- topLeft = &pointStorage;
- } else {
- desc.fWidth = texture->width();
- desc.fHeight = texture->height();
- topLeft = NULL;
+ srcRect = *subset;
}
desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit;
desc.fConfig = SkImageInfo2GrPixelConfig(dstCT, kPremul_SkAlphaType);
@@ -86,13 +85,12 @@ static SkGrPixelRef* copy_to_new_texture_pixelref(GrTexture* texture, SkColorTyp
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, but we have a
- // larger TODO to remove SkGrPixelRef entirely.
- context->flush();
-
+ // 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(dst->asRenderTarget(), texture, srcRect, SkIPoint::Make(0,0),
+ GrContext::kFlushWrites_PixelOp);
+
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