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

Unified Diff: src/gpu/batches/GrNonAAStrokeRectBatch.cpp

Issue 2126913002: Fix bounds computation for non-aa hairlines when snapping to pixel centers (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix int scalar warning Created 4 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrNonAAStrokeRectBatch.cpp
diff --git a/src/gpu/batches/GrNonAAStrokeRectBatch.cpp b/src/gpu/batches/GrNonAAStrokeRectBatch.cpp
index a38760c362ea14b8f04796bf07f9b5fe8c8972f2..61335523f7a87180ac104d6241c2480f25a020bd 100644
--- a/src/gpu/batches/GrNonAAStrokeRectBatch.cpp
+++ b/src/gpu/batches/GrNonAAStrokeRectBatch.cpp
@@ -100,6 +100,16 @@ private:
// If our caller snaps to pixel centers then we have to round out the bounds
if (snapToPixelCenters) {
+ // We want to be consistent with how we snap non-aa lines. To match what we do in
+ // GrGLSLVertexShaderBuilder, we first floor all the vertex values and then add half a
+ // pixel to force us to pixel centers.
+ bounds->set(SkScalarFloorToScalar(bounds->fLeft),
+ SkScalarFloorToScalar(bounds->fTop),
+ SkScalarFloorToScalar(bounds->fRight),
+ SkScalarFloorToScalar(bounds->fBottom));
+ bounds->offset(0.5f, 0.5f);
+
+ // Round out the bounds to integer values
bounds->roundOut();
bsalomon 2016/07/07 14:19:06 Do we need this round out? If the rect is rendered
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698