Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Unified Diff: src/gpu/GrContext.cpp

Issue 609863002: Don't flush on copyTexture, take 2 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/gpu/SkGrPixelRef.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 42b884bcac8d0c54240d95d87cdb9c281919980b..b6923a0a0740f5651bc4fb65b744847378b98e28 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -1574,16 +1574,17 @@ 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* target = this->prepareToDraw(NULL, kYes_BufferedDraw, NULL, NULL);
+ GrDrawTarget::AutoStateRestore asr(target, GrDrawTarget::kReset_ASRInit);
+ GrDrawState* drawState = target->drawState();
- GrDrawTarget::AutoStateRestore asr(fGpu, GrDrawTarget::kReset_ASRInit);
- GrDrawState* drawState = fGpu->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());
@@ -1596,8 +1597,9 @@ void GrContext::copyTexture(GrTexture* src, GrRenderTarget* dst, const SkIPoint*
}
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);
+ target->drawSimpleRect(dstR);
}
bool GrContext::writeRenderTargetPixels(GrRenderTarget* target,
« no previous file with comments | « no previous file | src/gpu/SkGrPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698