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

Side by Side Diff: src/gpu/effects/GrOvalEffect.cpp

Issue 699943003: Move GrInvariantOutput out of GrProcessor and into its own class. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Cleanup Created 6 years, 1 month 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/gpu/effects/GrMatrixConvolutionEffect.h ('k') | src/gpu/effects/GrRRectEffect.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 2014 Google Inc. 2 * Copyright 2014 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 "gl/builders/GrGLProgramBuilder.h" 8 #include "gl/builders/GrGLProgramBuilder.h"
9 #include "GrOvalEffect.h" 9 #include "GrOvalEffect.h"
10 10 #include "GrInvariantOutput.h"
11 #include "gl/GrGLProcessor.h" 11 #include "gl/GrGLProcessor.h"
12 #include "gl/GrGLSL.h" 12 #include "gl/GrGLSL.h"
13 #include "GrTBackendProcessorFactory.h" 13 #include "GrTBackendProcessorFactory.h"
14 14
15 #include "SkRect.h" 15 #include "SkRect.h"
16 16
17 ////////////////////////////////////////////////////////////////////////////// 17 //////////////////////////////////////////////////////////////////////////////
18 18
19 class GLCircleEffect; 19 class GLCircleEffect;
20 20
(...skipping 11 matching lines...) Expand all
32 32
33 typedef GLCircleEffect GLProcessor; 33 typedef GLCircleEffect GLProcessor;
34 34
35 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE; 35 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE;
36 36
37 private: 37 private:
38 CircleEffect(GrPrimitiveEdgeType, const SkPoint& center, SkScalar radius); 38 CircleEffect(GrPrimitiveEdgeType, const SkPoint& center, SkScalar radius);
39 39
40 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; 40 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
41 41
42 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE; 42 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE RRIDE;
43 43
44 SkPoint fCenter; 44 SkPoint fCenter;
45 SkScalar fRadius; 45 SkScalar fRadius;
46 GrPrimitiveEdgeType fEdgeType; 46 GrPrimitiveEdgeType fEdgeType;
47 47
48 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 48 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
49 49
50 typedef GrFragmentProcessor INHERITED; 50 typedef GrFragmentProcessor INHERITED;
51 }; 51 };
52 52
53 GrFragmentProcessor* CircleEffect::Create(GrPrimitiveEdgeType edgeType, const Sk Point& center, 53 GrFragmentProcessor* CircleEffect::Create(GrPrimitiveEdgeType edgeType, const Sk Point& center,
54 SkScalar radius) { 54 SkScalar radius) {
55 SkASSERT(radius >= 0); 55 SkASSERT(radius >= 0);
56 return SkNEW_ARGS(CircleEffect, (edgeType, center, radius)); 56 return SkNEW_ARGS(CircleEffect, (edgeType, center, radius));
57 } 57 }
58 58
59 void CircleEffect::onComputeInvariantOutput(InvariantOutput* inout) const { 59 void CircleEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
60 inout->mulByUnknownAlpha(); 60 inout->mulByUnknownAlpha();
61 } 61 }
62 62
63 const GrBackendFragmentProcessorFactory& CircleEffect::getFactory() const { 63 const GrBackendFragmentProcessorFactory& CircleEffect::getFactory() const {
64 return GrTBackendFragmentProcessorFactory<CircleEffect>::getInstance(); 64 return GrTBackendFragmentProcessorFactory<CircleEffect>::getInstance();
65 } 65 }
66 66
67 CircleEffect::CircleEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkSca lar r) 67 CircleEffect::CircleEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkSca lar r)
68 : fCenter(c) 68 : fCenter(c)
69 , fRadius(r) 69 , fRadius(r)
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 204
205 typedef GLEllipseEffect GLProcessor; 205 typedef GLEllipseEffect GLProcessor;
206 206
207 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE; 207 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE;
208 208
209 private: 209 private:
210 EllipseEffect(GrPrimitiveEdgeType, const SkPoint& center, SkScalar rx, SkSca lar ry); 210 EllipseEffect(GrPrimitiveEdgeType, const SkPoint& center, SkScalar rx, SkSca lar ry);
211 211
212 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; 212 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
213 213
214 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE; 214 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE RRIDE;
215 215
216 SkPoint fCenter; 216 SkPoint fCenter;
217 SkVector fRadii; 217 SkVector fRadii;
218 GrPrimitiveEdgeType fEdgeType; 218 GrPrimitiveEdgeType fEdgeType;
219 219
220 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 220 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
221 221
222 typedef GrFragmentProcessor INHERITED; 222 typedef GrFragmentProcessor INHERITED;
223 }; 223 };
224 224
225 GrFragmentProcessor* EllipseEffect::Create(GrPrimitiveEdgeType edgeType, 225 GrFragmentProcessor* EllipseEffect::Create(GrPrimitiveEdgeType edgeType,
226 const SkPoint& center, 226 const SkPoint& center,
227 SkScalar rx, 227 SkScalar rx,
228 SkScalar ry) { 228 SkScalar ry) {
229 SkASSERT(rx >= 0 && ry >= 0); 229 SkASSERT(rx >= 0 && ry >= 0);
230 return SkNEW_ARGS(EllipseEffect, (edgeType, center, rx, ry)); 230 return SkNEW_ARGS(EllipseEffect, (edgeType, center, rx, ry));
231 } 231 }
232 232
233 void EllipseEffect::onComputeInvariantOutput(InvariantOutput* inout) const { 233 void EllipseEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
234 inout->mulByUnknownAlpha(); 234 inout->mulByUnknownAlpha();
235 } 235 }
236 236
237 const GrBackendFragmentProcessorFactory& EllipseEffect::getFactory() const { 237 const GrBackendFragmentProcessorFactory& EllipseEffect::getFactory() const {
238 return GrTBackendFragmentProcessorFactory<EllipseEffect>::getInstance(); 238 return GrTBackendFragmentProcessorFactory<EllipseEffect>::getInstance();
239 } 239 }
240 240
241 EllipseEffect::EllipseEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkS calar rx, SkScalar ry) 241 EllipseEffect::EllipseEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkS calar rx, SkScalar ry)
242 : fCenter(c) 242 : fCenter(c)
243 , fRadii(SkVector::Make(rx, ry)) 243 , fRadii(SkVector::Make(rx, ry))
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 w /= 2; 381 w /= 2;
382 return CircleEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval .fTop + w), w); 382 return CircleEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval .fTop + w), w);
383 } else { 383 } else {
384 w /= 2; 384 w /= 2;
385 h /= 2; 385 h /= 2;
386 return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, ova l.fTop + h), w, h); 386 return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, ova l.fTop + h), w, h);
387 } 387 }
388 388
389 return NULL; 389 return NULL;
390 } 390 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrMatrixConvolutionEffect.h ('k') | src/gpu/effects/GrRRectEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698