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

Unified Diff: src/gpu/GrOvalRenderer.cpp

Issue 13925015: Disable GPU acceleration for narrow ovals (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 | « include/gpu/GrOvalRenderer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrOvalRenderer.cpp
===================================================================
--- src/gpu/GrOvalRenderer.cpp (revision 8689)
+++ src/gpu/GrOvalRenderer.cpp (working copy)
@@ -297,7 +297,7 @@
// and axis-aligned ellipses only
} else if (vm.rectStaysRect()) {
- drawEllipse(target, paint, oval, stroke);
+ return drawEllipse(target, paint, oval, stroke);
} else {
return false;
@@ -406,7 +406,7 @@
target->drawNonIndexed(kTriangleStrip_GrPrimitiveType, 0, 4, &bounds);
}
-void GrOvalRenderer::drawEllipse(GrDrawTarget* target,
+bool GrOvalRenderer::drawEllipse(GrDrawTarget* target,
const GrPaint& paint,
const GrRect& ellipse,
const SkStrokeRec& stroke)
@@ -425,10 +425,15 @@
vm.mapPoints(&center, 1);
SkRect xformedRect;
vm.mapRect(&xformedRect, ellipse);
+ SkScalar xRadius = SkScalarHalf(xformedRect.width());
+ SkScalar yRadius = SkScalarHalf(xformedRect.height());
+ if (SkScalarDiv(xRadius, yRadius) > 2 || SkScalarDiv(yRadius, xRadius) > 2) {
+ return false;
+ }
GrDrawState::AutoDeviceCoordDraw adcd(drawState);
if (!adcd.succeeded()) {
- return;
+ return false;
}
// position + edge
@@ -443,7 +448,7 @@
GrDrawTarget::AutoReleaseGeometry geo(target, 4, 0);
if (!geo.succeeded()) {
GrPrintf("Failed to get space for vertices!\n");
- return;
+ return false;
}
EllipseVertex* verts = reinterpret_cast<EllipseVertex*>(geo.vertices());
@@ -463,8 +468,6 @@
drawState->setEffect(kEdgeEffectStage, effect,
kEllipseCenterAttrIndex, kEllipseEdgeAttrIndex)->unref();
- SkScalar xRadius = SkScalarHalf(xformedRect.width());
- SkScalar yRadius = SkScalarHalf(xformedRect.height());
SkScalar innerXRadius = 0.0f;
SkScalar innerRatio = 1.0f;
@@ -538,4 +541,6 @@
verts[3].fInnerOffset = SkPoint::Make(xRadius, innerRatio*yRadius);
target->drawNonIndexed(kTriangleStrip_GrPrimitiveType, 0, 4, &bounds);
+
+ return true;
}
« no previous file with comments | « include/gpu/GrOvalRenderer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698