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

Unified Diff: src/gpu/GrContext.cpp

Issue 607993002: Change GrContext::copyTexture to go through GrDrawTarget (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 | no next file » | 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..0d364d54b1e2170fff2f421672729ecdc11d4f36 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();
Justin Novosad 2014/09/26 18:48:23 Pretty sure this is no longer necessary now that w
bsalomon 2014/09/26 18:50:37 correct
- }
-
- 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,16 @@ 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);
+
+ AutoRestoreEffects are;
+ AutoCheckFlush acf(this);
+ GrDrawTarget* target = this->prepareToDraw(NULL, BUFFERED_DRAW, &are, &acf);
Justin Novosad 2014/09/26 18:48:23 This is just boilerplate stuff that I cargo-culted
+ if (NULL == target) {
+ return;
+ }
+ SkIPoint dstPoint;
+ dstPoint.setZero();
+ target->copySurface(dst, src, srcRect, dstPoint);
}
bool GrContext::writeRenderTargetPixels(GrRenderTarget* target,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698