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

Side by Side Diff: include/effects/SkMorphologyImageFilter.h

Issue 1390523005: factories should return baseclass, allowing the impl to specialize (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 2 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 | « include/effects/SkMergeImageFilter.h ('k') | include/effects/SkOffsetImageFilter.h » ('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 8
9 #ifndef SkMorphologyImageFilter_DEFINED 9 #ifndef SkMorphologyImageFilter_DEFINED
10 #define SkMorphologyImageFilter_DEFINED 10 #define SkMorphologyImageFilter_DEFINED
11 11
12 #include "SkColor.h" 12 #include "SkColor.h"
13 #include "SkImageFilter.h" 13 #include "SkImageFilter.h"
14 #include "SkSize.h" 14 #include "SkSize.h"
15 15
16 class SK_API SkMorphologyImageFilter : public SkImageFilter { 16 class SkMorphologyImageFilter : public SkImageFilter {
17 public: 17 public:
18 void computeFastBounds(const SkRect& src, SkRect* dst) const override; 18 void computeFastBounds(const SkRect& src, SkRect* dst) const override;
19 bool onFilterBounds(const SkIRect& src, const SkMatrix& ctm, SkIRect* dst) c onst override; 19 bool onFilterBounds(const SkIRect& src, const SkMatrix& ctm, SkIRect* dst) c onst override;
20 20
21 /** 21 /**
22 * All morphology procs have the same signature: src is the source buffer, d st the 22 * All morphology procs have the same signature: src is the source buffer, d st the
23 * destination buffer, radius is the morphology radius, width and height are the bounds 23 * destination buffer, radius is the morphology radius, width and height are the bounds
24 * of the destination buffer (in pixels), and srcStride and dstStride are th e 24 * of the destination buffer (in pixels), and srcStride and dstStride are th e
25 * number of pixels per row in each buffer. All buffers are 8888. 25 * number of pixels per row in each buffer. All buffers are 8888.
26 */ 26 */
(...skipping 17 matching lines...) Expand all
44 44
45 SkISize radius() const { return fRadius; } 45 SkISize radius() const { return fRadius; }
46 46
47 private: 47 private:
48 SkISize fRadius; 48 SkISize fRadius;
49 typedef SkImageFilter INHERITED; 49 typedef SkImageFilter INHERITED;
50 }; 50 };
51 51
52 class SK_API SkDilateImageFilter : public SkMorphologyImageFilter { 52 class SK_API SkDilateImageFilter : public SkMorphologyImageFilter {
53 public: 53 public:
54 static SkDilateImageFilter* Create(int radiusX, int radiusY, 54 static SkImageFilter* Create(int radiusX, int radiusY, SkImageFilter* input = NULL,
55 SkImageFilter* input = NULL, 55 const CropRect* cropRect = NULL) {
56 const CropRect* cropRect = NULL) {
57 if (radiusX < 0 || radiusY < 0) { 56 if (radiusX < 0 || radiusY < 0) {
58 return NULL; 57 return NULL;
59 } 58 }
60 return new SkDilateImageFilter(radiusX, radiusY, input, cropRect); 59 return new SkDilateImageFilter(radiusX, radiusY, input, cropRect);
61 } 60 }
62 61
63 bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, 62 bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
64 SkBitmap* result, SkIPoint* offset) const override; 63 SkBitmap* result, SkIPoint* offset) const override;
64
65 #if SK_SUPPORT_GPU 65 #if SK_SUPPORT_GPU
66 bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context&, 66 bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context&,
67 SkBitmap* result, SkIPoint* offset) const override; 67 SkBitmap* result, SkIPoint* offset) const override;
68 #endif 68 #endif
69 69
70 SK_TO_STRING_OVERRIDE() 70 SK_TO_STRING_OVERRIDE()
71 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDilateImageFilter) 71 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDilateImageFilter)
72 72
73 protected: 73 private:
74 SkDilateImageFilter(int radiusX, int radiusY, SkImageFilter* input, const Cr opRect* cropRect) 74 SkDilateImageFilter(int radiusX, int radiusY, SkImageFilter* input, const Cr opRect* cropRect)
75 : INHERITED(radiusX, radiusY, input, cropRect) {} 75 : INHERITED(radiusX, radiusY, input, cropRect) {}
76 private: 76
77 typedef SkMorphologyImageFilter INHERITED; 77 typedef SkMorphologyImageFilter INHERITED;
78 }; 78 };
79 79
80 class SK_API SkErodeImageFilter : public SkMorphologyImageFilter { 80 class SK_API SkErodeImageFilter : public SkMorphologyImageFilter {
81 public: 81 public:
82 static SkErodeImageFilter* Create(int radiusX, int radiusY, 82 static SkImageFilter* Create(int radiusX, int radiusY,
83 SkImageFilter* input = NULL, 83 SkImageFilter* input = NULL,
84 const CropRect* cropRect = NULL) { 84 const CropRect* cropRect = NULL) {
85 if (radiusX < 0 || radiusY < 0) { 85 if (radiusX < 0 || radiusY < 0) {
86 return NULL; 86 return NULL;
87 } 87 }
88 return new SkErodeImageFilter(radiusX, radiusY, input, cropRect); 88 return new SkErodeImageFilter(radiusX, radiusY, input, cropRect);
89 } 89 }
90 90
91 bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, 91 bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
92 SkBitmap* result, SkIPoint* offset) const override; 92 SkBitmap* result, SkIPoint* offset) const override;
93
93 #if SK_SUPPORT_GPU 94 #if SK_SUPPORT_GPU
94 bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context&, 95 bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context&,
95 SkBitmap* result, SkIPoint* offset) const override; 96 SkBitmap* result, SkIPoint* offset) const override;
96 #endif 97 #endif
97 98
98 SK_TO_STRING_OVERRIDE() 99 SK_TO_STRING_OVERRIDE()
99 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkErodeImageFilter) 100 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkErodeImageFilter)
100 101
101 protected: 102 private:
102 SkErodeImageFilter(int radiusX, int radiusY, SkImageFilter* input, const Cro pRect* cropRect) 103 SkErodeImageFilter(int radiusX, int radiusY, SkImageFilter* input, const Cro pRect* cropRect)
103 : INHERITED(radiusX, radiusY, input, cropRect) {} 104 : INHERITED(radiusX, radiusY, input, cropRect) {}
104 105
105 private:
106 typedef SkMorphologyImageFilter INHERITED; 106 typedef SkMorphologyImageFilter INHERITED;
107 }; 107 };
108 108
109 #endif 109 #endif
OLDNEW
« no previous file with comments | « include/effects/SkMergeImageFilter.h ('k') | include/effects/SkOffsetImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698