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

Side by Side Diff: src/effects/SkColorFilterImageFilter.cpp

Issue 198003008: Implement support for expanding crop rects in image filters (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix ImageFilterTest Created 6 years, 9 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/effects/SkBlurImageFilter.cpp ('k') | src/effects/SkDisplacementMapEffect.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 2012 The Android Open Source Project 2 * Copyright 2012 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 "SkColorFilterImageFilter.h" 8 #include "SkColorFilterImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 const Context& ctx, 102 const Context& ctx,
103 SkBitmap* result, 103 SkBitmap* result,
104 SkIPoint* offset) const { 104 SkIPoint* offset) const {
105 SkBitmap src = source; 105 SkBitmap src = source;
106 SkIPoint srcOffset = SkIPoint::Make(0, 0); 106 SkIPoint srcOffset = SkIPoint::Make(0, 0);
107 if (getInput(0) && !getInput(0)->filterImage(proxy, source, ctx, &src, &srcO ffset)) { 107 if (getInput(0) && !getInput(0)->filterImage(proxy, source, ctx, &src, &srcO ffset)) {
108 return false; 108 return false;
109 } 109 }
110 110
111 SkIRect bounds; 111 SkIRect bounds;
112 src.getBounds(&bounds); 112 if (!this->applyCropRect(ctx, src, srcOffset, &bounds)) {
113 bounds.offset(srcOffset);
114 if (!this->applyCropRect(&bounds, ctx.ctm())) {
115 return false; 113 return false;
116 } 114 }
117 115
118 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds .height())); 116 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds .height()));
119 if (NULL == device.get()) { 117 if (NULL == device.get()) {
120 return false; 118 return false;
121 } 119 }
122 SkCanvas canvas(device.get()); 120 SkCanvas canvas(device.get());
123 SkPaint paint; 121 SkPaint paint;
124 122
(...skipping 10 matching lines...) Expand all
135 bool SkColorFilterImageFilter::asColorFilter(SkColorFilter** filter) const { 133 bool SkColorFilterImageFilter::asColorFilter(SkColorFilter** filter) const {
136 if (!cropRectIsSet()) { 134 if (!cropRectIsSet()) {
137 if (filter) { 135 if (filter) {
138 *filter = fColorFilter; 136 *filter = fColorFilter;
139 fColorFilter->ref(); 137 fColorFilter->ref();
140 } 138 }
141 return true; 139 return true;
142 } 140 }
143 return false; 141 return false;
144 } 142 }
OLDNEW
« no previous file with comments | « src/effects/SkBlurImageFilter.cpp ('k') | src/effects/SkDisplacementMapEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698