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

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

Issue 305133006: use colortype instead of config (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 6 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/SkBicubicImageFilter.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 2011 The Android Open Source Project 2 * Copyright 2011 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 SkIRect srcBounds, dstBounds; 156 SkIRect srcBounds, dstBounds;
157 if (!this->applyCropRect(ctx, proxy, src, &srcOffset, &srcBounds, &src)) { 157 if (!this->applyCropRect(ctx, proxy, src, &srcOffset, &srcBounds, &src)) {
158 return false; 158 return false;
159 } 159 }
160 160
161 SkAutoLockPixels alp(src); 161 SkAutoLockPixels alp(src);
162 if (!src.getPixels()) { 162 if (!src.getPixels()) {
163 return false; 163 return false;
164 } 164 }
165 165
166 dst->setConfig(src.config(), srcBounds.width(), srcBounds.height()); 166 if (!dst->allocPixels(src.info().makeWH(srcBounds.width(), srcBounds.height( )))) {
167 dst->getBounds(&dstBounds);
168 if (!dst->allocPixels()) {
169 return false; 167 return false;
170 } 168 }
169 dst->getBounds(&dstBounds);
171 170
172 SkVector sigma = SkVector::Make(fSigma.width(), fSigma.height()); 171 SkVector sigma = SkVector::Make(fSigma.width(), fSigma.height());
173 ctx.ctm().mapVectors(&sigma, 1); 172 ctx.ctm().mapVectors(&sigma, 1);
174 sigma.fX = SkMinScalar(sigma.fX, MAX_SIGMA); 173 sigma.fX = SkMinScalar(sigma.fX, MAX_SIGMA);
175 sigma.fY = SkMinScalar(sigma.fY, MAX_SIGMA); 174 sigma.fY = SkMinScalar(sigma.fY, MAX_SIGMA);
176 175
177 int kernelSizeX, kernelSizeX3, lowOffsetX, highOffsetX; 176 int kernelSizeX, kernelSizeX3, lowOffsetX, highOffsetX;
178 int kernelSizeY, kernelSizeY3, lowOffsetY, highOffsetY; 177 int kernelSizeY, kernelSizeY3, lowOffsetY, highOffsetY;
179 getBox3Params(sigma.x(), &kernelSizeX, &kernelSizeX3, &lowOffsetX, &highOffs etX); 178 getBox3Params(sigma.x(), &kernelSizeX, &kernelSizeX3, &lowOffsetX, &highOffs etX);
180 getBox3Params(sigma.y(), &kernelSizeY, &kernelSizeY3, &lowOffsetY, &highOffs etY); 179 getBox3Params(sigma.y(), &kernelSizeY, &kernelSizeY3, &lowOffsetY, &highOffs etY);
181 180
182 if (kernelSizeX < 0 || kernelSizeY < 0) { 181 if (kernelSizeX < 0 || kernelSizeY < 0) {
183 return false; 182 return false;
184 } 183 }
185 184
186 if (kernelSizeX == 0 && kernelSizeY == 0) { 185 if (kernelSizeX == 0 && kernelSizeY == 0) {
187 src.copyTo(dst, dst->colorType()); 186 src.copyTo(dst, dst->colorType());
188 offset->fX = srcBounds.fLeft; 187 offset->fX = srcBounds.fLeft;
189 offset->fY = srcBounds.fTop; 188 offset->fY = srcBounds.fTop;
190 return true; 189 return true;
191 } 190 }
192 191
193 SkBitmap temp; 192 SkBitmap temp;
194 temp.setConfig(dst->config(), dst->width(), dst->height()); 193 if (!temp.allocPixels(dst->info())) {
195 if (!temp.allocPixels()) {
196 return false; 194 return false;
197 } 195 }
198 196
199 offset->fX = srcBounds.fLeft; 197 offset->fX = srcBounds.fLeft;
200 offset->fY = srcBounds.fTop; 198 offset->fY = srcBounds.fTop;
201 srcBounds.offset(-srcOffset); 199 srcBounds.offset(-srcOffset);
202 const SkPMColor* s = src.getAddr32(srcBounds.left(), srcBounds.top()); 200 const SkPMColor* s = src.getAddr32(srcBounds.left(), srcBounds.top());
203 SkPMColor* t = temp.getAddr32(0, 0); 201 SkPMColor* t = temp.getAddr32(0, 0);
204 SkPMColor* d = dst->getAddr32(0, 0); 202 SkPMColor* d = dst->getAddr32(0, 0);
205 int w = dstBounds.width(), h = dstBounds.height(); 203 int w = dstBounds.width(), h = dstBounds.height();
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 true, 282 true,
285 sigma.x(), 283 sigma.x(),
286 sigma.y())); 284 sigma.y()));
287 WrapTexture(tex, rect.width(), rect.height(), result); 285 WrapTexture(tex, rect.width(), rect.height(), result);
288 return true; 286 return true;
289 #else 287 #else
290 SkDEBUGFAIL("Should not call in GPU-less build"); 288 SkDEBUGFAIL("Should not call in GPU-less build");
291 return false; 289 return false;
292 #endif 290 #endif
293 } 291 }
OLDNEW
« no previous file with comments | « src/effects/SkBicubicImageFilter.cpp ('k') | src/effects/SkDisplacementMapEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698