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

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

Issue 503833002: Reimplement deserialization of SkImageFilter's uniqueID. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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
(...skipping 12 matching lines...) Expand all
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 */
27 27
28 typedef void (*Proc)(const SkPMColor* src, SkPMColor* dst, int radius, 28 typedef void (*Proc)(const SkPMColor* src, SkPMColor* dst, int radius,
29 int width, int height, int srcStride, int dstStride); 29 int width, int height, int srcStride, int dstStride);
30 30
31 protected: 31 protected:
32 SkMorphologyImageFilter(int radiusX, int radiusY, SkImageFilter* input, 32 SkMorphologyImageFilter(int radiusX, int radiusY, SkImageFilter* input,
33 const CropRect* cropRect); 33 const CropRect* cropRect, uint32_t uniqueID);
34 bool filterImageGeneric(Proc procX, Proc procY, 34 bool filterImageGeneric(Proc procX, Proc procY,
35 Proxy*, const SkBitmap& src, const Context&, 35 Proxy*, const SkBitmap& src, const Context&,
36 SkBitmap* result, SkIPoint* offset) const; 36 SkBitmap* result, SkIPoint* offset) const;
37 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING 37 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
38 SkMorphologyImageFilter(SkReadBuffer& buffer); 38 SkMorphologyImageFilter(SkReadBuffer& buffer);
39 #endif 39 #endif
40 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 40 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
41 #if SK_SUPPORT_GPU 41 #if SK_SUPPORT_GPU
42 virtual bool canFilterImageGPU() const SK_OVERRIDE { return true; } 42 virtual bool canFilterImageGPU() const SK_OVERRIDE { return true; }
43 bool filterImageGPUGeneric(bool dilate, Proxy* proxy, const SkBitmap& src, 43 bool filterImageGPUGeneric(bool dilate, Proxy* proxy, const SkBitmap& src,
44 const Context& ctm, SkBitmap* result, 44 const Context& ctm, SkBitmap* result,
45 SkIPoint* offset) const; 45 SkIPoint* offset) const;
46 #endif 46 #endif
47 47
48 SkISize radius() const { return fRadius; } 48 SkISize radius() const { return fRadius; }
49 49
50 private: 50 private:
51 SkISize fRadius; 51 SkISize fRadius;
52 typedef SkImageFilter INHERITED; 52 typedef SkImageFilter INHERITED;
53 }; 53 };
54 54
55 class SK_API SkDilateImageFilter : public SkMorphologyImageFilter { 55 class SK_API SkDilateImageFilter : public SkMorphologyImageFilter {
56 public: 56 public:
57 static SkDilateImageFilter* Create(int radiusX, int radiusY, 57 static SkDilateImageFilter* Create(int radiusX, int radiusY,
58 SkImageFilter* input = NULL, 58 SkImageFilter* input = NULL,
59 const CropRect* cropRect = NULL) { 59 const CropRect* cropRect = NULL,
60 uint32_t uniqueID = 0) {
60 if (radiusX < 0 || radiusY < 0) { 61 if (radiusX < 0 || radiusY < 0) {
61 return NULL; 62 return NULL;
62 } 63 }
63 return SkNEW_ARGS(SkDilateImageFilter, (radiusX, radiusY, input, cropRec t)); 64 return SkNEW_ARGS(SkDilateImageFilter, (radiusX, radiusY, input, cropRec t, uniqueID));
64 } 65 }
65 66
66 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, 67 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
67 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE; 68 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE;
68 #if SK_SUPPORT_GPU 69 #if SK_SUPPORT_GPU
69 virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context &, 70 virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context &,
70 SkBitmap* result, SkIPoint* offset) const SK_OVE RRIDE; 71 SkBitmap* result, SkIPoint* offset) const SK_OVE RRIDE;
71 #endif 72 #endif
72 73
73 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDilateImageFilter) 74 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDilateImageFilter)
74 75
75 protected: 76 protected:
76 SkDilateImageFilter(int radiusX, int radiusY, SkImageFilter* input, const Cr opRect* cropRect) 77 SkDilateImageFilter(int radiusX, int radiusY, SkImageFilter* input, const Cr opRect* cropRect, uint32_t uniqueID)
77 : INHERITED(radiusX, radiusY, input, cropRect) {} 78 : INHERITED(radiusX, radiusY, input, cropRect, uniqueID) {}
78 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING 79 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
79 explicit SkDilateImageFilter(SkReadBuffer& buffer) : INHERITED(buffer) {} 80 explicit SkDilateImageFilter(SkReadBuffer& buffer) : INHERITED(buffer) {}
80 #endif 81 #endif
81 82
82 private: 83 private:
83 typedef SkMorphologyImageFilter INHERITED; 84 typedef SkMorphologyImageFilter INHERITED;
84 }; 85 };
85 86
86 class SK_API SkErodeImageFilter : public SkMorphologyImageFilter { 87 class SK_API SkErodeImageFilter : public SkMorphologyImageFilter {
87 public: 88 public:
88 static SkErodeImageFilter* Create(int radiusX, int radiusY, 89 static SkErodeImageFilter* Create(int radiusX, int radiusY,
89 SkImageFilter* input = NULL, 90 SkImageFilter* input = NULL,
90 const CropRect* cropRect = NULL) { 91 const CropRect* cropRect = NULL,
92 uint32_t uniqueID = 0) {
91 if (radiusX < 0 || radiusY < 0) { 93 if (radiusX < 0 || radiusY < 0) {
92 return NULL; 94 return NULL;
93 } 95 }
94 return SkNEW_ARGS(SkErodeImageFilter, (radiusX, radiusY, input, cropRect )); 96 return SkNEW_ARGS(SkErodeImageFilter, (radiusX, radiusY, input, cropRect , uniqueID));
95 } 97 }
96 98
97 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, 99 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
98 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE; 100 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE;
99 #if SK_SUPPORT_GPU 101 #if SK_SUPPORT_GPU
100 virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context &, 102 virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context &,
101 SkBitmap* result, SkIPoint* offset) const SK_OVE RRIDE; 103 SkBitmap* result, SkIPoint* offset) const SK_OVE RRIDE;
102 #endif 104 #endif
103 105
104 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkErodeImageFilter) 106 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkErodeImageFilter)
105 107
106 protected: 108 protected:
107 SkErodeImageFilter(int radiusX, int radiusY, SkImageFilter* input, const Cro pRect* cropRect) 109 SkErodeImageFilter(int radiusX, int radiusY, SkImageFilter* input, const Cro pRect* cropRect, uint32_t uniqueID)
108 : INHERITED(radiusX, radiusY, input, cropRect) {} 110 : INHERITED(radiusX, radiusY, input, cropRect, uniqueID) {}
109 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING 111 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
110 explicit SkErodeImageFilter(SkReadBuffer& buffer) : INHERITED(buffer) {} 112 explicit SkErodeImageFilter(SkReadBuffer& buffer) : INHERITED(buffer) {}
111 #endif 113 #endif
112 114
113 private: 115 private:
114 typedef SkMorphologyImageFilter INHERITED; 116 typedef SkMorphologyImageFilter INHERITED;
115 }; 117 };
116 118
117 #endif 119 #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