mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-18 16:21:07 +00:00
src/app/modules/gfx.cpp: Remove deprecated RectTracker stuff
This commit is contained in:
parent
fe552f60de
commit
66f357098c
@ -165,113 +165,6 @@ void dotted_mode(int offset)
|
||||
drawing_mode(DRAW_MODE_COPY_PATTERN, pattern, 0, 0);
|
||||
}
|
||||
|
||||
// Save/Restore rectangles from/to the screen.
|
||||
struct RectTracker
|
||||
{
|
||||
BITMAP* bmp;
|
||||
int x1, y1, x2, y2;
|
||||
int npixel;
|
||||
int *pixel;
|
||||
};
|
||||
|
||||
static void do_rect(BITMAP* bmp, int x1, int y1, int x2, int y2, RectTracker* rt,
|
||||
void (*proc)(BITMAP* bmp, int x, int y, RectTracker* rt))
|
||||
{
|
||||
int x, y, u1, u2, v1, v2;
|
||||
|
||||
if ((x2 < bmp->cl) || (x1 >= bmp->cr) ||
|
||||
(y2 < bmp->ct) || (y1 >= bmp->cb))
|
||||
return;
|
||||
|
||||
u1 = MID(bmp->cl, x1, bmp->cr-1);
|
||||
u2 = MID(x1, x2, bmp->cr-1);
|
||||
|
||||
if ((y1 >= bmp->ct) && (y1 < bmp->cb)) {
|
||||
for (x=u1; x<=u2; x++)
|
||||
(*proc)(bmp, x, y1, rt);
|
||||
}
|
||||
|
||||
if ((y2 >= bmp->ct) && (y2 < bmp->cb)) {
|
||||
for (x=u1; x<=u2; x++)
|
||||
(*proc)(bmp, x, y2, rt);
|
||||
}
|
||||
|
||||
v1 = MID(bmp->ct, y1+1, bmp->cb-1);
|
||||
v2 = MID(v1, y2-1, bmp->cb-1);
|
||||
|
||||
if ((x1 >= bmp->cl) && (x1 < bmp->cr)) {
|
||||
for (y=v1; y<=v2; y++)
|
||||
(*proc)(bmp, x1, y, rt);
|
||||
}
|
||||
|
||||
if ((x2 >= bmp->cl) && (x2 < bmp->cr)) {
|
||||
for (y=v1; y<=v2; y++)
|
||||
(*proc)(bmp, x2, y, rt);
|
||||
}
|
||||
}
|
||||
|
||||
static void count_rect(BITMAP* bmp, int x, int y, RectTracker* rt)
|
||||
{
|
||||
rt->npixel++;
|
||||
}
|
||||
|
||||
static void save_rect(BITMAP* bmp, int x, int y, RectTracker* rt)
|
||||
{
|
||||
rt->pixel[rt->npixel++] = getpixel(bmp, x, y);
|
||||
}
|
||||
|
||||
static void restore_rect(BITMAP* bmp, int x, int y, RectTracker* rt)
|
||||
{
|
||||
putpixel(bmp, x, y, rt->pixel[rt->npixel++]);
|
||||
}
|
||||
|
||||
RectTracker* rect_tracker_new(BITMAP* bmp, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
RectTracker* rt;
|
||||
int x, y;
|
||||
|
||||
ui::jmouse_hide();
|
||||
|
||||
if (x1 > x2) { x = x1; x1 = x2; x2 = x; }
|
||||
if (y1 > y2) { y = y1; y1 = y2; y2 = y; }
|
||||
|
||||
rt = new RectTracker;
|
||||
|
||||
rt->bmp = bmp;
|
||||
rt->x1 = x1;
|
||||
rt->y1 = y1;
|
||||
rt->x2 = x2;
|
||||
rt->y2 = y2;
|
||||
|
||||
rt->npixel = 0;
|
||||
do_rect(bmp, x1, y1, x2, y2, rt, count_rect);
|
||||
|
||||
if (rt->npixel > 0)
|
||||
rt->pixel = new int[rt->npixel];
|
||||
else
|
||||
rt->pixel = NULL;
|
||||
|
||||
rt->npixel = 0;
|
||||
do_rect(bmp, x1, y1, x2, y2, rt, save_rect);
|
||||
|
||||
ui::jmouse_show();
|
||||
|
||||
return rt;
|
||||
}
|
||||
|
||||
void rect_tracker_free(RectTracker* rt)
|
||||
{
|
||||
ui::jmouse_hide();
|
||||
|
||||
rt->npixel = 0;
|
||||
do_rect(rt->bmp, rt->x1, rt->y1, rt->x2, rt->y2, rt, restore_rect);
|
||||
|
||||
delete[] rt->pixel;
|
||||
delete rt;
|
||||
|
||||
ui::jmouse_show();
|
||||
}
|
||||
|
||||
void rectgrid(BITMAP* bmp, int x1, int y1, int x2, int y2, int w, int h)
|
||||
{
|
||||
if (w < 1 || h < 1)
|
||||
|
@ -28,15 +28,10 @@ struct FONT;
|
||||
struct BITMAP;
|
||||
|
||||
namespace app {
|
||||
struct RectTracker;
|
||||
|
||||
using namespace raster;
|
||||
|
||||
void dotted_mode(int offset);
|
||||
|
||||
RectTracker* rect_tracker_new(BITMAP* bmp, int x1, int y1, int x2, int y2);
|
||||
void rect_tracker_free(RectTracker* tracker);
|
||||
|
||||
void rectgrid(BITMAP* bmp, int x1, int y1, int x2, int y2, int w, int h);
|
||||
|
||||
void draw_emptyset_symbol(BITMAP* bmp, const gfx::Rect& rc, ui::Color color);
|
||||
|
Loading…
x
Reference in New Issue
Block a user