Index: src/gpu/SkGrPixelRef.cpp |
diff --git a/src/gpu/SkGrPixelRef.cpp b/src/gpu/SkGrPixelRef.cpp |
index fcf22e350b02aef0ab2b2924775993d7f9c14977..9ea7f2c7697c888304a07aa77a830ade681e3b4a 100644 |
--- a/src/gpu/SkGrPixelRef.cpp |
+++ b/src/gpu/SkGrPixelRef.cpp |
@@ -64,19 +64,20 @@ static SkGrPixelRef* copy_to_new_texture_pixelref(GrTexture* texture, SkColorTyp |
} |
GrTextureDesc desc; |
robertphillips
2014/10/02 15:40:41
It would be nice to have a SkIPoint::Zero or Origi
bsalomon
2014/10/02 17:34:06
Done. (Make(0,0) in call site)
|
- SkIPoint pointStorage; |
- SkIPoint* topLeft; |
- if (subset != NULL) { |
+ SkIPoint dstPoint; |
+ dstPoint.setZero(); |
+ 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 +87,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(texture, dst->asRenderTarget(), srcRect, dstPoint, |
+ GrContext::kFlushWrites_PixelOp); |
+ |
SkImageInfo info = SkImageInfo::Make(desc.fWidth, desc.fHeight, dstCT, kPremul_SkAlphaType); |
SkGrPixelRef* pixelRef = SkNEW_ARGS(SkGrPixelRef, (info, dst)); |
SkSafeUnref(dst); |