Partial revert of #32657, undoing line shifting by 0.5

As discussed in #32657, this can't be done here as lines can be used
with a canvas scale, and this breaks them.
A suggestion is to do the pixel shifting at matrix level instead.

Fixes #33393.
Fixes #33421.
This commit is contained in:
Rémi Verschelde 2019-11-07 15:37:18 +01:00
parent 99cc4d246f
commit 47389c3a16
2 changed files with 4 additions and 8 deletions

View file

@ -494,10 +494,8 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
if (line->width <= 1) { if (line->width <= 1) {
Vector2 verts[2] = { Vector2 verts[2] = {
// Offset the line slightly to make sure we always draw the pixel at the from coordinate. Vector2(line->from.x, line->from.y),
// Without this, corners of rectangles might be missing a pixel. (See diamond exit rule and #32657) Vector2(line->to.x, line->to.y)
Vector2(Math::floor(line->from.x) + 0.5, Math::floor(line->from.y) + 0.5),
Vector2(Math::floor(line->to.x) + 0.5, Math::floor(line->to.y) + 0.5)
}; };
#ifdef GLES_OVER_GL #ifdef GLES_OVER_GL

View file

@ -548,10 +548,8 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur
if (line->width <= 1) { if (line->width <= 1) {
Vector2 verts[2] = { Vector2 verts[2] = {
// Offset the line slightly to make sure we always draw the pixel at the from coordinate. Vector2(line->from.x, line->from.y),
// Without this, corners of rectangles might be missing a pixel. (See diamond exit rule and #32657) Vector2(line->to.x, line->to.y)
Vector2(Math::floor(line->from.x) + 0.5, Math::floor(line->from.y) + 0.5),
Vector2(Math::floor(line->to.x) + 0.5, Math::floor(line->to.y) + 0.5)
}; };
#ifdef GLES_OVER_GL #ifdef GLES_OVER_GL