aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/GrContext.cpp')
-rwxr-xr-xsrc/gpu/GrContext.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 42b884bcac..ad1b4c4955 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -1576,16 +1576,6 @@ void GrContext::copyTexture(GrTexture* src, GrRenderTarget* dst, const SkIPoint*
}
ASSERT_OWNED_RESOURCE(src);
-
- if (src->hasPendingWrite() || dst->hasPendingIO()) {
- 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 (topLeft) {
srcRect.offset(*topLeft);
@@ -1594,10 +1584,14 @@ void GrContext::copyTexture(GrTexture* src, GrRenderTarget* dst, const SkIPoint*
if (!srcRect.intersect(srcBounds)) {
return;
}
- sampleM.preTranslate(SkIntToScalar(srcRect.fLeft), SkIntToScalar(srcRect.fTop));
- drawState->addColorTextureProcessor(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,