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

Side by Side Diff: src/gpu/GrPathProcessor.cpp

Issue 1127953003: Remove viewmatrix from GrGeometryProcessor base class (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanup3
Patch Set: Created 5 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 "GrPathProcessor.h" 8 #include "GrPathProcessor.h"
9 9
10 #include "gl/GrGLPathProcessor.h" 10 #include "gl/GrGLPathProcessor.h"
11 #include "gl/GrGLGpu.h" 11 #include "gl/GrGLGpu.h"
12 12
13 GrPathProcessor::GrPathProcessor(GrColor color, 13 GrPathProcessor::GrPathProcessor(GrColor color,
14 const SkMatrix& viewMatrix, 14 const SkMatrix& viewMatrix,
15 const SkMatrix& localMatrix) 15 const SkMatrix& localMatrix)
16 : INHERITED(viewMatrix, localMatrix, true) 16 : INHERITED(localMatrix, true)
17 , fViewMatrix(viewMatrix)
17 , fColor(color) { 18 , fColor(color) {
18 this->initClassID<GrPathProcessor>(); 19 this->initClassID<GrPathProcessor>();
19 } 20 }
20 21
21 void GrPathProcessor::getInvariantOutputColor(GrInitInvariantOutput* out) const { 22 void GrPathProcessor::getInvariantOutputColor(GrInitInvariantOutput* out) const {
22 out->setKnownFourComponents(fColor); 23 out->setKnownFourComponents(fColor);
23 } 24 }
24 25
25 void GrPathProcessor::getInvariantOutputCoverage(GrInitInvariantOutput* out) con st { 26 void GrPathProcessor::getInvariantOutputCoverage(GrInitInvariantOutput* out) con st {
26 out->setKnownSingleComponent(0xff); 27 out->setKnownSingleComponent(0xff);
(...skipping 14 matching lines...) Expand all
41 local->fUsesLocalCoords = init.fUsesLocalCoords; 42 local->fUsesLocalCoords = init.fUsesLocalCoords;
42 } 43 }
43 44
44 bool GrPathProcessor::canMakeEqual(const GrBatchTracker& m, 45 bool GrPathProcessor::canMakeEqual(const GrBatchTracker& m,
45 const GrPrimitiveProcessor& that, 46 const GrPrimitiveProcessor& that,
46 const GrBatchTracker& t) const { 47 const GrBatchTracker& t) const {
47 if (this->classID() != that.classID() || !this->hasSameTextureAccesses(that) ) { 48 if (this->classID() != that.classID() || !this->hasSameTextureAccesses(that) ) {
48 return false; 49 return false;
49 } 50 }
50 51
51 if (!this->viewMatrix().cheapEqualTo(that.viewMatrix())) { 52 const GrPathProcessor& other = that.cast<GrPathProcessor>();
53 if (!this->viewMatrix().cheapEqualTo(other.viewMatrix())) {
52 return false; 54 return false;
53 } 55 }
54 56
55 const PathBatchTracker& mine = m.cast<PathBatchTracker>(); 57 const PathBatchTracker& mine = m.cast<PathBatchTracker>();
56 const PathBatchTracker& theirs = t.cast<PathBatchTracker>(); 58 const PathBatchTracker& theirs = t.cast<PathBatchTracker>();
57 return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords, 59 return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords,
58 that, theirs.fUsesLocalCoords) && 60 that, theirs.fUsesLocalCoords) &&
59 CanCombineOutput(mine.fInputColorType, mine.fColor, 61 CanCombineOutput(mine.fInputColorType, mine.fColor,
60 theirs.fInputColorType, theirs.fColor) && 62 theirs.fInputColorType, theirs.fColor) &&
61 CanCombineOutput(mine.fInputCoverageType, 0xff, 63 CanCombineOutput(mine.fInputCoverageType, 0xff,
62 theirs.fInputCoverageType, 0xff); 64 theirs.fInputCoverageType, 0xff);
63 } 65 }
64 66
65 void GrPathProcessor::getGLProcessorKey(const GrBatchTracker& bt, 67 void GrPathProcessor::getGLProcessorKey(const GrBatchTracker& bt,
66 const GrGLSLCaps& caps, 68 const GrGLSLCaps& caps,
67 GrProcessorKeyBuilder* b) const { 69 GrProcessorKeyBuilder* b) const {
68 GrGLPathProcessor::GenKey(*this, bt, caps, b); 70 GrGLPathProcessor::GenKey(*this, bt, caps, b);
69 } 71 }
70 72
71 GrGLPrimitiveProcessor* GrPathProcessor::createGLInstance(const GrBatchTracker& bt, 73 GrGLPrimitiveProcessor* GrPathProcessor::createGLInstance(const GrBatchTracker& bt,
72 const GrGLSLCaps& caps ) const { 74 const GrGLSLCaps& caps ) const {
73 SkASSERT(caps.pathRenderingSupport()); 75 SkASSERT(caps.pathRenderingSupport());
74 return SkNEW_ARGS(GrGLPathProcessor, (*this, bt)); 76 return SkNEW_ARGS(GrGLPathProcessor, (*this, bt));
75 } 77 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698