Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Side by Side Diff: src/effects/SkMorphologyImageFilter.cpp

Issue 1860573002: Update SkMorphology ImageFilters to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « samplecode/SampleLayers.cpp ('k') | tests/ImageFilterTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 }
OLDNEW
« no previous file with comments | « samplecode/SampleLayers.cpp ('k') | tests/ImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698