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 "SkMorphologyImageFilter.h" | 8 #include "SkMorphologyImageFilter.h" |
9 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 SkIRect srcBounds = bounds; | 544 SkIRect srcBounds = bounds; |
545 srcBounds.offset(-inputOffset); | 545 srcBounds.offset(-inputOffset); |
546 | 546 |
547 if (0 == width && 0 == height) { | 547 if (0 == width && 0 == height) { |
548 offset->fX = bounds.left(); | 548 offset->fX = bounds.left(); |
549 offset->fY = bounds.top(); | 549 offset->fY = bounds.top(); |
550 return input->makeSubset(srcBounds); | 550 return input->makeSubset(srcBounds); |
551 } | 551 } |
552 | 552 |
553 #if SK_SUPPORT_GPU | 553 #if SK_SUPPORT_GPU |
554 if (input->peekTexture()) { | 554 if (input->peekTexture() && input->peekTexture()->getContext()) { |
555 auto type = dilate ? GrMorphologyEffect::kDilate_MorphologyType | 555 auto type = dilate ? GrMorphologyEffect::kDilate_MorphologyType |
556 : GrMorphologyEffect::kErode_MorphologyType; | 556 : GrMorphologyEffect::kErode_MorphologyType; |
557 sk_sp<SkSpecialImage> result(apply_morphology(input.get(), srcBounds, ty
pe, | 557 sk_sp<SkSpecialImage> result(apply_morphology(input.get(), srcBounds, ty
pe, |
558 SkISize::Make(width, heigh
t))); | 558 SkISize::Make(width, heigh
t))); |
559 if (result) { | 559 if (result) { |
560 offset->fX = bounds.left(); | 560 offset->fX = bounds.left(); |
561 offset->fY = bounds.top(); | 561 offset->fY = bounds.top(); |
562 } | 562 } |
563 return result; | 563 return result; |
564 } | 564 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 sk_sp<SkSpecialImage> SkDilateImageFilter::onFilterImage(SkSpecialImage* source,
const Context& ctx, | 626 sk_sp<SkSpecialImage> SkDilateImageFilter::onFilterImage(SkSpecialImage* source,
const Context& ctx, |
627 SkIPoint* offset) const
{ | 627 SkIPoint* offset) const
{ |
628 return this->filterImageGeneric(true, source, ctx, offset); | 628 return this->filterImageGeneric(true, source, ctx, offset); |
629 } | 629 } |
630 | 630 |
631 sk_sp<SkSpecialImage> SkErodeImageFilter::onFilterImage(SkSpecialImage* source,
const Context& ctx, | 631 sk_sp<SkSpecialImage> SkErodeImageFilter::onFilterImage(SkSpecialImage* source,
const Context& ctx, |
632 SkIPoint* offset) const
{ | 632 SkIPoint* offset) const
{ |
633 return this->filterImageGeneric(false, source, ctx, offset); | 633 return this->filterImageGeneric(false, source, ctx, offset); |
634 } | 634 } |
635 | 635 |
OLD | NEW |