mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-04 08:46:09 +00:00
Fix eyedropper for tiles w/flags when picking colors from "Current Layer"
This commit is contained in:
parent
0796d3732c
commit
b7de90a82b
@ -21,10 +21,13 @@
|
||||
#include "doc/primitives.h"
|
||||
#include "doc/render_plan.h"
|
||||
#include "doc/sprite.h"
|
||||
#include "doc/tile.h"
|
||||
#include "doc/tileset.h"
|
||||
#include "gfx/point.h"
|
||||
#include "render/get_sprite_pixel.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#define PICKER_TRACE(...) // TRACE
|
||||
|
||||
namespace app {
|
||||
@ -65,19 +68,20 @@ bool get_cel_pixel(const Cel* cel,
|
||||
|
||||
const doc::tile_index t =
|
||||
get_pixel(image, tilePos.x, tilePos.y);
|
||||
|
||||
// TODO take care of flip flags
|
||||
|
||||
const doc::tile_index ti = doc::tile_geti(t);
|
||||
const doc::tile_index tf = doc::tile_getf(t);
|
||||
|
||||
PICKER_TRACE("PICKER: tile=%d index=%d\n", t, ti);
|
||||
PICKER_TRACE("PICKER: tile=%d index=%d flags=%d\n", t, ti, tf);
|
||||
|
||||
doc::ImageRef tile = layerTilemap->tileset()->get(ti);
|
||||
if (!tile)
|
||||
return false;
|
||||
|
||||
const gfx::Point ipos =
|
||||
gfx::Point ipos =
|
||||
gfx::Point(pos) - grid.tileToCanvas(tilePos);
|
||||
if (tf & doc::tile_f_xflip) { ipos.x = tile->width()-ipos.x-1; }
|
||||
if (tf & doc::tile_f_yflip) { ipos.y = tile->height()-ipos.y-1; }
|
||||
if (tf & doc::tile_f_dflip) { std::swap(ipos.x, ipos.y); }
|
||||
|
||||
PICKER_TRACE("PICKER: ipos=%d %d\n", ipos.x, ipos.y);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user