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

Side by Side Diff: src/gpu/effects/GrConvexPolyEffect.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/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 #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 "SkPath.h" 15 #include "SkPath.h"
16 16
17 ////////////////////////////////////////////////////////////////////////////// 17 //////////////////////////////////////////////////////////////////////////////
18 class GLAARectEffect; 18 class GLAARectEffect;
19 19
20 class AARectEffect : public GrFragmentProcessor { 20 class AARectEffect : public GrFragmentProcessor {
(...skipping 15 matching lines...) Expand all
36 private: 36 private:
37 AARectEffect(GrPrimitiveEdgeType edgeType, const SkRect& rect) : fRect(rect) , fEdgeType(edgeType) { 37 AARectEffect(GrPrimitiveEdgeType edgeType, const SkRect& rect) : fRect(rect) , fEdgeType(edgeType) {
38 this->setWillReadFragmentPosition(); 38 this->setWillReadFragmentPosition();
39 } 39 }
40 40
41 virtual bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE { 41 virtual bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE {
42 const AARectEffect& aare = other.cast<AARectEffect>(); 42 const AARectEffect& aare = other.cast<AARectEffect>();
43 return fRect == aare.fRect; 43 return fRect == aare.fRect;
44 } 44 }
45 45
46 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE { 46 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE RRIDE {
47 if (fRect.isEmpty()) { 47 if (fRect.isEmpty()) {
48 // An empty rect will have no coverage anywhere. 48 // An empty rect will have no coverage anywhere.
49 inout->mulByKnownAlpha(0); 49 inout->mulByKnownAlpha(0);
50 } else { 50 } else {
51 inout->mulByUnknownAlpha(); 51 inout->mulByUnknownAlpha();
52 } 52 }
53 } 53 }
54 54
55 SkRect fRect; 55 SkRect fRect;
56 GrPrimitiveEdgeType fEdgeType; 56 GrPrimitiveEdgeType fEdgeType;
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 319
320 GrFragmentProcessor* GrConvexPolyEffect::Create(GrPrimitiveEdgeType edgeType, co nst SkRect& rect) { 320 GrFragmentProcessor* GrConvexPolyEffect::Create(GrPrimitiveEdgeType edgeType, co nst SkRect& rect) {
321 if (kHairlineAA_GrProcessorEdgeType == edgeType){ 321 if (kHairlineAA_GrProcessorEdgeType == edgeType){
322 return NULL; 322 return NULL;
323 } 323 }
324 return AARectEffect::Create(edgeType, rect); 324 return AARectEffect::Create(edgeType, rect);
325 } 325 }
326 326
327 GrConvexPolyEffect::~GrConvexPolyEffect() {} 327 GrConvexPolyEffect::~GrConvexPolyEffect() {}
328 328
329 void GrConvexPolyEffect::onComputeInvariantOutput(InvariantOutput* inout) const { 329 void GrConvexPolyEffect::onComputeInvariantOutput(GrInvariantOutput* inout) cons t {
330 inout->mulByUnknownAlpha(); 330 inout->mulByUnknownAlpha();
331 } 331 }
332 332
333 const GrBackendFragmentProcessorFactory& GrConvexPolyEffect::getFactory() const { 333 const GrBackendFragmentProcessorFactory& GrConvexPolyEffect::getFactory() const {
334 return GrTBackendFragmentProcessorFactory<GrConvexPolyEffect>::getInstance() ; 334 return GrTBackendFragmentProcessorFactory<GrConvexPolyEffect>::getInstance() ;
335 } 335 }
336 336
337 GrConvexPolyEffect::GrConvexPolyEffect(GrPrimitiveEdgeType edgeType, int n, cons t SkScalar edges[]) 337 GrConvexPolyEffect::GrConvexPolyEffect(GrPrimitiveEdgeType edgeType, int n, cons t SkScalar edges[])
338 : fEdgeType(edgeType) 338 : fEdgeType(edgeType)
339 , fEdgeCount(n) { 339 , fEdgeCount(n) {
(...skipping 30 matching lines...) Expand all
370 } 370 }
371 371
372 GrFragmentProcessor* fp; 372 GrFragmentProcessor* fp;
373 do { 373 do {
374 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( 374 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
375 random->nextULessThan(kGrProcessorEdgeTy peCnt)); 375 random->nextULessThan(kGrProcessorEdgeTy peCnt));
376 fp = GrConvexPolyEffect::Create(edgeType, count, edges); 376 fp = GrConvexPolyEffect::Create(edgeType, count, edges);
377 } while (NULL == fp); 377 } while (NULL == fp);
378 return fp; 378 return fp;
379 } 379 }
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