OLD | NEW |
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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 void SkAlphaThresholdFilterImpl::flatten(SkWriteBuffer& buffer) const { | 299 void SkAlphaThresholdFilterImpl::flatten(SkWriteBuffer& buffer) const { |
300 this->INHERITED::flatten(buffer); | 300 this->INHERITED::flatten(buffer); |
301 buffer.writeScalar(fInnerThreshold); | 301 buffer.writeScalar(fInnerThreshold); |
302 buffer.writeScalar(fOuterThreshold); | 302 buffer.writeScalar(fOuterThreshold); |
303 buffer.writeRegion(fRegion); | 303 buffer.writeRegion(fRegion); |
304 } | 304 } |
305 | 305 |
306 bool SkAlphaThresholdFilterImpl::onFilterImage(Proxy*, const SkBitmap& src, | 306 bool SkAlphaThresholdFilterImpl::onFilterImage(Proxy*, const SkBitmap& src, |
307 const Context& ctx, SkBitmap* dst
, | 307 const Context& ctx, SkBitmap* dst
, |
308 SkIPoint* offset) const { | 308 SkIPoint* offset) const { |
309 SkASSERT(src.colorType() == kN32_SkColorType); | 309 SkASSERT(src.colorType() == kPMColor_SkColorType); |
310 | 310 |
311 if (src.colorType() != kN32_SkColorType) { | 311 if (src.colorType() != kPMColor_SkColorType) { |
312 return false; | 312 return false; |
313 } | 313 } |
314 | 314 |
315 SkMatrix localInverse; | 315 SkMatrix localInverse; |
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()); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 (U8CPU)(SkColorGetG(source) *
scale), | 358 (U8CPU)(SkColorGetG(source) *
scale), |
359 (U8CPU)(SkColorGetB(source) *
scale)); | 359 (U8CPU)(SkColorGetB(source) *
scale)); |
360 } | 360 } |
361 } | 361 } |
362 dptr[y * dst->width() + x] = output_color; | 362 dptr[y * dst->width() + x] = output_color; |
363 } | 363 } |
364 } | 364 } |
365 | 365 |
366 return true; | 366 return true; |
367 } | 367 } |
OLD | NEW |