OLD | NEW |
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 "SkImageFilter.h" | 8 #include "SkImageFilter.h" |
9 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 canvas.drawBitmap(src, srcOffset->x() - bounds->x(), srcOffset->y() - bo
unds->y()); | 335 canvas.drawBitmap(src, srcOffset->x() - bounds->x(), srcOffset->y() - bo
unds->y()); |
336 *srcOffset = SkIPoint::Make(bounds->x(), bounds->y()); | 336 *srcOffset = SkIPoint::Make(bounds->x(), bounds->y()); |
337 *dst = device->accessBitmap(false); | 337 *dst = device->accessBitmap(false); |
338 return true; | 338 return true; |
339 } | 339 } |
340 } | 340 } |
341 | 341 |
342 bool SkImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm, | 342 bool SkImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm, |
343 SkIRect* dst) const { | 343 SkIRect* dst) const { |
344 if (fInputCount < 1) { | 344 if (fInputCount < 1) { |
345 *dst = src; | 345 return false; |
346 return true; | |
347 } | 346 } |
348 | 347 |
349 SkIRect bounds; | 348 SkIRect bounds; |
350 for (int i = 0; i < fInputCount; ++i) { | 349 for (int i = 0; i < fInputCount; ++i) { |
351 SkImageFilter* filter = this->getInput(i); | 350 SkImageFilter* filter = this->getInput(i); |
352 SkIRect rect = src; | 351 SkIRect rect = src; |
353 if (filter && !filter->filterBounds(src, ctm, &rect)) { | 352 if (filter && !filter->filterBounds(src, ctm, &rect)) { |
354 return false; | 353 return false; |
355 } | 354 } |
356 if (0 == i) { | 355 if (0 == i) { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 | 493 |
495 SkImageFilter::Cache* SkImageFilter::Cache::Create(size_t maxBytes) { | 494 SkImageFilter::Cache* SkImageFilter::Cache::Create(size_t maxBytes) { |
496 return SkNEW_ARGS(CacheImpl, (maxBytes)); | 495 return SkNEW_ARGS(CacheImpl, (maxBytes)); |
497 } | 496 } |
498 | 497 |
499 SK_DECLARE_STATIC_LAZY_PTR(SkImageFilter::Cache, cache, CreateCache); | 498 SK_DECLARE_STATIC_LAZY_PTR(SkImageFilter::Cache, cache, CreateCache); |
500 | 499 |
501 SkImageFilter::Cache* SkImageFilter::Cache::Get() { | 500 SkImageFilter::Cache* SkImageFilter::Cache::Get() { |
502 return cache.get(); | 501 return cache.get(); |
503 } | 502 } |
OLD | NEW |