diff --git a/gm/conicpaths.cpp b/gm/conicpaths.cpp index 6d1fc00f22..d0c6a9fc5d 100644 --- a/gm/conicpaths.cpp +++ b/gm/conicpaths.cpp @@ -148,6 +148,17 @@ DEF_SIMPLE_GM(arccirclegap, canvas, 250, 250) { canvas->drawPath(path, paint); } +/* circle should be antialiased */ +DEF_SIMPLE_GM(largecircle, canvas, 250, 250) { + canvas->translate(50, 100); + SkPoint c = { 1052.5390625f, 506.8760978034711f }; + SkScalar radius = 1096.702150363923f; + SkPaint paint; + paint.setAntiAlias(true); + paint.setStyle(SkPaint::kStroke_Style); + canvas->drawCircle(c.fX, c.fY, radius, paint); +} + DEF_SIMPLE_GM(crbug_640176, canvas, 250, 250) { SkPath path; path.moveTo(SkBits2Float(0x00000000), SkBits2Float(0x00000000)); // 0, 0 diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp index b4213ea9a4..7a53ca6655 100644 --- a/src/gpu/ops/GrOvalOpFactory.cpp +++ b/src/gpu/ops/GrOvalOpFactory.cpp @@ -82,7 +82,8 @@ public: fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType, kHigh_GrSLPrecision); fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType); - fInCircleEdge = &this->addVertexAttrib("inCircleEdge", kVec4f_GrVertexAttribType); + fInCircleEdge = &this->addVertexAttrib("inCircleEdge", kVec4f_GrVertexAttribType, + kHigh_GrSLPrecision); if (clipPlane) { fInClipPlane = &this->addVertexAttrib("inClipPlane", kVec3f_GrVertexAttribType); } else { @@ -129,8 +130,9 @@ private: // emit attributes varyingHandler->emitAttributes(cgp); - fragBuilder->codeAppend("vec4 circleEdge;"); - varyingHandler->addPassThroughAttribute(cgp.fInCircleEdge, "circleEdge"); + fragBuilder->codeAppend("highp vec4 circleEdge;"); + varyingHandler->addPassThroughAttribute(cgp.fInCircleEdge, "circleEdge", + kHigh_GrSLPrecision); if (cgp.fInClipPlane) { fragBuilder->codeAppend("vec3 clipPlane;"); varyingHandler->addPassThroughAttribute(cgp.fInClipPlane, "clipPlane"); @@ -161,7 +163,7 @@ private: cgp.fLocalMatrix, args.fFPCoordTransformHandler); - fragBuilder->codeAppend("float d = length(circleEdge.xy);"); + fragBuilder->codeAppend("highp float d = length(circleEdge.xy);"); fragBuilder->codeAppend("float distanceToOuterEdge = circleEdge.z * (1.0 - d);"); fragBuilder->codeAppend("float edgeAlpha = clamp(distanceToOuterEdge, 0.0, 1.0);"); if (cgp.fStroke) {