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

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

Issue 643743003: Create helper functions to use in computeInvariantOutput calls (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update blurMaskFilter Created 6 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 | « src/gpu/effects/GrMatrixConvolutionEffect.cpp ('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
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(InvariantOutput* inout) const {
60 inout->fValidFlags = 0; 60 inout->mulByUnknownAlpha();
61 inout->fIsSingleComponent = false;
62 } 61 }
63 62
64 const GrBackendFragmentProcessorFactory& CircleEffect::getFactory() const { 63 const GrBackendFragmentProcessorFactory& CircleEffect::getFactory() const {
65 return GrTBackendFragmentProcessorFactory<CircleEffect>::getInstance(); 64 return GrTBackendFragmentProcessorFactory<CircleEffect>::getInstance();
66 } 65 }
67 66
68 CircleEffect::CircleEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkSca lar r) 67 CircleEffect::CircleEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkSca lar r)
69 : fCenter(c) 68 : fCenter(c)
70 , fRadius(r) 69 , fRadius(r)
71 , fEdgeType(edgeType) { 70 , fEdgeType(edgeType) {
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 224
226 GrFragmentProcessor* EllipseEffect::Create(GrPrimitiveEdgeType edgeType, 225 GrFragmentProcessor* EllipseEffect::Create(GrPrimitiveEdgeType edgeType,
227 const SkPoint& center, 226 const SkPoint& center,
228 SkScalar rx, 227 SkScalar rx,
229 SkScalar ry) { 228 SkScalar ry) {
230 SkASSERT(rx >= 0 && ry >= 0); 229 SkASSERT(rx >= 0 && ry >= 0);
231 return SkNEW_ARGS(EllipseEffect, (edgeType, center, rx, ry)); 230 return SkNEW_ARGS(EllipseEffect, (edgeType, center, rx, ry));
232 } 231 }
233 232
234 void EllipseEffect::onComputeInvariantOutput(InvariantOutput* inout) const { 233 void EllipseEffect::onComputeInvariantOutput(InvariantOutput* inout) const {
235 inout->fValidFlags = 0; 234 inout->mulByUnknownAlpha();
236 inout->fIsSingleComponent = false;
237 } 235 }
238 236
239 const GrBackendFragmentProcessorFactory& EllipseEffect::getFactory() const { 237 const GrBackendFragmentProcessorFactory& EllipseEffect::getFactory() const {
240 return GrTBackendFragmentProcessorFactory<EllipseEffect>::getInstance(); 238 return GrTBackendFragmentProcessorFactory<EllipseEffect>::getInstance();
241 } 239 }
242 240
243 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)
244 : fCenter(c) 242 : fCenter(c)
245 , fRadii(SkVector::Make(rx, ry)) 243 , fRadii(SkVector::Make(rx, ry))
246 , fEdgeType(edgeType) { 244 , fEdgeType(edgeType) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 w /= 2; 381 w /= 2;
384 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);
385 } else { 383 } else {
386 w /= 2; 384 w /= 2;
387 h /= 2; 385 h /= 2;
388 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);
389 } 387 }
390 388
391 return NULL; 389 return NULL;
392 } 390 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrMatrixConvolutionEffect.cpp ('k') | src/gpu/effects/GrRRectEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698