aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2014-09-23 09:15:03 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-09-23 09:15:03 -0700
commite3d4bf234a04e14b6b0f33e11b3e1132b560c145 (patch)
tree4e8f1f75a0d3612d67dcc815320be68d29c05cf1 /src
parentcd523ebe2be30f268cdcec2d0b59eba609b9901b (diff)
Use draw buffer for texture copy impl.
R=robertphillips@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/589143004
Diffstat (limited to 'src')
-rwxr-xr-xsrc/gpu/GrContext.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index f8eca3682b..f18499c732 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -1576,16 +1576,21 @@ void GrContext::copyTexture(GrTexture* src, GrRenderTarget* dst, const SkIPoint*
if (NULL == src || NULL == dst) {
return;
}
- ASSERT_OWNED_RESOURCE(src);
+ ASSERT_OWNED_RESOURCE(src);
+ ASSERT_OWNED_RESOURCE(dst);
if (src->hasPendingWrite() || dst->hasPendingIO()) {
this->flush();
}
- GrDrawTarget::AutoStateRestore asr(fGpu, GrDrawTarget::kReset_ASRInit);
- GrDrawState* drawState = fGpu->drawState();
+ GrDrawTarget* target = this->prepareToDraw(NULL, kYes_BufferedDraw, NULL, NULL);
+ GrDrawTarget::AutoStateRestore asr(target, GrDrawTarget::kReset_ASRInit);
+ GrDrawState* drawState = target->drawState();
+
+ drawState->disableState(GrDrawState::kClip_StateBit);
drawState->setRenderTarget(dst);
+
SkMatrix sampleM;
sampleM.setIDiv(src->width(), src->height());
SkIRect srcRect = SkIRect::MakeWH(dst->width(), dst->height());
@@ -1598,8 +1603,9 @@ void GrContext::copyTexture(GrTexture* src, GrRenderTarget* dst, const SkIPoint*
}
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);
+ target->drawSimpleRect(dstR);
}
bool GrContext::writeRenderTargetPixels(GrRenderTarget* target,