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

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

Issue 143073008: add installPixels (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase 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/SkOrderedReadBuffer.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 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 "SkFlattenableBuffers.h" 10 #include "SkFlattenableBuffers.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 return false; 316 return false;
317 } 317 }
318 318
319 SkAutoLockPixels alp(src); 319 SkAutoLockPixels alp(src);
320 SkASSERT(src.getPixels()); 320 SkASSERT(src.getPixels());
321 if (!src.getPixels() || src.width() <= 0 || src.height() <= 0) { 321 if (!src.getPixels() || src.width() <= 0 || src.height() <= 0) {
322 return false; 322 return false;
323 } 323 }
324 324
325 dst->setConfig(src.config(), src.width(), src.height()); 325 dst->setConfig(src.config(), src.width(), src.height());
326 dst->allocPixels(); 326 if (!dst->allocPixels()) {
327 if (!dst->getPixels()) {
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 | « src/core/SkOrderedReadBuffer.cpp ('k') | src/effects/SkBicubicImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698