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

Side by Side Diff: src/core/SkImageFilterUtils.cpp

Issue 112803004: Make SkImageFilter crop rects relative to the primitive origin, instead of relative to their parent (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Updated to ToT Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/core/SkImageFilter.cpp ('k') | src/effects/SkBicubicImageFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 The Android Open Source Project 2 * Copyright 2013 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkMatrix.h" 8 #include "SkMatrix.h"
9 9
10 #if SK_SUPPORT_GPU 10 #if SK_SUPPORT_GPU
(...skipping 17 matching lines...) Expand all
28 28
29 bool SkImageFilterUtils::GetInputResultGPU(SkImageFilter* filter, SkImageFilter: :Proxy* proxy, 29 bool SkImageFilterUtils::GetInputResultGPU(SkImageFilter* filter, SkImageFilter: :Proxy* proxy,
30 const SkBitmap& src, const SkMatrix& ctm, 30 const SkBitmap& src, const SkMatrix& ctm,
31 SkBitmap* result, SkIPoint* offset) { 31 SkBitmap* result, SkIPoint* offset) {
32 // Ensure that GrContext calls under filterImage and filterImageGPU below wi ll see an identity 32 // Ensure that GrContext calls under filterImage and filterImageGPU below wi ll see an identity
33 // matrix with no clip and that the matrix, clip, and render target set befo re this function was 33 // matrix with no clip and that the matrix, clip, and render target set befo re this function was
34 // called are restored before we return to the caller. 34 // called are restored before we return to the caller.
35 GrContext* context = src.getTexture()->getContext(); 35 GrContext* context = src.getTexture()->getContext();
36 GrContext::AutoWideOpenIdentityDraw awoid(context, NULL); 36 GrContext::AutoWideOpenIdentityDraw awoid(context, NULL);
37 if (!filter) { 37 if (!filter) {
38 offset->fX = offset->fY = 0;
38 *result = src; 39 *result = src;
39 return true; 40 return true;
40 } else if (filter->canFilterImageGPU()) { 41 } else if (filter->canFilterImageGPU()) {
41 return filter->filterImageGPU(proxy, src, ctm, result, offset); 42 return filter->filterImageGPU(proxy, src, ctm, result, offset);
42 } else { 43 } else {
43 if (filter->filterImage(proxy, src, ctm, result, offset)) { 44 if (filter->filterImage(proxy, src, ctm, result, offset)) {
44 if (!result->getTexture()) { 45 if (!result->getTexture()) {
45 SkImageInfo info; 46 SkImageInfo info;
46 if (!result->asImageInfo(&info)) { 47 if (!result->asImageInfo(&info)) {
47 return false; 48 return false;
48 } 49 }
49 GrTexture* resultTex = GrLockAndRefCachedBitmapTexture(context, *result, NULL); 50 GrTexture* resultTex = GrLockAndRefCachedBitmapTexture(context, *result, NULL);
50 result->setPixelRef(new SkGrPixelRef(info, resultTex))->unref(); 51 result->setPixelRef(new SkGrPixelRef(info, resultTex))->unref();
51 GrUnlockAndUnrefCachedBitmapTexture(resultTex); 52 GrUnlockAndUnrefCachedBitmapTexture(resultTex);
52 } 53 }
53 return true; 54 return true;
54 } else { 55 } else {
55 return false; 56 return false;
56 } 57 }
57 } 58 }
58 } 59 }
59 #endif 60 #endif
OLDNEW
« no previous file with comments | « src/core/SkImageFilter.cpp ('k') | src/effects/SkBicubicImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698