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

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

Issue 617853003: Revert of Add isSingleComponent bool to getConstantColorComponent (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/GrConvexPolyEffect.h ('k') | src/gpu/effects/GrConvolutionEffect.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 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 "GrConvexPolyEffect.h" 9 #include "GrConvexPolyEffect.h"
10 10
(...skipping 11 matching lines...) Expand all
22 typedef GLAARectEffect GLProcessor; 22 typedef GLAARectEffect GLProcessor;
23 23
24 const SkRect& getRect() const { return fRect; } 24 const SkRect& getRect() const { return fRect; }
25 25
26 static const char* Name() { return "AARect"; } 26 static const char* Name() { return "AARect"; }
27 27
28 static GrFragmentProcessor* Create(GrPrimitiveEdgeType edgeType, const SkRec t& rect) { 28 static GrFragmentProcessor* Create(GrPrimitiveEdgeType edgeType, const SkRec t& rect) {
29 return SkNEW_ARGS(AARectEffect, (edgeType, rect)); 29 return SkNEW_ARGS(AARectEffect, (edgeType, rect));
30 } 30 }
31 31
32 virtual void getConstantColorComponents(GrColor* color,
33 uint32_t* validFlags) const SK_OVERR IDE {
34 if (fRect.isEmpty()) {
35 // An empty rect will have no coverage anywhere.
36 *color = 0x00000000;
37 *validFlags = kRGBA_GrColorComponentFlags;
38 } else {
39 *validFlags = 0;
40 }
41 }
42
32 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } 43 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
33 44
34 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE; 45 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE;
35 46
36 private: 47 private:
37 AARectEffect(GrPrimitiveEdgeType edgeType, const SkRect& rect) : fRect(rect) , fEdgeType(edgeType) { 48 AARectEffect(GrPrimitiveEdgeType edgeType, const SkRect& rect) : fRect(rect) , fEdgeType(edgeType) {
38 this->setWillReadFragmentPosition(); 49 this->setWillReadFragmentPosition();
39 } 50 }
40 51
41 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE { 52 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE {
42 const AARectEffect& aare = other.cast<AARectEffect>(); 53 const AARectEffect& aare = other.cast<AARectEffect>();
43 return fRect == aare.fRect; 54 return fRect == aare.fRect;
44 } 55 }
45 56
46 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE {
47 if (fRect.isEmpty()) {
48 // An empty rect will have no coverage anywhere.
49 inout->fColor = 0x00000000;
50 inout->fValidFlags = kRGBA_GrColorComponentFlags;
51 } else {
52 inout->fValidFlags = 0;
53 }
54 inout->fIsSingleComponent = false;
55 }
56
57 SkRect fRect; 57 SkRect fRect;
58 GrPrimitiveEdgeType fEdgeType; 58 GrPrimitiveEdgeType fEdgeType;
59 59
60 typedef GrFragmentProcessor INHERITED; 60 typedef GrFragmentProcessor INHERITED;
61 61
62 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 62 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
63 63
64 }; 64 };
65 65
66 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(AARectEffect); 66 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(AARectEffect);
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 321
322 GrFragmentProcessor* GrConvexPolyEffect::Create(GrPrimitiveEdgeType edgeType, co nst SkRect& rect) { 322 GrFragmentProcessor* GrConvexPolyEffect::Create(GrPrimitiveEdgeType edgeType, co nst SkRect& rect) {
323 if (kHairlineAA_GrProcessorEdgeType == edgeType){ 323 if (kHairlineAA_GrProcessorEdgeType == edgeType){
324 return NULL; 324 return NULL;
325 } 325 }
326 return AARectEffect::Create(edgeType, rect); 326 return AARectEffect::Create(edgeType, rect);
327 } 327 }
328 328
329 GrConvexPolyEffect::~GrConvexPolyEffect() {} 329 GrConvexPolyEffect::~GrConvexPolyEffect() {}
330 330
331 void GrConvexPolyEffect::onComputeInvariantOutput(InvariantOutput* inout) const { 331 void GrConvexPolyEffect::getConstantColorComponents(GrColor* color, uint32_t* va lidFlags) const {
332 inout->fValidFlags = 0; 332 *validFlags = 0;
333 inout->fIsSingleComponent = false;
334 } 333 }
335 334
336 const GrBackendFragmentProcessorFactory& GrConvexPolyEffect::getFactory() const { 335 const GrBackendFragmentProcessorFactory& GrConvexPolyEffect::getFactory() const {
337 return GrTBackendFragmentProcessorFactory<GrConvexPolyEffect>::getInstance() ; 336 return GrTBackendFragmentProcessorFactory<GrConvexPolyEffect>::getInstance() ;
338 } 337 }
339 338
340 GrConvexPolyEffect::GrConvexPolyEffect(GrPrimitiveEdgeType edgeType, int n, cons t SkScalar edges[]) 339 GrConvexPolyEffect::GrConvexPolyEffect(GrPrimitiveEdgeType edgeType, int n, cons t SkScalar edges[])
341 : fEdgeType(edgeType) 340 : fEdgeType(edgeType)
342 , fEdgeCount(n) { 341 , fEdgeCount(n) {
343 // Factory function should have already ensured this. 342 // Factory function should have already ensured this.
(...skipping 29 matching lines...) Expand all
373 } 372 }
374 373
375 GrFragmentProcessor* fp; 374 GrFragmentProcessor* fp;
376 do { 375 do {
377 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( 376 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
378 random->nextULessThan(kGrProcessorEdgeTy peCnt)); 377 random->nextULessThan(kGrProcessorEdgeTy peCnt));
379 fp = GrConvexPolyEffect::Create(edgeType, count, edges); 378 fp = GrConvexPolyEffect::Create(edgeType, count, edges);
380 } while (NULL == fp); 379 } while (NULL == fp);
381 return fp; 380 return fp;
382 } 381 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrConvexPolyEffect.h ('k') | src/gpu/effects/GrConvolutionEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698