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

Unified Diff: src/core/SkImageFilterUtils.cpp

Issue 30593003: Apply matrix early in draw bitmap (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Add flattenable registration for local image filter subclass to fix GM serialization failure Created 7 years, 2 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 | « include/gpu/SkGpuDevice.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkImageFilterUtils.cpp
diff --git a/src/core/SkImageFilterUtils.cpp b/src/core/SkImageFilterUtils.cpp
index a4ce51eb9101f2ceb336738d7c48220bab1e47af..8385fb446ae0726ade2ccfbad3250239e6209211 100644
--- a/src/core/SkImageFilterUtils.cpp
+++ b/src/core/SkImageFilterUtils.cpp
@@ -23,6 +23,11 @@ bool SkImageFilterUtils::WrapTexture(GrTexture* texture, int width, int height,
bool SkImageFilterUtils::GetInputResultGPU(SkImageFilter* filter, SkImageFilter::Proxy* proxy,
const SkBitmap& src, const SkMatrix& ctm,
SkBitmap* result, SkIPoint* offset) {
+ // Ensure that GrContext calls under filterImage and filterImageGPU below will see an identity
+ // matrix with no clip and that the matrix, clip, and render target set before this function was
+ // called are restored before we return to the caller.
+ GrContext* context = src.getTexture()->getContext();
+ GrContext::AutoWideOpenIdentityDraw awoid(context, NULL);
if (!filter) {
*result = src;
return true;
@@ -31,9 +36,7 @@ bool SkImageFilterUtils::GetInputResultGPU(SkImageFilter* filter, SkImageFilter:
} else {
if (filter->filterImage(proxy, src, ctm, result, offset)) {
if (!result->getTexture()) {
- GrContext* context = ((GrTexture *) src.getTexture())->getContext();
- GrTexture* resultTex = GrLockAndRefCachedBitmapTexture(context,
- *result, NULL);
+ GrTexture* resultTex = GrLockAndRefCachedBitmapTexture(context, *result, NULL);
result->setPixelRef(new SkGrPixelRef(resultTex))->unref();
GrUnlockAndUnrefCachedBitmapTexture(resultTex);
}
« no previous file with comments | « include/gpu/SkGpuDevice.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698