| 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 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| 11 #include "SkReadBuffer.h" | 11 #include "SkReadBuffer.h" |
| 12 #include "SkWriteBuffer.h" | 12 #include "SkWriteBuffer.h" |
| 13 #include "SkRect.h" | 13 #include "SkRect.h" |
| 14 #include "SkMorphology_opts.h" | 14 #include "SkMorphology_opts.h" |
| 15 #if SK_SUPPORT_GPU | 15 #if SK_SUPPORT_GPU |
| 16 #include "GrContext.h" | 16 #include "GrContext.h" |
| 17 #include "GrInvariantOutput.h" | 17 #include "GrInvariantOutput.h" |
| 18 #include "GrTexture.h" | 18 #include "GrTexture.h" |
| 19 #include "effects/Gr1DKernelEffect.h" | 19 #include "effects/Gr1DKernelEffect.h" |
| 20 #include "gl/GrGLProcessor.h" | 20 #include "gl/GrGLProcessor.h" |
| 21 #include "gl/builders/GrGLProgramBuilder.h" | 21 #include "gl/builders/GrGLProgramBuilder.h" |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, | 24 SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, |
| 25 int radiusY, | 25 int radiusY, |
| 26 SkImageFilter* input, | 26 SkImageFilter* input, |
| 27 const CropRect* cropRect, | 27 const CropRect* cropRect) |
| 28 uint32_t uniqueID) | 28 : INHERITED(1, &input, cropRect), fRadius(SkISize::Make(radiusX, radiusY)) { |
| 29 : INHERITED(1, &input, cropRect, uniqueID), fRadius(SkISize::Make(radiusX, r
adiusY)) { | |
| 30 } | 29 } |
| 31 | 30 |
| 32 void SkMorphologyImageFilter::flatten(SkWriteBuffer& buffer) const { | 31 void SkMorphologyImageFilter::flatten(SkWriteBuffer& buffer) const { |
| 33 this->INHERITED::flatten(buffer); | 32 this->INHERITED::flatten(buffer); |
| 34 buffer.writeInt(fRadius.fWidth); | 33 buffer.writeInt(fRadius.fWidth); |
| 35 buffer.writeInt(fRadius.fHeight); | 34 buffer.writeInt(fRadius.fHeight); |
| 36 } | 35 } |
| 37 | 36 |
| 38 enum MorphDirection { | 37 enum MorphDirection { |
| 39 kX, kY | 38 kX, kY |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 return false; | 246 return false; |
| 248 } | 247 } |
| 249 *dst = bounds; | 248 *dst = bounds; |
| 250 return true; | 249 return true; |
| 251 } | 250 } |
| 252 | 251 |
| 253 SkFlattenable* SkErodeImageFilter::CreateProc(SkReadBuffer& buffer) { | 252 SkFlattenable* SkErodeImageFilter::CreateProc(SkReadBuffer& buffer) { |
| 254 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 253 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
| 255 const int width = buffer.readInt(); | 254 const int width = buffer.readInt(); |
| 256 const int height = buffer.readInt(); | 255 const int height = buffer.readInt(); |
| 257 return Create(width, height, common.getInput(0), &common.cropRect(), common.
uniqueID()); | 256 return Create(width, height, common.getInput(0), &common.cropRect()); |
| 258 } | 257 } |
| 259 | 258 |
| 260 SkFlattenable* SkDilateImageFilter::CreateProc(SkReadBuffer& buffer) { | 259 SkFlattenable* SkDilateImageFilter::CreateProc(SkReadBuffer& buffer) { |
| 261 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 260 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
| 262 const int width = buffer.readInt(); | 261 const int width = buffer.readInt(); |
| 263 const int height = buffer.readInt(); | 262 const int height = buffer.readInt(); |
| 264 return Create(width, height, common.getInput(0), &common.cropRect(), common.
uniqueID()); | 263 return Create(width, height, common.getInput(0), &common.cropRect()); |
| 265 } | 264 } |
| 266 | 265 |
| 267 #ifndef SK_IGNORE_TO_STRING | 266 #ifndef SK_IGNORE_TO_STRING |
| 268 void SkErodeImageFilter::toString(SkString* str) const { | 267 void SkErodeImageFilter::toString(SkString* str) const { |
| 269 str->appendf("SkErodeImageFilter: ("); | 268 str->appendf("SkErodeImageFilter: ("); |
| 270 str->appendf("radius: (%d,%d)", this->radius().fWidth, this->radius().fHeigh
t); | 269 str->appendf("radius: (%d,%d)", this->radius().fWidth, this->radius().fHeigh
t); |
| 271 str->append(")"); | 270 str->append(")"); |
| 272 } | 271 } |
| 273 #endif | 272 #endif |
| 274 | 273 |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 SkBitmap* result, SkIPoint* offset) con
st { | 747 SkBitmap* result, SkIPoint* offset) con
st { |
| 749 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); | 748 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); |
| 750 } | 749 } |
| 751 | 750 |
| 752 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, | 751 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, |
| 753 SkBitmap* result, SkIPoint* offset) cons
t { | 752 SkBitmap* result, SkIPoint* offset) cons
t { |
| 754 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); | 753 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); |
| 755 } | 754 } |
| 756 | 755 |
| 757 #endif | 756 #endif |
| OLD | NEW |