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 10 matching lines...) Expand all Loading... |
21 #include "GrInvariantOutput.h" | 21 #include "GrInvariantOutput.h" |
22 #include "GrTexture.h" | 22 #include "GrTexture.h" |
23 #include "SkGr.h" | 23 #include "SkGr.h" |
24 #include "effects/Gr1DKernelEffect.h" | 24 #include "effects/Gr1DKernelEffect.h" |
25 #include "glsl/GrGLSLFragmentProcessor.h" | 25 #include "glsl/GrGLSLFragmentProcessor.h" |
26 #include "glsl/GrGLSLFragmentShaderBuilder.h" | 26 #include "glsl/GrGLSLFragmentShaderBuilder.h" |
27 #include "glsl/GrGLSLProgramDataManager.h" | 27 #include "glsl/GrGLSLProgramDataManager.h" |
28 #include "glsl/GrGLSLUniformHandler.h" | 28 #include "glsl/GrGLSLUniformHandler.h" |
29 #endif | 29 #endif |
30 | 30 |
| 31 sk_sp<SkImageFilter> SkDilateImageFilter::Make(int radiusX, int radiusY, |
| 32 sk_sp<SkImageFilter> input, |
| 33 const CropRect* cropRect) { |
| 34 if (radiusX < 0 || radiusY < 0) { |
| 35 return nullptr; |
| 36 } |
| 37 return sk_sp<SkImageFilter>(new SkDilateImageFilter(radiusX, radiusY, |
| 38 std::move(input), |
| 39 cropRect)); |
| 40 } |
| 41 |
| 42 |
| 43 sk_sp<SkImageFilter> SkErodeImageFilter::Make(int radiusX, int radiusY, |
| 44 sk_sp<SkImageFilter> input, |
| 45 const CropRect* cropRect) { |
| 46 if (radiusX < 0 || radiusY < 0) { |
| 47 return nullptr; |
| 48 } |
| 49 return sk_sp<SkImageFilter>(new SkErodeImageFilter(radiusX, radiusY, |
| 50 std::move(input), |
| 51 cropRect)); |
| 52 } |
| 53 |
31 SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, | 54 SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, |
32 int radiusY, | 55 int radiusY, |
33 sk_sp<SkImageFilter> input, | 56 sk_sp<SkImageFilter> input, |
34 const CropRect* cropRect) | 57 const CropRect* cropRect) |
35 : INHERITED(&input, 1, cropRect) | 58 : INHERITED(&input, 1, cropRect) |
36 , fRadius(SkISize::Make(radiusX, radiusY)) { | 59 , fRadius(SkISize::Make(radiusX, radiusY)) { |
37 } | 60 } |
38 | 61 |
39 void SkMorphologyImageFilter::flatten(SkWriteBuffer& buffer) const { | 62 void SkMorphologyImageFilter::flatten(SkWriteBuffer& buffer) const { |
40 this->INHERITED::flatten(buffer); | 63 this->INHERITED::flatten(buffer); |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 inputBM.rowBytesAsPixels(), | 641 inputBM.rowBytesAsPixels(), |
619 &dst, height, srcBounds); | 642 &dst, height, srcBounds); |
620 } | 643 } |
621 offset->fX = bounds.left(); | 644 offset->fX = bounds.left(); |
622 offset->fY = bounds.top(); | 645 offset->fY = bounds.top(); |
623 | 646 |
624 return SkSpecialImage::MakeFromRaster(source->internal_getProxy(), | 647 return SkSpecialImage::MakeFromRaster(source->internal_getProxy(), |
625 SkIRect::MakeWH(bounds.width(), bounds
.height()), | 648 SkIRect::MakeWH(bounds.width(), bounds
.height()), |
626 dst, &source->props()); | 649 dst, &source->props()); |
627 } | 650 } |
OLD | NEW |