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

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

Issue 23653059: Mark when effects and programs have vertex code (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrEffect.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 2012 Google Inc. 2 * Copyright 2012 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 "GrAARectRenderer.h" 8 #include "GrAARectRenderer.h"
9 #include "GrGpu.h" 9 #include "GrGpu.h"
10 #include "gl/GrGLEffect.h" 10 #include "gl/GrGLEffect.h"
11 #include "GrTBackendEffectFactory.h" 11 #include "GrTBackendEffectFactory.h"
12 #include "SkColorPriv.h" 12 #include "SkColorPriv.h"
13 #include "effects/GrVertexEffect.h"
13 14
14 SK_DEFINE_INST_COUNT(GrAARectRenderer) 15 SK_DEFINE_INST_COUNT(GrAARectRenderer)
15 16
16 /////////////////////////////////////////////////////////////////////////////// 17 ///////////////////////////////////////////////////////////////////////////////
17 class GrGLAlignedRectEffect; 18 class GrGLAlignedRectEffect;
18 19
19 // Axis Aligned special case 20 // Axis Aligned special case
20 class GrAlignedRectEffect : public GrEffect { 21 class GrAlignedRectEffect : public GrVertexEffect {
21 public: 22 public:
22 static GrEffectRef* Create() { 23 static GrEffectRef* Create() {
23 GR_CREATE_STATIC_EFFECT(gAlignedRectEffect, GrAlignedRectEffect, ()); 24 GR_CREATE_STATIC_EFFECT(gAlignedRectEffect, GrAlignedRectEffect, ());
24 gAlignedRectEffect->ref(); 25 gAlignedRectEffect->ref();
25 return gAlignedRectEffect; 26 return gAlignedRectEffect;
26 } 27 }
27 28
28 virtual ~GrAlignedRectEffect() {} 29 virtual ~GrAlignedRectEffect() {}
29 30
30 static const char* Name() { return "AlignedRectEdge"; } 31 static const char* Name() { return "AlignedRectEdge"; }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 95 }
95 96
96 virtual void setData(const GrGLUniformManager& uman, const GrDrawEffect& ) SK_OVERRIDE {} 97 virtual void setData(const GrGLUniformManager& uman, const GrDrawEffect& ) SK_OVERRIDE {}
97 98
98 private: 99 private:
99 typedef GrGLEffect INHERITED; 100 typedef GrGLEffect INHERITED;
100 }; 101 };
101 102
102 103
103 private: 104 private:
104 GrAlignedRectEffect() : GrEffect() { 105 GrAlignedRectEffect() : GrVertexEffect() {
105 this->addVertexAttrib(kVec4f_GrSLType); 106 this->addVertexAttrib(kVec4f_GrSLType);
106 } 107 }
107 108
108 virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE { return true; } 109 virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE { return true; }
109 110
110 GR_DECLARE_EFFECT_TEST; 111 GR_DECLARE_EFFECT_TEST;
111 112
112 typedef GrEffect INHERITED; 113 typedef GrVertexEffect INHERITED;
113 }; 114 };
114 115
115 116
116 GR_DEFINE_EFFECT_TEST(GrAlignedRectEffect); 117 GR_DEFINE_EFFECT_TEST(GrAlignedRectEffect);
117 118
118 GrEffectRef* GrAlignedRectEffect::TestCreate(SkRandom* random, 119 GrEffectRef* GrAlignedRectEffect::TestCreate(SkRandom* random,
119 GrContext* context, 120 GrContext* context,
120 const GrDrawTargetCaps&, 121 const GrDrawTargetCaps&,
121 GrTexture* textures[]) { 122 GrTexture* textures[]) {
122 return GrAlignedRectEffect::Create(); 123 return GrAlignedRectEffect::Create();
123 } 124 }
124 125
125 /////////////////////////////////////////////////////////////////////////////// 126 ///////////////////////////////////////////////////////////////////////////////
126 class GrGLRectEffect; 127 class GrGLRectEffect;
127 128
128 /** 129 /**
129 * The output of this effect is a modulation of the input color and coverage 130 * The output of this effect is a modulation of the input color and coverage
130 * for an arbitrarily oriented rect. The rect is specified as: 131 * for an arbitrarily oriented rect. The rect is specified as:
131 * Center of the rect 132 * Center of the rect
132 * Unit vector point down the height of the rect 133 * Unit vector point down the height of the rect
133 * Half width + 0.5 134 * Half width + 0.5
134 * Half height + 0.5 135 * Half height + 0.5
135 * The center and vector are stored in a vec4 varying ("RectEdge") with the 136 * The center and vector are stored in a vec4 varying ("RectEdge") with the
136 * center in the xy components and the vector in the zw components. 137 * center in the xy components and the vector in the zw components.
137 * The munged width and height are stored in a vec2 varying ("WidthHeight") 138 * The munged width and height are stored in a vec2 varying ("WidthHeight")
138 * with the width in x and the height in y. 139 * with the width in x and the height in y.
139 */ 140 */
140 class GrRectEffect : public GrEffect { 141 class GrRectEffect : public GrVertexEffect {
141 public: 142 public:
142 static GrEffectRef* Create() { 143 static GrEffectRef* Create() {
143 GR_CREATE_STATIC_EFFECT(gRectEffect, GrRectEffect, ()); 144 GR_CREATE_STATIC_EFFECT(gRectEffect, GrRectEffect, ());
144 gRectEffect->ref(); 145 gRectEffect->ref();
145 return gRectEffect; 146 return gRectEffect;
146 } 147 }
147 148
148 virtual ~GrRectEffect() {} 149 virtual ~GrRectEffect() {}
149 150
150 static const char* Name() { return "RectEdge"; } 151 static const char* Name() { return "RectEdge"; }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 } 230 }
230 231
231 virtual void setData(const GrGLUniformManager& uman, const GrDrawEffect& ) SK_OVERRIDE {} 232 virtual void setData(const GrGLUniformManager& uman, const GrDrawEffect& ) SK_OVERRIDE {}
232 233
233 private: 234 private:
234 typedef GrGLEffect INHERITED; 235 typedef GrGLEffect INHERITED;
235 }; 236 };
236 237
237 238
238 private: 239 private:
239 GrRectEffect() : GrEffect() { 240 GrRectEffect() : GrVertexEffect() {
240 this->addVertexAttrib(kVec4f_GrSLType); 241 this->addVertexAttrib(kVec4f_GrSLType);
241 this->addVertexAttrib(kVec2f_GrSLType); 242 this->addVertexAttrib(kVec2f_GrSLType);
242 this->setWillReadFragmentPosition(); 243 this->setWillReadFragmentPosition();
243 } 244 }
244 245
245 virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE { return true; } 246 virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE { return true; }
246 247
247 GR_DECLARE_EFFECT_TEST; 248 GR_DECLARE_EFFECT_TEST;
248 249
249 typedef GrEffect INHERITED; 250 typedef GrVertexEffect INHERITED;
250 }; 251 };
251 252
252 253
253 GR_DEFINE_EFFECT_TEST(GrRectEffect); 254 GR_DEFINE_EFFECT_TEST(GrRectEffect);
254 255
255 GrEffectRef* GrRectEffect::TestCreate(SkRandom* random, 256 GrEffectRef* GrRectEffect::TestCreate(SkRandom* random,
256 GrContext* context, 257 GrContext* context,
257 const GrDrawTargetCaps&, 258 const GrDrawTargetCaps&,
258 GrTexture* textures[]) { 259 GrTexture* textures[]) {
259 return GrRectEffect::Create(); 260 return GrRectEffect::Create();
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 // can't call mapRect for devInside since it calls sort 809 // can't call mapRect for devInside since it calls sort
809 combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2) ; 810 combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2) ;
810 811
811 if (devInside.isEmpty()) { 812 if (devInside.isEmpty()) {
812 this->fillAARect(gpu, target, devOutside, SkMatrix::I(), devOutside, use VertexCoverage); 813 this->fillAARect(gpu, target, devOutside, SkMatrix::I(), devOutside, use VertexCoverage);
813 return; 814 return;
814 } 815 }
815 816
816 this->geometryStrokeAARect(gpu, target, devOutside, devInside, useVertexCove rage); 817 this->geometryStrokeAARect(gpu, target, devOutside, devInside, useVertexCove rage);
817 } 818 }
OLDNEW
« no previous file with comments | « src/gpu/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698