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

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

Issue 23295017: In image filters, apply the CTM and offset to the crop rect. This is necessary to compensate for bo… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix documentation comment. Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/effects/SkBlurImageFilter.cpp ('k') | src/effects/SkLightingImageFilter.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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 const SkMatrix& matrix, 100 const SkMatrix& matrix,
101 SkBitmap* result, 101 SkBitmap* result,
102 SkIPoint* loc) { 102 SkIPoint* loc) {
103 SkBitmap src = source; 103 SkBitmap src = source;
104 if (getInput(0) && !getInput(0)->filterImage(proxy, source, matrix, &src, lo c)) { 104 if (getInput(0) && !getInput(0)->filterImage(proxy, source, matrix, &src, lo c)) {
105 return false; 105 return false;
106 } 106 }
107 107
108 SkIRect bounds; 108 SkIRect bounds;
109 src.getBounds(&bounds); 109 src.getBounds(&bounds);
110 if (!this->applyCropRect(&bounds)) { 110 if (!this->applyCropRect(&bounds, matrix)) {
111 return false; 111 return false;
112 } 112 }
113 113
114 SkAutoTUnref<SkDevice> device(proxy->createDevice(bounds.width(), bounds.hei ght())); 114 SkAutoTUnref<SkDevice> device(proxy->createDevice(bounds.width(), bounds.hei ght()));
115 SkCanvas canvas(device.get()); 115 SkCanvas canvas(device.get());
116 SkPaint paint; 116 SkPaint paint;
117 117
118 paint.setXfermodeMode(SkXfermode::kSrc_Mode); 118 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
119 paint.setColorFilter(fColorFilter); 119 paint.setColorFilter(fColorFilter);
120 canvas.drawSprite(src, -bounds.fLeft, -bounds.fTop, &paint); 120 canvas.drawSprite(src, -bounds.fLeft, -bounds.fTop, &paint);
121 121
122 *result = device.get()->accessBitmap(false); 122 *result = device.get()->accessBitmap(false);
123 loc->fX += bounds.fLeft; 123 loc->fX += bounds.fLeft;
124 loc->fY += bounds.fTop; 124 loc->fY += bounds.fTop;
125 return true; 125 return true;
126 } 126 }
127 127
128 bool SkColorFilterImageFilter::asColorFilter(SkColorFilter** filter) const { 128 bool SkColorFilterImageFilter::asColorFilter(SkColorFilter** filter) const {
129 if (cropRect().isLargest()) { 129 if (cropRect().isLargest()) {
130 if (filter) { 130 if (filter) {
131 *filter = fColorFilter; 131 *filter = fColorFilter;
132 fColorFilter->ref(); 132 fColorFilter->ref();
133 } 133 }
134 return true; 134 return true;
135 } 135 }
136 return false; 136 return false;
137 } 137 }
OLDNEW
« no previous file with comments | « src/effects/SkBlurImageFilter.cpp ('k') | src/effects/SkLightingImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698