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

Unified Diff: gm/beziereffects.cpp

Issue 183893023: Unify edge type enums across GrEffect subclasses that clip rendering to a geometry. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: tot again Created 6 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
« no previous file with comments | « expectations/gm/ignored-tests.txt ('k') | gm/convexpolyeffect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/beziereffects.cpp
diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp
index 87e2d0a21d85b94c5f3c420e252f4730d82ea2af..aebf6fbbba478e0673cd5e59e74f76aa267bc846 100644
--- a/gm/beziereffects.cpp
+++ b/gm/beziereffects.cpp
@@ -93,7 +93,21 @@ protected:
{rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)},
{rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}
};
- for(int edgeType = kFillAA_GrBezierEdgeType; edgeType < 3; ++edgeType) {
+ for(int edgeType = 0; edgeType < kGrEffectEdgeTypeCnt; ++edgeType) {
+ SkAutoTUnref<GrEffectRef> effect;
+ { // scope to contain GrTestTarget
+ GrTestTarget tt;
+ context->getTestTarget(&tt);
+ if (NULL == tt.target()) {
+ continue;
+ }
+ GrEffectEdgeType et = (GrEffectEdgeType)edgeType;
+ effect.reset(GrCubicEffect::Create(et, *tt.target()->caps()));
+ if (!effect) {
+ continue;
+ }
+ }
+
SkScalar x = SkScalarMul(col, w);
SkScalar y = SkScalarMul(row, h);
SkPoint controlPts[] = {
@@ -153,17 +167,10 @@ protected:
GrTestTarget tt;
context->getTestTarget(&tt);
- if (NULL == tt.target()) {
- continue;
- }
+ SkASSERT(NULL != tt.target());
GrDrawState* drawState = tt.target()->drawState();
drawState->setVertexAttribs<kAttribs>(2);
- SkAutoTUnref<GrEffectRef> effect(GrCubicEffect::Create(
- GrBezierEdgeType(edgeType), *tt.target()->caps()));
- if (!effect) {
- continue;
- }
drawState->addCoverageEffect(effect, 1);
drawState->setRenderTarget(rt);
drawState->setColor(0xff000000);
@@ -245,7 +252,21 @@ protected:
{rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}
};
SkScalar weight = rand.nextRangeF(0.f, 2.f);
- for(int edgeType = kFillAA_GrBezierEdgeType; edgeType < 3; ++edgeType) {
+ for(int edgeType = 0; edgeType < kGrEffectEdgeTypeCnt; ++edgeType) {
+ SkAutoTUnref<GrEffectRef> effect;
+ { // scope to contain GrTestTarget
+ GrTestTarget tt;
+ context->getTestTarget(&tt);
+ if (NULL == tt.target()) {
+ continue;
+ }
+ GrEffectEdgeType et = (GrEffectEdgeType)edgeType;
+ effect.reset(GrConicEffect::Create(et, *tt.target()->caps()));
+ if (!effect) {
+ continue;
+ }
+ }
+
SkScalar x = SkScalarMul(col, w);
SkScalar y = SkScalarMul(row, h);
SkPoint controlPts[] = {
@@ -302,17 +323,10 @@ protected:
GrTestTarget tt;
context->getTestTarget(&tt);
- if (NULL == tt.target()) {
- continue;
- }
+ SkASSERT(NULL != tt.target());
GrDrawState* drawState = tt.target()->drawState();
drawState->setVertexAttribs<kAttribs>(2);
- SkAutoTUnref<GrEffectRef> effect(GrConicEffect::Create(
- GrBezierEdgeType(edgeType), *tt.target()->caps()));
- if (!effect) {
- continue;
- }
drawState->addCoverageEffect(effect, 1);
drawState->setRenderTarget(rt);
drawState->setColor(0xff000000);
@@ -428,7 +442,21 @@ protected:
{rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)},
{rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}
};
- for(int edgeType = kFillAA_GrBezierEdgeType; edgeType < 3; ++edgeType) {
+ for(int edgeType = 0; edgeType < kGrEffectEdgeTypeCnt; ++edgeType) {
+ SkAutoTUnref<GrEffectRef> effect;
+ { // scope to contain GrTestTarget
+ GrTestTarget tt;
+ context->getTestTarget(&tt);
+ if (NULL == tt.target()) {
+ continue;
+ }
+ GrEffectEdgeType et = (GrEffectEdgeType)edgeType;
+ effect.reset(GrQuadEffect::Create(et, *tt.target()->caps()));
+ if (!effect) {
+ continue;
+ }
+ }
+
SkScalar x = SkScalarMul(col, w);
SkScalar y = SkScalarMul(row, h);
SkPoint controlPts[] = {
@@ -480,16 +508,10 @@ protected:
GrTestTarget tt;
context->getTestTarget(&tt);
- if (NULL == tt.target()) {
- continue;
- }
+ SkASSERT(NULL != tt.target());
GrDrawState* drawState = tt.target()->drawState();
drawState->setVertexAttribs<kAttribs>(2);
- SkAutoTUnref<GrEffectRef> effect(GrQuadEffect::Create(
- GrBezierEdgeType(edgeType), *tt.target()->caps()));
- if (!effect) {
- continue;
- }
+
drawState->addCoverageEffect(effect, 1);
drawState->setRenderTarget(rt);
drawState->setColor(0xff000000);
« no previous file with comments | « expectations/gm/ignored-tests.txt ('k') | gm/convexpolyeffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698