| 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 12 matching lines...) Expand all Loading... |
| 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 SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, | 31 SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, |
| 32 int radiusY, | 32 int radiusY, |
| 33 SkImageFilter* input, | 33 sk_sp<SkImageFilter> input, |
| 34 const CropRect* cropRect) | 34 const CropRect* cropRect) |
| 35 : INHERITED(1, &input, cropRect) | 35 : INHERITED(&input, 1, cropRect) |
| 36 , fRadius(SkISize::Make(radiusX, radiusY)) { | 36 , fRadius(SkISize::Make(radiusX, radiusY)) { |
| 37 } | 37 } |
| 38 | 38 |
| 39 void SkMorphologyImageFilter::flatten(SkWriteBuffer& buffer) const { | 39 void SkMorphologyImageFilter::flatten(SkWriteBuffer& buffer) const { |
| 40 this->INHERITED::flatten(buffer); | 40 this->INHERITED::flatten(buffer); |
| 41 buffer.writeInt(fRadius.fWidth); | 41 buffer.writeInt(fRadius.fWidth); |
| 42 buffer.writeInt(fRadius.fHeight); | 42 buffer.writeInt(fRadius.fHeight); |
| 43 } | 43 } |
| 44 | 44 |
| 45 static void call_proc_X(SkMorphologyImageFilter::Proc procX, | 45 static void call_proc_X(SkMorphologyImageFilter::Proc procX, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 69 SkVector radius = SkVector::Make(SkIntToScalar(this->radius().width()), | 69 SkVector radius = SkVector::Make(SkIntToScalar(this->radius().width()), |
| 70 SkIntToScalar(this->radius().height())); | 70 SkIntToScalar(this->radius().height())); |
| 71 ctm.mapVectors(&radius, 1); | 71 ctm.mapVectors(&radius, 1); |
| 72 return src.makeOutset(SkScalarCeilToInt(radius.x()), SkScalarCeilToInt(radiu
s.y())); | 72 return src.makeOutset(SkScalarCeilToInt(radius.x()), SkScalarCeilToInt(radiu
s.y())); |
| 73 } | 73 } |
| 74 | 74 |
| 75 sk_sp<SkFlattenable> SkErodeImageFilter::CreateProc(SkReadBuffer& buffer) { | 75 sk_sp<SkFlattenable> SkErodeImageFilter::CreateProc(SkReadBuffer& buffer) { |
| 76 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 76 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
| 77 const int width = buffer.readInt(); | 77 const int width = buffer.readInt(); |
| 78 const int height = buffer.readInt(); | 78 const int height = buffer.readInt(); |
| 79 return sk_sp<SkFlattenable>(Create(width, height, common.getInput(0).get(), | 79 return Make(width, height, common.getInput(0), &common.cropRect()); |
| 80 &common.cropRect())); | |
| 81 } | 80 } |
| 82 | 81 |
| 83 sk_sp<SkFlattenable> SkDilateImageFilter::CreateProc(SkReadBuffer& buffer) { | 82 sk_sp<SkFlattenable> SkDilateImageFilter::CreateProc(SkReadBuffer& buffer) { |
| 84 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 83 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
| 85 const int width = buffer.readInt(); | 84 const int width = buffer.readInt(); |
| 86 const int height = buffer.readInt(); | 85 const int height = buffer.readInt(); |
| 87 return sk_sp<SkFlattenable>(Create(width, height, common.getInput(0).get(), | 86 return Make(width, height, common.getInput(0), &common.cropRect()); |
| 88 &common.cropRect())); | |
| 89 } | 87 } |
| 90 | 88 |
| 91 #ifndef SK_IGNORE_TO_STRING | 89 #ifndef SK_IGNORE_TO_STRING |
| 92 void SkErodeImageFilter::toString(SkString* str) const { | 90 void SkErodeImageFilter::toString(SkString* str) const { |
| 93 str->appendf("SkErodeImageFilter: ("); | 91 str->appendf("SkErodeImageFilter: ("); |
| 94 str->appendf("radius: (%d,%d)", this->radius().fWidth, this->radius().fHeigh
t); | 92 str->appendf("radius: (%d,%d)", this->radius().fWidth, this->radius().fHeigh
t); |
| 95 str->append(")"); | 93 str->append(")"); |
| 96 } | 94 } |
| 97 #endif | 95 #endif |
| 98 | 96 |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 inputPixmap.rowBytesAsPixels(), | 614 inputPixmap.rowBytesAsPixels(), |
| 617 &dst, height, srcBounds); | 615 &dst, height, srcBounds); |
| 618 } | 616 } |
| 619 offset->fX = bounds.left(); | 617 offset->fX = bounds.left(); |
| 620 offset->fY = bounds.top(); | 618 offset->fY = bounds.top(); |
| 621 | 619 |
| 622 return SkSpecialImage::MakeFromRaster(source->internal_getProxy(), | 620 return SkSpecialImage::MakeFromRaster(source->internal_getProxy(), |
| 623 SkIRect::MakeWH(bounds.width(), bounds
.height()), | 621 SkIRect::MakeWH(bounds.width(), bounds
.height()), |
| 624 dst); | 622 dst); |
| 625 } | 623 } |
| OLD | NEW |