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); |