Fix eyedropper when picking colors from the top or left edge of a tile (in composition mode)

This commit is contained in:
David Capello 2019-11-06 16:36:02 -03:00
parent 1e5c096236
commit 472861ddd9
2 changed files with 14 additions and 2 deletions

View File

@ -24,7 +24,7 @@
#include "gfx/point.h"
#include "render/get_sprite_pixel.h"
#define PICKER_TRACE(...)
#define PICKER_TRACE(...) // TRACE
namespace app {

View File

@ -25,7 +25,7 @@
#include <cmath>
#define TRACE_RENDER_CEL(...)
#define TRACE_RENDER_CEL(...) // TRACE
namespace render {
@ -1242,9 +1242,21 @@ void Render::renderCel(
if (!tileset)
return;
if (area.size.w < 1 ||
area.size.h < 1)
return;
gfx::Rect tilesToDraw = grid.canvasToTile(
m_proj.remove(gfx::Rect(area.src, area.size)));
// As area.size is not empty at this point, we have to draw at
// least one tile (and the clipping will be performed for the
// tile pixels later).
if (tilesToDraw.w < 1) tilesToDraw.w = 1;
if (tilesToDraw.h < 1) tilesToDraw.h = 1;
tilesToDraw &= cel_image->bounds();
TRACE_RENDER_CEL("Drawing tilemap (%d %d %d %d)\n",
tilesToDraw.x, tilesToDraw.y, tilesToDraw.w, tilesToDraw.h);