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

Unified Diff: src/gpu/effects/GrOvalEffect.cpp

Issue 220233011: Implement drawDRRect for GPU (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 6 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 | « src/gpu/SkGpuDevice.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrOvalEffect.cpp
diff --git a/src/gpu/effects/GrOvalEffect.cpp b/src/gpu/effects/GrOvalEffect.cpp
index 97b977f7542b8a357e8700d2c406fa0cf37751e8..40870e27d2ff216ea30a852a5efa7e742fe4bdc5 100644
--- a/src/gpu/effects/GrOvalEffect.cpp
+++ b/src/gpu/effects/GrOvalEffect.cpp
@@ -137,7 +137,8 @@ void GLCircleEffect::emitCode(GrGLShaderBuilder* builder,
const TextureSamplerArray& samplers) {
const CircleEffect& ce = drawEffect.castEffect<CircleEffect>();
const char *circleName;
- // The circle uniform is (center.x, center.y, radius + 0.5)
+ // The circle uniform is (center.x, center.y, radius + 0.5) for regular fills and
+ // (... ,radius - 0.5) for inverse fills.
fCircleUniform = builder->addUniform(GrGLShaderBuilder::kFragment_Visibility,
kVec3f_GrSLType,
"circle",
@@ -171,7 +172,13 @@ GrGLEffect::EffectKey GLCircleEffect::GenKey(const GrDrawEffect& drawEffect,
void GLCircleEffect::setData(const GrGLUniformManager& uman, const GrDrawEffect& drawEffect) {
const CircleEffect& ce = drawEffect.castEffect<CircleEffect>();
if (ce.getRadius() != fPrevRadius || ce.getCenter() != fPrevCenter) {
- uman.set3f(fCircleUniform, ce.getCenter().fX, ce.getCenter().fY, ce.getRadius() + 0.5f);
+ SkScalar radius = ce.getRadius();
+ if (GrEffectEdgeTypeIsInverseFill(ce.getEdgeType())) {
+ radius -= 0.5f;
+ } else {
+ radius += 0.5f;
+ }
+ uman.set3f(fCircleUniform, ce.getCenter().fX, ce.getCenter().fY, radius);
fPrevCenter = ce.getCenter();
fPrevRadius = ce.getRadius();
}
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698