| OLD | NEW |
| 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 "GrOvalRenderer.h" | 8 #include "GrOvalRenderer.h" |
| 9 | 9 |
| 10 #include "GrEffect.h" | 10 #include "GrEffect.h" |
| 11 #include "gl/GrGLEffect.h" | 11 #include "gl/GrGLEffect.h" |
| 12 #include "gl/GrGLSL.h" | 12 #include "gl/GrGLSL.h" |
| 13 #include "gl/GrGLVertexEffect.h" |
| 13 #include "GrTBackendEffectFactory.h" | 14 #include "GrTBackendEffectFactory.h" |
| 14 | 15 |
| 15 #include "GrDrawState.h" | 16 #include "GrDrawState.h" |
| 16 #include "GrDrawTarget.h" | 17 #include "GrDrawTarget.h" |
| 17 #include "GrGpu.h" | 18 #include "GrGpu.h" |
| 18 | 19 |
| 19 #include "SkRRect.h" | 20 #include "SkRRect.h" |
| 20 #include "SkStrokeRec.h" | 21 #include "SkStrokeRec.h" |
| 21 | 22 |
| 22 #include "effects/GrVertexEffect.h" | 23 #include "effects/GrVertexEffect.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE { | 82 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE { |
| 82 return GrTBackendEffectFactory<CircleEdgeEffect>::getInstance(); | 83 return GrTBackendEffectFactory<CircleEdgeEffect>::getInstance(); |
| 83 } | 84 } |
| 84 | 85 |
| 85 virtual ~CircleEdgeEffect() {} | 86 virtual ~CircleEdgeEffect() {} |
| 86 | 87 |
| 87 static const char* Name() { return "CircleEdge"; } | 88 static const char* Name() { return "CircleEdge"; } |
| 88 | 89 |
| 89 inline bool isStroked() const { return fStroke; } | 90 inline bool isStroked() const { return fStroke; } |
| 90 | 91 |
| 91 class GLEffect : public GrGLEffect { | 92 class GLEffect : public GrGLVertexEffect { |
| 92 public: | 93 public: |
| 93 GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) | 94 GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) |
| 94 : INHERITED (factory) {} | 95 : INHERITED (factory) {} |
| 95 | 96 |
| 96 virtual void emitCode(GrGLShaderBuilder* builder, | 97 virtual void emitCode(GrGLFullShaderBuilder* builder, |
| 97 const GrDrawEffect& drawEffect, | 98 const GrDrawEffect& drawEffect, |
| 98 EffectKey key, | 99 EffectKey key, |
| 99 const char* outputColor, | 100 const char* outputColor, |
| 100 const char* inputColor, | 101 const char* inputColor, |
| 101 const TransformedCoordsArray&, | 102 const TransformedCoordsArray&, |
| 102 const TextureSamplerArray& samplers) SK_OVERRIDE { | 103 const TextureSamplerArray& samplers) SK_OVERRIDE { |
| 103 GrGLShaderBuilder::VertexBuilder* vertexBuilder = builder->getVertex
Builder(); | |
| 104 SkASSERT(NULL != vertexBuilder); | |
| 105 | |
| 106 const CircleEdgeEffect& circleEffect = drawEffect.castEffect<CircleE
dgeEffect>(); | 104 const CircleEdgeEffect& circleEffect = drawEffect.castEffect<CircleE
dgeEffect>(); |
| 107 const char *vsName, *fsName; | 105 const char *vsName, *fsName; |
| 108 vertexBuilder->addVarying(kVec4f_GrSLType, "CircleEdge", &vsName, &f
sName); | 106 builder->addVarying(kVec4f_GrSLType, "CircleEdge", &vsName, &fsName)
; |
| 109 | 107 |
| 110 const SkString* attrName = | 108 const SkString* attrName = |
| 111 vertexBuilder->getEffectAttributeName(drawEffect.getVertexAttrib
Indices()[0]); | 109 builder->getEffectAttributeName(drawEffect.getVertexAttribIndice
s()[0]); |
| 112 vertexBuilder->vsCodeAppendf("\t%s = %s;\n", vsName, attrName->c_str
()); | 110 builder->vsCodeAppendf("\t%s = %s;\n", vsName, attrName->c_str()); |
| 113 | 111 |
| 114 builder->fsCodeAppendf("\tfloat d = length(%s.xy);\n", fsName); | 112 builder->fsCodeAppendf("\tfloat d = length(%s.xy);\n", fsName); |
| 115 builder->fsCodeAppendf("\tfloat edgeAlpha = clamp(%s.z - d, 0.0, 1.0
);\n", fsName); | 113 builder->fsCodeAppendf("\tfloat edgeAlpha = clamp(%s.z - d, 0.0, 1.0
);\n", fsName); |
| 116 if (circleEffect.isStroked()) { | 114 if (circleEffect.isStroked()) { |
| 117 builder->fsCodeAppendf("\tfloat innerAlpha = clamp(d - %s.w, 0.0
, 1.0);\n", fsName); | 115 builder->fsCodeAppendf("\tfloat innerAlpha = clamp(d - %s.w, 0.0
, 1.0);\n", fsName); |
| 118 builder->fsCodeAppend("\tedgeAlpha *= innerAlpha;\n"); | 116 builder->fsCodeAppend("\tedgeAlpha *= innerAlpha;\n"); |
| 119 } | 117 } |
| 120 | 118 |
| 121 SkString modulate; | 119 SkString modulate; |
| 122 GrGLSLModulatef<4>(&modulate, inputColor, "edgeAlpha"); | 120 GrGLSLModulatef<4>(&modulate, inputColor, "edgeAlpha"); |
| 123 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, modulate.c_str()
); | 121 builder->fsCodeAppendf("\t%s = %s;\n", outputColor, modulate.c_str()
); |
| 124 } | 122 } |
| 125 | 123 |
| 126 static inline EffectKey GenKey(const GrDrawEffect& drawEffect, const GrG
LCaps&) { | 124 static inline EffectKey GenKey(const GrDrawEffect& drawEffect, const GrG
LCaps&) { |
| 127 const CircleEdgeEffect& circleEffect = drawEffect.castEffect<CircleE
dgeEffect>(); | 125 const CircleEdgeEffect& circleEffect = drawEffect.castEffect<CircleE
dgeEffect>(); |
| 128 | 126 |
| 129 return circleEffect.isStroked() ? 0x1 : 0x0; | 127 return circleEffect.isStroked() ? 0x1 : 0x0; |
| 130 } | 128 } |
| 131 | 129 |
| 132 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_
OVERRIDE {} | 130 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_
OVERRIDE {} |
| 133 | 131 |
| 134 private: | 132 private: |
| 135 typedef GrGLEffect INHERITED; | 133 typedef GrGLVertexEffect INHERITED; |
| 136 }; | 134 }; |
| 137 | 135 |
| 138 | 136 |
| 139 private: | 137 private: |
| 140 CircleEdgeEffect(bool stroke) : GrVertexEffect() { | 138 CircleEdgeEffect(bool stroke) : GrVertexEffect() { |
| 141 this->addVertexAttrib(kVec4f_GrSLType); | 139 this->addVertexAttrib(kVec4f_GrSLType); |
| 142 fStroke = stroke; | 140 fStroke = stroke; |
| 143 } | 141 } |
| 144 | 142 |
| 145 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE { | 143 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE { | 194 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE { |
| 197 return GrTBackendEffectFactory<EllipseEdgeEffect>::getInstance(); | 195 return GrTBackendEffectFactory<EllipseEdgeEffect>::getInstance(); |
| 198 } | 196 } |
| 199 | 197 |
| 200 virtual ~EllipseEdgeEffect() {} | 198 virtual ~EllipseEdgeEffect() {} |
| 201 | 199 |
| 202 static const char* Name() { return "EllipseEdge"; } | 200 static const char* Name() { return "EllipseEdge"; } |
| 203 | 201 |
| 204 inline bool isStroked() const { return fStroke; } | 202 inline bool isStroked() const { return fStroke; } |
| 205 | 203 |
| 206 class GLEffect : public GrGLEffect { | 204 class GLEffect : public GrGLVertexEffect { |
| 207 public: | 205 public: |
| 208 GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) | 206 GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) |
| 209 : INHERITED (factory) {} | 207 : INHERITED (factory) {} |
| 210 | 208 |
| 211 virtual void emitCode(GrGLShaderBuilder* builder, | 209 virtual void emitCode(GrGLFullShaderBuilder* builder, |
| 212 const GrDrawEffect& drawEffect, | 210 const GrDrawEffect& drawEffect, |
| 213 EffectKey key, | 211 EffectKey key, |
| 214 const char* outputColor, | 212 const char* outputColor, |
| 215 const char* inputColor, | 213 const char* inputColor, |
| 216 const TransformedCoordsArray&, | 214 const TransformedCoordsArray&, |
| 217 const TextureSamplerArray& samplers) SK_OVERRIDE { | 215 const TextureSamplerArray& samplers) SK_OVERRIDE { |
| 218 GrGLShaderBuilder::VertexBuilder* vertexBuilder = builder->getVertex
Builder(); | |
| 219 SkASSERT(NULL != vertexBuilder); | |
| 220 | |
| 221 const EllipseEdgeEffect& ellipseEffect = drawEffect.castEffect<Ellip
seEdgeEffect>(); | 216 const EllipseEdgeEffect& ellipseEffect = drawEffect.castEffect<Ellip
seEdgeEffect>(); |
| 222 | 217 |
| 223 const char *vsOffsetName, *fsOffsetName; | 218 const char *vsOffsetName, *fsOffsetName; |
| 224 const char *vsRadiiName, *fsRadiiName; | 219 const char *vsRadiiName, *fsRadiiName; |
| 225 | 220 |
| 226 vertexBuilder->addVarying(kVec2f_GrSLType, "EllipseOffsets", &vsOffs
etName, &fsOffsetName); | 221 builder->addVarying(kVec2f_GrSLType, "EllipseOffsets", &vsOffsetName
, &fsOffsetName); |
| 227 const SkString* attr0Name = | 222 const SkString* attr0Name = |
| 228 vertexBuilder->getEffectAttributeName(drawEffect.getVertexAttrib
Indices()[0]); | 223 builder->getEffectAttributeName(drawEffect.getVertexAttribIndice
s()[0]); |
| 229 vertexBuilder->vsCodeAppendf("\t%s = %s;\n", vsOffsetName, attr0Name
->c_str()); | 224 builder->vsCodeAppendf("\t%s = %s;\n", vsOffsetName, attr0Name->c_st
r()); |
| 230 | 225 |
| 231 vertexBuilder->addVarying(kVec4f_GrSLType, "EllipseRadii", &vsRadiiN
ame, &fsRadiiName); | 226 builder->addVarying(kVec4f_GrSLType, "EllipseRadii", &vsRadiiName, &
fsRadiiName); |
| 232 const SkString* attr1Name = | 227 const SkString* attr1Name = |
| 233 vertexBuilder->getEffectAttributeName(drawEffect.getVertexAttrib
Indices()[1]); | 228 builder->getEffectAttributeName(drawEffect.getVertexAttribIndice
s()[1]); |
| 234 vertexBuilder->vsCodeAppendf("\t%s = %s;\n", vsRadiiName, attr1Name-
>c_str()); | 229 builder->vsCodeAppendf("\t%s = %s;\n", vsRadiiName, attr1Name->c_str
()); |
| 235 | 230 |
| 236 // for outer curve | 231 // for outer curve |
| 237 builder->fsCodeAppendf("\tvec2 scaledOffset = %s*%s.xy;\n", fsOffset
Name, fsRadiiName); | 232 builder->fsCodeAppendf("\tvec2 scaledOffset = %s*%s.xy;\n", fsOffset
Name, fsRadiiName); |
| 238 builder->fsCodeAppend("\tfloat test = dot(scaledOffset, scaledOffset
) - 1.0;\n"); | 233 builder->fsCodeAppend("\tfloat test = dot(scaledOffset, scaledOffset
) - 1.0;\n"); |
| 239 builder->fsCodeAppendf("\tvec2 grad = 2.0*scaledOffset*%s.xy;\n", fs
RadiiName); | 234 builder->fsCodeAppendf("\tvec2 grad = 2.0*scaledOffset*%s.xy;\n", fs
RadiiName); |
| 240 builder->fsCodeAppend("\tfloat grad_dot = dot(grad, grad);\n"); | 235 builder->fsCodeAppend("\tfloat grad_dot = dot(grad, grad);\n"); |
| 241 // we need to clamp the length^2 of the gradiant vector to a non-zer
o value, because | 236 // we need to clamp the length^2 of the gradiant vector to a non-zer
o value, because |
| 242 // on the Nexus 4 the undefined result of inversesqrt(0) drops out a
n entire tile | 237 // on the Nexus 4 the undefined result of inversesqrt(0) drops out a
n entire tile |
| 243 // TODO: restrict this to Adreno-only | 238 // TODO: restrict this to Adreno-only |
| 244 builder->fsCodeAppend("\tgrad_dot = max(grad_dot, 1.0e-4);\n"); | 239 builder->fsCodeAppend("\tgrad_dot = max(grad_dot, 1.0e-4);\n"); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 262 static inline EffectKey GenKey(const GrDrawEffect& drawEffect, const GrG
LCaps&) { | 257 static inline EffectKey GenKey(const GrDrawEffect& drawEffect, const GrG
LCaps&) { |
| 263 const EllipseEdgeEffect& ellipseEffect = drawEffect.castEffect<Ellip
seEdgeEffect>(); | 258 const EllipseEdgeEffect& ellipseEffect = drawEffect.castEffect<Ellip
seEdgeEffect>(); |
| 264 | 259 |
| 265 return ellipseEffect.isStroked() ? 0x1 : 0x0; | 260 return ellipseEffect.isStroked() ? 0x1 : 0x0; |
| 266 } | 261 } |
| 267 | 262 |
| 268 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_
OVERRIDE { | 263 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_
OVERRIDE { |
| 269 } | 264 } |
| 270 | 265 |
| 271 private: | 266 private: |
| 272 typedef GrGLEffect INHERITED; | 267 typedef GrGLVertexEffect INHERITED; |
| 273 }; | 268 }; |
| 274 | 269 |
| 275 private: | 270 private: |
| 276 EllipseEdgeEffect(bool stroke) : GrVertexEffect() { | 271 EllipseEdgeEffect(bool stroke) : GrVertexEffect() { |
| 277 this->addVertexAttrib(kVec2f_GrSLType); | 272 this->addVertexAttrib(kVec2f_GrSLType); |
| 278 this->addVertexAttrib(kVec4f_GrSLType); | 273 this->addVertexAttrib(kVec4f_GrSLType); |
| 279 fStroke = stroke; | 274 fStroke = stroke; |
| 280 } | 275 } |
| 281 | 276 |
| 282 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE { | 277 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE { | 335 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE { |
| 341 return GrTBackendEffectFactory<DIEllipseEdgeEffect>::getInstance(); | 336 return GrTBackendEffectFactory<DIEllipseEdgeEffect>::getInstance(); |
| 342 } | 337 } |
| 343 | 338 |
| 344 virtual ~DIEllipseEdgeEffect() {} | 339 virtual ~DIEllipseEdgeEffect() {} |
| 345 | 340 |
| 346 static const char* Name() { return "DIEllipseEdge"; } | 341 static const char* Name() { return "DIEllipseEdge"; } |
| 347 | 342 |
| 348 inline Mode getMode() const { return fMode; } | 343 inline Mode getMode() const { return fMode; } |
| 349 | 344 |
| 350 class GLEffect : public GrGLEffect { | 345 class GLEffect : public GrGLVertexEffect { |
| 351 public: | 346 public: |
| 352 GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) | 347 GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) |
| 353 : INHERITED (factory) {} | 348 : INHERITED (factory) {} |
| 354 | 349 |
| 355 virtual void emitCode(GrGLShaderBuilder* builder, | 350 virtual void emitCode(GrGLFullShaderBuilder* builder, |
| 356 const GrDrawEffect& drawEffect, | 351 const GrDrawEffect& drawEffect, |
| 357 EffectKey key, | 352 EffectKey key, |
| 358 const char* outputColor, | 353 const char* outputColor, |
| 359 const char* inputColor, | 354 const char* inputColor, |
| 360 const TransformedCoordsArray&, | 355 const TransformedCoordsArray&, |
| 361 const TextureSamplerArray& samplers) SK_OVERRIDE { | 356 const TextureSamplerArray& samplers) SK_OVERRIDE { |
| 362 GrGLShaderBuilder::VertexBuilder* vertexBuilder = builder->getVertex
Builder(); | |
| 363 SkASSERT(NULL != vertexBuilder); | |
| 364 | |
| 365 const DIEllipseEdgeEffect& ellipseEffect = drawEffect.castEffect<DIE
llipseEdgeEffect>(); | 357 const DIEllipseEdgeEffect& ellipseEffect = drawEffect.castEffect<DIE
llipseEdgeEffect>(); |
| 366 | 358 |
| 367 SkAssertResult(builder->enableFeature( | 359 SkAssertResult(builder->enableFeature( |
| 368 GrGLShaderBuilder::kStandardDeriva
tives_GLSLFeature)); | 360 GrGLShaderBuilder::kStandardDeriva
tives_GLSLFeature)); |
| 369 | 361 |
| 370 const char *vsOffsetName0, *fsOffsetName0; | 362 const char *vsOffsetName0, *fsOffsetName0; |
| 371 vertexBuilder->addVarying(kVec2f_GrSLType, "EllipseOffsets0", | 363 builder->addVarying(kVec2f_GrSLType, "EllipseOffsets0", |
| 372 &vsOffsetName0, &fsOffsetName0); | 364 &vsOffsetName0, &fsOffsetName0); |
| 373 const SkString* attr0Name = | 365 const SkString* attr0Name = |
| 374 vertexBuilder->getEffectAttributeName(drawEffect.getVertexAttrib
Indices()[0]); | 366 builder->getEffectAttributeName(drawEffect.getVertexAttribIndice
s()[0]); |
| 375 vertexBuilder->vsCodeAppendf("\t%s = %s;\n", vsOffsetName0, attr0Nam
e->c_str()); | 367 builder->vsCodeAppendf("\t%s = %s;\n", vsOffsetName0, attr0Name->c_s
tr()); |
| 376 const char *vsOffsetName1, *fsOffsetName1; | 368 const char *vsOffsetName1, *fsOffsetName1; |
| 377 vertexBuilder->addVarying(kVec2f_GrSLType, "EllipseOffsets1", | 369 builder->addVarying(kVec2f_GrSLType, "EllipseOffsets1", |
| 378 &vsOffsetName1, &fsOffsetName1); | 370 &vsOffsetName1, &fsOffsetName1); |
| 379 const SkString* attr1Name = | 371 const SkString* attr1Name = |
| 380 vertexBuilder->getEffectAttributeName(drawEffect.getVertexAttrib
Indices()[1]); | 372 builder->getEffectAttributeName(drawEffect.getVertexAttribIndice
s()[1]); |
| 381 vertexBuilder->vsCodeAppendf("\t%s = %s;\n", vsOffsetName1, attr1Nam
e->c_str()); | 373 builder->vsCodeAppendf("\t%s = %s;\n", vsOffsetName1, attr1Name->c_s
tr()); |
| 382 | 374 |
| 383 // for outer curve | 375 // for outer curve |
| 384 builder->fsCodeAppendf("\tvec2 scaledOffset = %s.xy;\n", fsOffsetNam
e0); | 376 builder->fsCodeAppendf("\tvec2 scaledOffset = %s.xy;\n", fsOffsetNam
e0); |
| 385 builder->fsCodeAppend("\tfloat test = dot(scaledOffset, scaledOffset
) - 1.0;\n"); | 377 builder->fsCodeAppend("\tfloat test = dot(scaledOffset, scaledOffset
) - 1.0;\n"); |
| 386 builder->fsCodeAppendf("\tvec2 duvdx = dFdx(%s);\n", fsOffsetName0); | 378 builder->fsCodeAppendf("\tvec2 duvdx = dFdx(%s);\n", fsOffsetName0); |
| 387 builder->fsCodeAppendf("\tvec2 duvdy = dFdy(%s);\n", fsOffsetName0); | 379 builder->fsCodeAppendf("\tvec2 duvdy = dFdy(%s);\n", fsOffsetName0); |
| 388 builder->fsCodeAppendf("\tvec2 grad = vec2(2.0*%s.x*duvdx.x + 2.0*%s
.y*duvdx.y,\n" | 380 builder->fsCodeAppendf("\tvec2 grad = vec2(2.0*%s.x*duvdx.x + 2.0*%s
.y*duvdx.y,\n" |
| 389 "\t 2.0*%s.x*duvdy.x + 2.0*%s
.y*duvdy.y);\n", | 381 "\t 2.0*%s.x*duvdy.x + 2.0*%s
.y*duvdy.y);\n", |
| 390 fsOffsetName0, fsOffsetName0, fsOffsetName0,
fsOffsetName0); | 382 fsOffsetName0, fsOffsetName0, fsOffsetName0,
fsOffsetName0); |
| 391 | 383 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 static inline EffectKey GenKey(const GrDrawEffect& drawEffect, const GrG
LCaps&) { | 416 static inline EffectKey GenKey(const GrDrawEffect& drawEffect, const GrG
LCaps&) { |
| 425 const DIEllipseEdgeEffect& ellipseEffect = drawEffect.castEffect<DIE
llipseEdgeEffect>(); | 417 const DIEllipseEdgeEffect& ellipseEffect = drawEffect.castEffect<DIE
llipseEdgeEffect>(); |
| 426 | 418 |
| 427 return ellipseEffect.getMode(); | 419 return ellipseEffect.getMode(); |
| 428 } | 420 } |
| 429 | 421 |
| 430 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_
OVERRIDE { | 422 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_
OVERRIDE { |
| 431 } | 423 } |
| 432 | 424 |
| 433 private: | 425 private: |
| 434 typedef GrGLEffect INHERITED; | 426 typedef GrGLVertexEffect INHERITED; |
| 435 }; | 427 }; |
| 436 | 428 |
| 437 private: | 429 private: |
| 438 DIEllipseEdgeEffect(Mode mode) : GrVertexEffect() { | 430 DIEllipseEdgeEffect(Mode mode) : GrVertexEffect() { |
| 439 this->addVertexAttrib(kVec2f_GrSLType); | 431 this->addVertexAttrib(kVec2f_GrSLType); |
| 440 this->addVertexAttrib(kVec2f_GrSLType); | 432 this->addVertexAttrib(kVec2f_GrSLType); |
| 441 fMode = mode; | 433 fMode = mode; |
| 442 } | 434 } |
| 443 | 435 |
| 444 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE { | 436 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE { |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 } | 1135 } |
| 1144 | 1136 |
| 1145 // drop out the middle quad if we're stroked | 1137 // drop out the middle quad if we're stroked |
| 1146 int indexCnt = isStroked ? GR_ARRAY_COUNT(gRRectIndices)-6 : GR_ARRAY_CO
UNT(gRRectIndices); | 1138 int indexCnt = isStroked ? GR_ARRAY_COUNT(gRRectIndices)-6 : GR_ARRAY_CO
UNT(gRRectIndices); |
| 1147 target->setIndexSourceToBuffer(indexBuffer); | 1139 target->setIndexSourceToBuffer(indexBuffer); |
| 1148 target->drawIndexed(kTriangles_GrPrimitiveType, 0, 0, 16, indexCnt, &bou
nds); | 1140 target->drawIndexed(kTriangles_GrPrimitiveType, 0, 0, 16, indexCnt, &bou
nds); |
| 1149 } | 1141 } |
| 1150 | 1142 |
| 1151 return true; | 1143 return true; |
| 1152 } | 1144 } |
| OLD | NEW |