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

Side by Side Diff: src/gpu/gl/GrGLGeometryProcessor.h

Issue 1272703002: AARectBatch can transform coords on cpu (Closed) Base URL: https://skia.googlesource.com/skia.git@lccleanup5
Patch Set: Created 5 years, 4 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/GrBatch.h ('k') | src/gpu/gl/GrGLGeometryProcessor.cpp » ('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 #ifndef GrGLGeometryProcessor_DEFINED 8 #ifndef GrGLGeometryProcessor_DEFINED
9 #define GrGLGeometryProcessor_DEFINED 9 #define GrGLGeometryProcessor_DEFINED
10 10
11 #include "GrGLPrimitiveProcessor.h" 11 #include "GrGLPrimitiveProcessor.h"
12 12
13 class GrGLGPBuilder; 13 class GrGLGPBuilder;
14 14
15 /** 15 /**
16 * If a GL effect needs a GrGLFullShaderBuilder* object to emit vertex code, the n it must inherit 16 * If a GL effect needs a GrGLFullShaderBuilder* object to emit vertex code, the n it must inherit
17 * from this class. Since paths don't have vertices, this class is only meant to be used internally 17 * from this class. Since paths don't have vertices, this class is only meant to be used internally
18 * by skia, for special cases. 18 * by skia, for special cases.
19 */ 19 */
20 class GrGLGeometryProcessor : public GrGLPrimitiveProcessor { 20 class GrGLGeometryProcessor : public GrGLPrimitiveProcessor {
21 public: 21 public:
22 GrGLGeometryProcessor() : fTransformedLocalCoords(false) {}
23
22 /* Any general emit code goes in the base class emitCode. Subclasses overri de onEmitCode */ 24 /* Any general emit code goes in the base class emitCode. Subclasses overri de onEmitCode */
23 void emitCode(EmitArgs&) override; 25 void emitCode(EmitArgs&) override;
24 26
25 // By default we use the identity matrix 27 // By default we use the identity matrix
26 virtual void setTransformData(const GrPrimitiveProcessor&, 28 virtual void setTransformData(const GrPrimitiveProcessor&,
27 const GrGLProgramDataManager& pdman, 29 const GrGLProgramDataManager& pdman,
28 int index, 30 int index,
29 const SkTArray<const GrCoordTransform*, true>& transforms) { 31 const SkTArray<const GrCoordTransform*, true>& transforms) {
30 this->setTransformDataMatrix(SkMatrix::I(), pdman, index, transforms); 32 this->setTransformDataMatrix(SkMatrix::I(), pdman, index, transforms);
31 } 33 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } else { 85 } else {
84 return 0x02; 86 return 0x02;
85 } 87 }
86 } 88 }
87 89
88 private: 90 private:
89 void setTransformDataMatrix(const SkMatrix& localMatrix, 91 void setTransformDataMatrix(const SkMatrix& localMatrix,
90 const GrGLProgramDataManager& pdman, 92 const GrGLProgramDataManager& pdman,
91 int index, 93 int index,
92 const SkTArray<const GrCoordTransform*, true>& t ransforms) { 94 const SkTArray<const GrCoordTransform*, true>& t ransforms) {
95 // No need to set if our local coords have already been transformed
96 if (fTransformedLocalCoords) {
97 return;
98 }
99
93 SkSTArray<2, Transform, true>& procTransforms = fInstalledTransforms[ind ex]; 100 SkSTArray<2, Transform, true>& procTransforms = fInstalledTransforms[ind ex];
94 int numTransforms = transforms.count(); 101 int numTransforms = transforms.count();
95 for (int t = 0; t < numTransforms; ++t) { 102 for (int t = 0; t < numTransforms; ++t) {
96 SkASSERT(procTransforms[t].fHandle.isValid()); 103 SkASSERT(procTransforms[t].fHandle.isValid());
97 const SkMatrix& transform = GetTransformMatrix(localMatrix, *transfo rms[t]); 104 const SkMatrix& transform = GetTransformMatrix(localMatrix, *transfo rms[t]);
98 if (!procTransforms[t].fCurrentValue.cheapEqualTo(transform)) { 105 if (!procTransforms[t].fCurrentValue.cheapEqualTo(transform)) {
99 pdman.setSkMatrix(procTransforms[t].fHandle.convertToUniformHand le(), transform); 106 pdman.setSkMatrix(procTransforms[t].fHandle.convertToUniformHand le(), transform);
100 procTransforms[t].fCurrentValue = transform; 107 procTransforms[t].fCurrentValue = transform;
101 } 108 }
102 } 109 }
103 } 110 }
104 111
105 virtual void onEmitCode(EmitArgs&, GrGPArgs*) = 0; 112 virtual void onEmitCode(EmitArgs&, GrGPArgs*) = 0;
106 113
114 bool fTransformedLocalCoords;
107 typedef GrGLPrimitiveProcessor INHERITED; 115 typedef GrGLPrimitiveProcessor INHERITED;
108 }; 116 };
109 117
110 #endif 118 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrBatch.h ('k') | src/gpu/gl/GrGLGeometryProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698