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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 if (!this->isColorFilterNode(filterPtr)) { | 387 if (!this->isColorFilterNode(filterPtr)) { |
388 return false; | 388 return false; |
389 } | 389 } |
390 if (nullptr != this->getInput(0) || (*filterPtr)->affectsTransparentBlack())
{ | 390 if (nullptr != this->getInput(0) || (*filterPtr)->affectsTransparentBlack())
{ |
391 (*filterPtr)->unref(); | 391 (*filterPtr)->unref(); |
392 return false; | 392 return false; |
393 } | 393 } |
394 return true; | 394 return true; |
395 } | 395 } |
396 | 396 |
397 bool SkImageFilter::applyCropRect(const Context& ctx, const SkBitmap& src, | 397 bool SkImageFilter::applyCropRect(const Context& ctx, const SkIRect& srcBounds, |
398 const SkIPoint& srcOffset, SkIRect* dstBounds, | 398 SkIRect* dstBounds) const { |
399 SkIRect* srcBounds) const { | 399 this->onFilterNodeBounds(srcBounds, ctx.ctm(), dstBounds, kForward_MapDirect
ion); |
400 SkIRect storage; | |
401 if (!srcBounds) { | |
402 srcBounds = &storage; | |
403 } | |
404 src.getBounds(srcBounds); | |
405 srcBounds->offset(srcOffset); | |
406 this->onFilterNodeBounds(*srcBounds, ctx.ctm(), dstBounds, kForward_MapDirec
tion); | |
407 fCropRect.applyTo(*dstBounds, ctx.ctm(), dstBounds); | 400 fCropRect.applyTo(*dstBounds, ctx.ctm(), dstBounds); |
408 // Intersect against the clip bounds, in case the crop rect has | 401 // Intersect against the clip bounds, in case the crop rect has |
409 // grown the bounds beyond the original clip. This can happen for | 402 // grown the bounds beyond the original clip. This can happen for |
410 // example in tiling, where the clip is much smaller than the filtered | 403 // example in tiling, where the clip is much smaller than the filtered |
411 // primitive. If we didn't do this, we would be processing the filter | 404 // primitive. If we didn't do this, we would be processing the filter |
412 // at the full crop rect size in every tile. | 405 // at the full crop rect size in every tile. |
413 return dstBounds->intersect(ctx.clipBounds()); | 406 return dstBounds->intersect(ctx.clipBounds()); |
414 } | 407 } |
415 | 408 |
416 bool SkImageFilter::applyCropRect(const Context& ctx, Proxy* proxy, const SkBitm
ap& src, | 409 bool SkImageFilter::applyCropRect(const Context& ctx, Proxy* proxy, const SkBitm
ap& src, |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 } | 652 } |
660 return dev; | 653 return dev; |
661 } | 654 } |
662 | 655 |
663 bool SkImageFilter::DeviceProxy::filterImage(const SkImageFilter* filter, const
SkBitmap& src, | 656 bool SkImageFilter::DeviceProxy::filterImage(const SkImageFilter* filter, const
SkBitmap& src, |
664 const SkImageFilter::Context& ctx, | 657 const SkImageFilter::Context& ctx, |
665 SkBitmap* result, SkIPoint* offset) { | 658 SkBitmap* result, SkIPoint* offset) { |
666 return fDevice->filterImage(filter, src, ctx, result, offset); | 659 return fDevice->filterImage(filter, src, ctx, result, offset); |
667 } | 660 } |
668 | 661 |
OLD | NEW |