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

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

Issue 794843002: Revert of Remove GP from drawstate, revision of invariant output for GP (Closed) Base URL: https://skia.googlesource.com/skia.git@color-to-gp
Patch Set: Created 6 years 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/GrBitmapTextGeoProc.cpp ('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 "GrConvexPolyEffect.h" 8 #include "GrConvexPolyEffect.h"
9 #include "GrInvariantOutput.h" 9 #include "GrInvariantOutput.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
(...skipping 26 matching lines...) Expand all
37 } 37 }
38 38
39 virtual bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE { 39 virtual bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE {
40 const AARectEffect& aare = other.cast<AARectEffect>(); 40 const AARectEffect& aare = other.cast<AARectEffect>();
41 return fRect == aare.fRect; 41 return fRect == aare.fRect;
42 } 42 }
43 43
44 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE RRIDE { 44 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE RRIDE {
45 if (fRect.isEmpty()) { 45 if (fRect.isEmpty()) {
46 // An empty rect will have no coverage anywhere. 46 // An empty rect will have no coverage anywhere.
47 inout->mulByKnownSingleComponent(0); 47 inout->mulByKnownAlpha(0);
48 } else { 48 } else {
49 inout->mulByUnknownSingleComponent(); 49 inout->mulByUnknownAlpha();
50 } 50 }
51 } 51 }
52 52
53 SkRect fRect; 53 SkRect fRect;
54 GrPrimitiveEdgeType fEdgeType; 54 GrPrimitiveEdgeType fEdgeType;
55 55
56 typedef GrFragmentProcessor INHERITED; 56 typedef GrFragmentProcessor INHERITED;
57 57
58 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 58 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
59 59
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 GrFragmentProcessor* GrConvexPolyEffect::Create(GrPrimitiveEdgeType edgeType, co nst SkRect& rect) { 316 GrFragmentProcessor* GrConvexPolyEffect::Create(GrPrimitiveEdgeType edgeType, co nst SkRect& rect) {
317 if (kHairlineAA_GrProcessorEdgeType == edgeType){ 317 if (kHairlineAA_GrProcessorEdgeType == edgeType){
318 return NULL; 318 return NULL;
319 } 319 }
320 return AARectEffect::Create(edgeType, rect); 320 return AARectEffect::Create(edgeType, rect);
321 } 321 }
322 322
323 GrConvexPolyEffect::~GrConvexPolyEffect() {} 323 GrConvexPolyEffect::~GrConvexPolyEffect() {}
324 324
325 void GrConvexPolyEffect::onComputeInvariantOutput(GrInvariantOutput* inout) cons t { 325 void GrConvexPolyEffect::onComputeInvariantOutput(GrInvariantOutput* inout) cons t {
326 inout->mulByUnknownSingleComponent(); 326 inout->mulByUnknownAlpha();
327 } 327 }
328 328
329 void GrConvexPolyEffect::getGLProcessorKey(const GrGLCaps& caps, 329 void GrConvexPolyEffect::getGLProcessorKey(const GrGLCaps& caps,
330 GrProcessorKeyBuilder* b) const { 330 GrProcessorKeyBuilder* b) const {
331 GrGLConvexPolyEffect::GenKey(*this, caps, b); 331 GrGLConvexPolyEffect::GenKey(*this, caps, b);
332 } 332 }
333 333
334 GrGLFragmentProcessor* GrConvexPolyEffect::createGLInstance() const { 334 GrGLFragmentProcessor* GrConvexPolyEffect::createGLInstance() const {
335 return SkNEW_ARGS(GrGLConvexPolyEffect, (*this)); 335 return SkNEW_ARGS(GrGLConvexPolyEffect, (*this));
336 } 336 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 } 372 }
373 373
374 GrFragmentProcessor* fp; 374 GrFragmentProcessor* fp;
375 do { 375 do {
376 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( 376 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
377 random->nextULessThan(kGrProcessorEdgeTy peCnt)); 377 random->nextULessThan(kGrProcessorEdgeTy peCnt));
378 fp = GrConvexPolyEffect::Create(edgeType, count, edges); 378 fp = GrConvexPolyEffect::Create(edgeType, count, edges);
379 } while (NULL == fp); 379 } while (NULL == fp);
380 return fp; 380 return fp;
381 } 381 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrBitmapTextGeoProc.cpp ('k') | src/gpu/effects/GrConvolutionEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698