Index: src/gpu/GrContext.cpp |
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp |
index 091c4a899e401595fe26c4fa7f5053391d02e2cd..9628645ccd2bc6321d1a040fd0c7fef92cbb6ff1 100755 |
--- a/src/gpu/GrContext.cpp |
+++ b/src/gpu/GrContext.cpp |
@@ -1556,17 +1556,6 @@ void GrContext::copyTexture(GrTexture* src, GrRenderTarget* dst, const SkIPoint* |
} |
ASSERT_OWNED_RESOURCE(src); |
- // Writes pending to the source texture are not tracked, so a flush |
- // is required to ensure that the copy captures the most recent contents |
- // of the source texture. See similar behavior in |
- // GrContext::resolveRenderTarget. |
- this->flush(); |
- |
- GrDrawTarget::AutoStateRestore asr(fGpu, GrDrawTarget::kReset_ASRInit); |
- GrDrawState* drawState = fGpu->drawState(); |
- drawState->setRenderTarget(dst); |
- SkMatrix sampleM; |
- sampleM.setIDiv(src->width(), src->height()); |
SkIRect srcRect = SkIRect::MakeWH(dst->width(), dst->height()); |
if (NULL != topLeft) { |
srcRect.offset(*topLeft); |
@@ -1575,10 +1564,14 @@ void GrContext::copyTexture(GrTexture* src, GrRenderTarget* dst, const SkIPoint* |
if (!srcRect.intersect(srcBounds)) { |
return; |
} |
- sampleM.preTranslate(SkIntToScalar(srcRect.fLeft), SkIntToScalar(srcRect.fTop)); |
- drawState->addColorTextureEffect(src, sampleM); |
- SkRect dstR = SkRect::MakeWH(SkIntToScalar(srcRect.width()), SkIntToScalar(srcRect.height())); |
- fGpu->drawSimpleRect(dstR); |
+ |
+ GrDrawTarget* target = this->prepareToDraw(NULL, BUFFERED_DRAW, NULL, NULL); |
+ if (NULL == target) { |
+ return; |
+ } |
+ SkIPoint dstPoint; |
+ dstPoint.setZero(); |
+ target->copySurface(dst, src, srcRect, dstPoint); |
} |
bool GrContext::writeRenderTargetPixels(GrRenderTarget* target, |