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

Unified Diff: src/gpu/GrContext.cpp

Issue 12462008: Add GrEllipseEdgeEffect (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrContext.cpp
===================================================================
--- src/gpu/GrContext.cpp (revision 7952)
+++ src/gpu/GrContext.cpp (working copy)
@@ -12,6 +12,7 @@
#include "effects/GrConvolutionEffect.h"
#include "effects/GrSingleTextureEffect.h"
#include "effects/GrConfigConversionEffect.h"
+#include "effects/GrEllipseEdgeEffect.h"
#include "GrBufferAllocPool.h"
#include "GrGpu.h"
@@ -1084,12 +1085,8 @@
{kVec2f_GrVertexAttribType, 0},
{kVec4f_GrVertexAttribType, sizeof(GrPoint)}
};
- static const GrAttribBindings kAttributeBindings = GrDrawState::kEdge_AttribBindingsBit;
-
drawState->setVertexAttribs(kVertexAttribs, SK_ARRAY_COUNT(kVertexAttribs));
drawState->setAttribIndex(GrDrawState::kPosition_AttribIndex, 0);
- drawState->setAttribIndex(GrDrawState::kEdge_AttribIndex, 1);
- drawState->setAttribBindings(kAttributeBindings);
GrAssert(sizeof(CircleVertex) == drawState->getVertexSize());
GrDrawTarget::AutoReleaseGeometry geo(target, 4, 0);
@@ -1109,7 +1106,10 @@
SkScalar B;
if (isCircle) {
robertphillips 2013/03/05 20:30:13 kCircleAttrBindings? As is I think just passing kE
jvanverth1 2013/03/07 15:21:54 Done.
+ static const GrAttribBindings kAttributeBindings = GrDrawState::kEdge_AttribBindingsBit;
+ drawState->setAttribBindings(kAttributeBindings);
drawState->setVertexEdgeType(GrDrawState::kCircle_EdgeType);
+ drawState->setAttribIndex(GrDrawState::kEdge_AttribIndex, 1);
xRadius = vm.mapRadius(xRadius);
@@ -1141,8 +1141,16 @@
T = -outerRadius;
B = +outerRadius;
} else { // is axis-aligned ellipse
- drawState->setVertexEdgeType(GrDrawState::kEllipse_EdgeType);
+ drawState->setAttribBindings(GrDrawState::kDefault_AttribBindings);
robertphillips 2013/03/05 20:30:13 Why not "static const" style? Also, some words her
jvanverth1 2013/03/07 15:21:54 All the other stage constants use enums. Should I
+ enum {
+ kEdgeEffectStage = GrPaint::kTotalStages,
+ };
+ GrEffectRef* effect = GrEllipseEdgeEffect::Create();
+ drawState->setEffect(kEdgeEffectStage, effect)->unref();
+ int index = 1;
+ drawState->setEffectAttribIndices(kEdgeEffectStage, &index, 1);
+
SkRect xformedRect;
vm.mapRect(&xformedRect, oval);

Powered by Google App Engine
This is Rietveld 408576698