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

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

Issue 1037793002: C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: git cl web Created 5 years, 9 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 | « src/doc/SkDocument_XPS.cpp ('k') | src/effects/SkArithmeticMode.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 2013 Google Inc. 2 * Copyright 2013 Google Inc.
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 "SkAlphaThresholdFilter.h" 8 #include "SkAlphaThresholdFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
11 #include "SkWriteBuffer.h" 11 #include "SkWriteBuffer.h"
12 #include "SkRegion.h" 12 #include "SkRegion.h"
13 13
14 class SK_API SkAlphaThresholdFilterImpl : public SkImageFilter { 14 class SK_API SkAlphaThresholdFilterImpl : public SkImageFilter {
15 public: 15 public:
16 SkAlphaThresholdFilterImpl(const SkRegion& region, SkScalar innerThreshold, 16 SkAlphaThresholdFilterImpl(const SkRegion& region, SkScalar innerThreshold,
17 SkScalar outerThreshold, SkImageFilter* input); 17 SkScalar outerThreshold, SkImageFilter* input);
18 18
19 SK_TO_STRING_OVERRIDE() 19 SK_TO_STRING_OVERRIDE()
20 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAlphaThresholdFilterIm pl) 20 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAlphaThresholdFilterIm pl)
21 21
22 protected: 22 protected:
23 void flatten(SkWriteBuffer&) const SK_OVERRIDE; 23 void flatten(SkWriteBuffer&) const override;
24 24
25 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, 25 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
26 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE; 26 SkBitmap* result, SkIPoint* offset) const overrid e;
27 #if SK_SUPPORT_GPU 27 #if SK_SUPPORT_GPU
28 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const Sk Matrix&, 28 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const Sk Matrix&,
29 const SkIRect& bounds) const SK_OVERRIDE; 29 const SkIRect& bounds) const override;
30 #endif 30 #endif
31 31
32 private: 32 private:
33 SkRegion fRegion; 33 SkRegion fRegion;
34 SkScalar fInnerThreshold; 34 SkScalar fInnerThreshold;
35 SkScalar fOuterThreshold; 35 SkScalar fOuterThreshold;
36 typedef SkImageFilter INHERITED; 36 typedef SkImageFilter INHERITED;
37 }; 37 };
38 38
39 SkImageFilter* SkAlphaThresholdFilter::Create(const SkRegion& region, 39 SkImageFilter* SkAlphaThresholdFilter::Create(const SkRegion& region,
(...skipping 24 matching lines...) Expand all
64 float innerThreshold, 64 float innerThreshold,
65 float outerThreshold) { 65 float outerThreshold) {
66 return SkNEW_ARGS(AlphaThresholdEffect, (texture, 66 return SkNEW_ARGS(AlphaThresholdEffect, (texture,
67 maskTexture, 67 maskTexture,
68 innerThreshold, 68 innerThreshold,
69 outerThreshold)); 69 outerThreshold));
70 } 70 }
71 71
72 virtual ~AlphaThresholdEffect() {}; 72 virtual ~AlphaThresholdEffect() {};
73 73
74 const char* name() const SK_OVERRIDE { return "Alpha Threshold"; } 74 const char* name() const override { return "Alpha Threshold"; }
75 75
76 float innerThreshold() const { return fInnerThreshold; } 76 float innerThreshold() const { return fInnerThreshold; }
77 float outerThreshold() const { return fOuterThreshold; } 77 float outerThreshold() const { return fOuterThreshold; }
78 78
79 void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) const SK_OVE RRIDE; 79 void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) const overri de;
80 80
81 GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE; 81 GrGLFragmentProcessor* createGLInstance() const override;
82 82
83 private: 83 private:
84 AlphaThresholdEffect(GrTexture* texture, 84 AlphaThresholdEffect(GrTexture* texture,
85 GrTexture* maskTexture, 85 GrTexture* maskTexture,
86 float innerThreshold, 86 float innerThreshold,
87 float outerThreshold) 87 float outerThreshold)
88 : fInnerThreshold(innerThreshold) 88 : fInnerThreshold(innerThreshold)
89 , fOuterThreshold(outerThreshold) 89 , fOuterThreshold(outerThreshold)
90 , fImageCoordTransform(kLocal_GrCoordSet, 90 , fImageCoordTransform(kLocal_GrCoordSet,
91 GrCoordTransform::MakeDivByTextureWHMatrix(textur e), texture, 91 GrCoordTransform::MakeDivByTextureWHMatrix(textur e), texture,
92 GrTextureParams::kNone_FilterMode) 92 GrTextureParams::kNone_FilterMode)
93 , fImageTextureAccess(texture) 93 , fImageTextureAccess(texture)
94 , fMaskCoordTransform(kLocal_GrCoordSet, 94 , fMaskCoordTransform(kLocal_GrCoordSet,
95 GrCoordTransform::MakeDivByTextureWHMatrix(maskTex ture), maskTexture, 95 GrCoordTransform::MakeDivByTextureWHMatrix(maskTex ture), maskTexture,
96 GrTextureParams::kNone_FilterMode) 96 GrTextureParams::kNone_FilterMode)
97 , fMaskTextureAccess(maskTexture) { 97 , fMaskTextureAccess(maskTexture) {
98 this->initClassID<AlphaThresholdEffect>(); 98 this->initClassID<AlphaThresholdEffect>();
99 this->addCoordTransform(&fImageCoordTransform); 99 this->addCoordTransform(&fImageCoordTransform);
100 this->addTextureAccess(&fImageTextureAccess); 100 this->addTextureAccess(&fImageTextureAccess);
101 this->addCoordTransform(&fMaskCoordTransform); 101 this->addCoordTransform(&fMaskCoordTransform);
102 this->addTextureAccess(&fMaskTextureAccess); 102 this->addTextureAccess(&fMaskTextureAccess);
103 } 103 }
104 104
105 bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; 105 bool onIsEqual(const GrFragmentProcessor&) const override;
106 106
107 void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE; 107 void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
108 108
109 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 109 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
110 110
111 float fInnerThreshold; 111 float fInnerThreshold;
112 float fOuterThreshold; 112 float fOuterThreshold;
113 GrCoordTransform fImageCoordTransform; 113 GrCoordTransform fImageCoordTransform;
114 GrTextureAccess fImageTextureAccess; 114 GrTextureAccess fImageTextureAccess;
115 GrCoordTransform fMaskCoordTransform; 115 GrCoordTransform fMaskCoordTransform;
116 GrTextureAccess fMaskTextureAccess; 116 GrTextureAccess fMaskTextureAccess;
117 117
118 typedef GrFragmentProcessor INHERITED; 118 typedef GrFragmentProcessor INHERITED;
119 }; 119 };
120 120
121 class GrGLAlphaThresholdEffect : public GrGLFragmentProcessor { 121 class GrGLAlphaThresholdEffect : public GrGLFragmentProcessor {
122 public: 122 public:
123 GrGLAlphaThresholdEffect(const GrFragmentProcessor&) {} 123 GrGLAlphaThresholdEffect(const GrFragmentProcessor&) {}
124 124
125 virtual void emitCode(GrGLFPBuilder*, 125 virtual void emitCode(GrGLFPBuilder*,
126 const GrFragmentProcessor&, 126 const GrFragmentProcessor&,
127 const char* outputColor, 127 const char* outputColor,
128 const char* inputColor, 128 const char* inputColor,
129 const TransformedCoordsArray&, 129 const TransformedCoordsArray&,
130 const TextureSamplerArray&) SK_OVERRIDE; 130 const TextureSamplerArray&) override;
131 131
132 void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE; 132 void setData(const GrGLProgramDataManager&, const GrProcessor&) override;
133 133
134 private: 134 private:
135 135
136 GrGLProgramDataManager::UniformHandle fInnerThresholdVar; 136 GrGLProgramDataManager::UniformHandle fInnerThresholdVar;
137 GrGLProgramDataManager::UniformHandle fOuterThresholdVar; 137 GrGLProgramDataManager::UniformHandle fOuterThresholdVar;
138 138
139 typedef GrGLFragmentProcessor INHERITED; 139 typedef GrGLFragmentProcessor INHERITED;
140 }; 140 };
141 141
142 void GrGLAlphaThresholdEffect::emitCode(GrGLFPBuilder* builder, 142 void GrGLAlphaThresholdEffect::emitCode(GrGLFPBuilder* builder,
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 } 377 }
378 378
379 #ifndef SK_IGNORE_TO_STRING 379 #ifndef SK_IGNORE_TO_STRING
380 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { 380 void SkAlphaThresholdFilterImpl::toString(SkString* str) const {
381 str->appendf("SkAlphaThresholdImageFilter: ("); 381 str->appendf("SkAlphaThresholdImageFilter: (");
382 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); 382 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold);
383 str->append(")"); 383 str->append(")");
384 } 384 }
385 #endif 385 #endif
386 386
OLDNEW
« no previous file with comments | « src/doc/SkDocument_XPS.cpp ('k') | src/effects/SkArithmeticMode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698