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

Side by Side Diff: src/effects/SkAlphaThresholdFilter.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 | « include/core/SkImageInfo.h ('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 Google Inc. 2 * Copyright 2013 Google Inc.
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 "SkAlphaThresholdFilter.h" 8 #include "SkAlphaThresholdFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 if (!ctx.ctm().invert(&localInverse)) { 316 if (!ctx.ctm().invert(&localInverse)) {
317 return false; 317 return false;
318 } 318 }
319 319
320 SkAutoLockPixels alp(src); 320 SkAutoLockPixels alp(src);
321 SkASSERT(src.getPixels()); 321 SkASSERT(src.getPixels());
322 if (!src.getPixels() || src.width() <= 0 || src.height() <= 0) { 322 if (!src.getPixels() || src.width() <= 0 || src.height() <= 0) {
323 return false; 323 return false;
324 } 324 }
325 325
326 dst->setConfig(src.config(), src.width(), src.height()); 326 if (!dst->allocPixels(src.info())) {
327 if (!dst->allocPixels()) {
328 return false; 327 return false;
329 } 328 }
330 329
331 U8CPU innerThreshold = (U8CPU)(fInnerThreshold * 0xFF); 330 U8CPU innerThreshold = (U8CPU)(fInnerThreshold * 0xFF);
332 U8CPU outerThreshold = (U8CPU)(fOuterThreshold * 0xFF); 331 U8CPU outerThreshold = (U8CPU)(fOuterThreshold * 0xFF);
333 SkColor* sptr = src.getAddr32(0, 0); 332 SkColor* sptr = src.getAddr32(0, 0);
334 SkColor* dptr = dst->getAddr32(0, 0); 333 SkColor* dptr = dst->getAddr32(0, 0);
335 int width = src.width(), height = src.height(); 334 int width = src.width(), height = src.height();
336 for (int y = 0; y < height; ++y) { 335 for (int y = 0; y < height; ++y) {
337 for (int x = 0; x < width; ++x) { 336 for (int x = 0; x < width; ++x) {
(...skipping 20 matching lines...) Expand all
358 (U8CPU)(SkColorGetG(source) * scale), 357 (U8CPU)(SkColorGetG(source) * scale),
359 (U8CPU)(SkColorGetB(source) * scale)); 358 (U8CPU)(SkColorGetB(source) * scale));
360 } 359 }
361 } 360 }
362 dptr[y * dst->width() + x] = output_color; 361 dptr[y * dst->width() + x] = output_color;
363 } 362 }
364 } 363 }
365 364
366 return true; 365 return true;
367 } 366 }
OLDNEW
« no previous file with comments | « include/core/SkImageInfo.h ('k') | src/effects/SkBicubicImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698