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

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

Issue 1332923003: Remove batchtracker (Closed) Base URL: https://skia.googlesource.com/skia.git@latecreatepathprocessor
Patch Set: tweaks Created 5 years, 3 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/GrPathProcessor.h ('k') | src/gpu/GrPathRendering.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 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 #include "glsl/GrGLSLCaps.h" 13 #include "glsl/GrGLSLCaps.h"
14 14
15 GrPathProcessor::GrPathProcessor(GrColor color, 15 GrPathProcessor::GrPathProcessor(GrColor color,
16 const GrPipelineOptimizations& opts, 16 const GrPipelineOptimizations& opts,
17 const SkMatrix& viewMatrix, 17 const SkMatrix& viewMatrix,
18 const SkMatrix& localMatrix) 18 const SkMatrix& localMatrix)
19 : INHERITED(true) 19 : INHERITED(true)
20 , fColor(color) 20 , fColor(color)
21 , fViewMatrix(viewMatrix) 21 , fViewMatrix(viewMatrix)
22 , fLocalMatrix(localMatrix) 22 , fLocalMatrix(localMatrix)
23 , fOpts(opts) { 23 , fOpts(opts) {
24 this->initClassID<GrPathProcessor>(); 24 this->initClassID<GrPathProcessor>();
25 } 25 }
26 26
27 void GrPathProcessor::getInvariantOutputColor(GrInitInvariantOutput* out) const { 27 void GrPathProcessor::getGLProcessorKey(const GrGLSLCaps& caps,
28 out->setKnownFourComponents(fColor); 28 GrProcessorKeyBuilder* b) const {
29 GrGLPathProcessor::GenKey(*this, caps, b);
29 } 30 }
30 31
31 void GrPathProcessor::getInvariantOutputCoverage(GrInitInvariantOutput* out) con st { 32 GrGLPrimitiveProcessor* GrPathProcessor::createGLInstance(const GrGLSLCaps& caps ) const {
32 out->setKnownSingleComponent(0xff); 33 SkASSERT(caps.pathRenderingSupport());
34 return new GrGLPathProcessor();
33 } 35 }
34
35 void GrPathProcessor::initBatchTracker(GrBatchTracker* bt, const GrPipelineOptim izations& opt) const {
36 PathBatchTracker* local = bt->cast<PathBatchTracker>();
37 if (!opt.readsColor()) {
38 local->fInputColorType = kIgnored_GrGPInput;
39 local->fColor = GrColor_ILLEGAL;
40 } else {
41 local->fInputColorType = kUniform_GrGPInput;
42 if (!opt.getOverrideColorIfSet(&local->fColor)) {
43 local->fColor = this->color();
44 }
45 }
46
47 local->fInputCoverageType = opt.readsCoverage() ? kAllOnes_GrGPInput : kIgno red_GrGPInput;
48 local->fUsesLocalCoords = opt.readsLocalCoords();
49 }
50
51 bool GrPathProcessor::isEqual(const GrBatchTracker& m,
52 const GrPrimitiveProcessor& that,
53 const GrBatchTracker& t) const {
54 if (this->classID() != that.classID() || !this->hasSameTextureAccesses(that) ) {
55 return false;
56 }
57
58 const GrPathProcessor& other = that.cast<GrPathProcessor>();
59 if (!this->viewMatrix().cheapEqualTo(other.viewMatrix())) {
60 return false;
61 }
62
63 const PathBatchTracker& mine = m.cast<PathBatchTracker>();
64 const PathBatchTracker& theirs = t.cast<PathBatchTracker>();
65 if (mine.fColor != theirs.fColor) {
66 return false;
67 }
68
69 if (mine.fUsesLocalCoords != theirs.fUsesLocalCoords) {
70 return false;
71 }
72
73 if (mine.fUsesLocalCoords && !this->localMatrix().cheapEqualTo(other.localMa trix())) {
74 return false;
75 }
76
77 return true;
78 }
79
80 void GrPathProcessor::getGLProcessorKey(const GrBatchTracker& bt,
81 const GrGLSLCaps& caps,
82 GrProcessorKeyBuilder* b) const {
83 GrGLPathProcessor::GenKey(*this, bt, caps, b);
84 }
85
86 GrGLPrimitiveProcessor* GrPathProcessor::createGLInstance(const GrBatchTracker& bt,
87 const GrGLSLCaps& caps ) const {
88 SkASSERT(caps.pathRenderingSupport());
89 return new GrGLPathProcessor(*this, bt);
90 }
OLDNEW
« no previous file with comments | « src/gpu/GrPathProcessor.h ('k') | src/gpu/GrPathRendering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698