mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-06 12:39:57 +00:00
Fixed compilation problems with gcc/vc.
This commit is contained in:
parent
48fbc7d875
commit
f9ac4089f5
1
NEWS.txt
1
NEWS.txt
@ -13,6 +13,7 @@ NEWS
|
|||||||
+ Fixed a bug with multiple editors and paste command.
|
+ Fixed a bug with multiple editors and paste command.
|
||||||
+ Fixed a bug in the File Open dialog when user presses ENTER key
|
+ Fixed a bug in the File Open dialog when user presses ENTER key
|
||||||
with an empty file name.
|
with an empty file name.
|
||||||
|
+ Fixed critical bugs in rendering code.
|
||||||
|
|
||||||
0.6.1
|
0.6.1
|
||||||
-----
|
-----
|
||||||
|
@ -181,7 +181,6 @@ COMMON_SOURCES = \
|
|||||||
src/raster/dirty.cpp \
|
src/raster/dirty.cpp \
|
||||||
src/raster/gfxobj.cpp \
|
src/raster/gfxobj.cpp \
|
||||||
src/raster/image.cpp \
|
src/raster/image.cpp \
|
||||||
src/raster/image_impl.cpp \
|
|
||||||
src/raster/layer.cpp \
|
src/raster/layer.cpp \
|
||||||
src/raster/mask.cpp \
|
src/raster/mask.cpp \
|
||||||
src/raster/palette.cpp \
|
src/raster/palette.cpp \
|
||||||
|
@ -81,7 +81,11 @@ char *jstrdup(const char *string)
|
|||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// With leak detection
|
// With leak detection
|
||||||
|
|
||||||
#define BACKTRACE_LEVELS 16
|
#if defined(__GNUC__)
|
||||||
|
#define BACKTRACE_LEVELS 4
|
||||||
|
#else
|
||||||
|
#define BACKTRACE_LEVELS 16
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined _MSC_VER
|
#if defined _MSC_VER
|
||||||
|
|
||||||
@ -218,8 +222,15 @@ static void addslot(void *ptr, unsigned long size)
|
|||||||
assert(size != 0);
|
assert(size != 0);
|
||||||
|
|
||||||
// __builtin_return_address is a GCC extension
|
// __builtin_return_address is a GCC extension
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
p->backtrace[0] = __builtin_return_address(4);
|
||||||
|
p->backtrace[1] = __builtin_return_address(3);
|
||||||
|
p->backtrace[2] = __builtin_return_address(2);
|
||||||
|
p->backtrace[3] = __builtin_return_address(1);
|
||||||
|
#else
|
||||||
for (int c=0; c<BACKTRACE_LEVELS; ++c)
|
for (int c=0; c<BACKTRACE_LEVELS; ++c)
|
||||||
p->backtrace[c] = __builtin_return_address(BACKTRACE_LEVELS-c);
|
p->backtrace[c] = __builtin_return_address(BACKTRACE_LEVELS-c);
|
||||||
|
#endif
|
||||||
|
|
||||||
p->ptr = ptr;
|
p->ptr = ptr;
|
||||||
p->size = size;
|
p->size = size;
|
||||||
|
@ -1,539 +0,0 @@
|
|||||||
/* ASE - Allegro Sprite Editor
|
|
||||||
* Copyright (C) 2001-2009 David Capello
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include "raster/image_impl.h"
|
|
||||||
|
|
||||||
template<>
|
|
||||||
void ImageImpl<RgbTraits>::to_allegro(BITMAP *bmp, int _x, int _y) const
|
|
||||||
{
|
|
||||||
const_address_t addr = raw_pixels();
|
|
||||||
unsigned long bmp_address;
|
|
||||||
int depth = bitmap_color_depth(bmp);
|
|
||||||
int x, y;
|
|
||||||
|
|
||||||
bmp_select(bmp);
|
|
||||||
|
|
||||||
switch (depth) {
|
|
||||||
|
|
||||||
case 8:
|
|
||||||
#if defined GFX_MODEX && !defined ALLEGRO_UNIX
|
|
||||||
if (is_planar_bitmap(bmp)) {
|
|
||||||
for (y=0; y<h; y++) {
|
|
||||||
bmp_address = (unsigned long)bmp->line[_y];
|
|
||||||
|
|
||||||
for (x=0; x<image->w; x++) {
|
|
||||||
outportw(0x3C4, (0x100<<((_x+x)&3))|2);
|
|
||||||
bmp_write8(bmp_address+((_x+x)>>2),
|
|
||||||
makecol8((*addr) & 0xff,
|
|
||||||
((*addr)>>8) & 0xff,
|
|
||||||
((*addr)>>16) & 0xff));
|
|
||||||
addr++;
|
|
||||||
}
|
|
||||||
|
|
||||||
_y++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
#endif
|
|
||||||
for (y=0; y<h; y++) {
|
|
||||||
bmp_address = bmp_write_line(bmp, _y)+_x;
|
|
||||||
|
|
||||||
for (x=0; x<w; x++) {
|
|
||||||
bmp_write8(bmp_address,
|
|
||||||
makecol8((*addr) & 0xff,
|
|
||||||
((*addr)>>8) & 0xff,
|
|
||||||
((*addr)>>16) & 0xff));
|
|
||||||
addr++;
|
|
||||||
bmp_address++;
|
|
||||||
}
|
|
||||||
|
|
||||||
_y++;
|
|
||||||
}
|
|
||||||
#if defined GFX_MODEX && !defined ALLEGRO_UNIX
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 15:
|
|
||||||
_x <<= 1;
|
|
||||||
|
|
||||||
for (y=0; y<h; y++) {
|
|
||||||
bmp_address = bmp_write_line(bmp, _y)+_x;
|
|
||||||
|
|
||||||
for (x=0; x<w; x++) {
|
|
||||||
bmp_write15(bmp_address,
|
|
||||||
makecol15((*addr) & 0xff,
|
|
||||||
((*addr)>>8) & 0xff,
|
|
||||||
((*addr)>>16) & 0xff));
|
|
||||||
addr++;
|
|
||||||
bmp_address += 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
_y++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 16:
|
|
||||||
_x <<= 1;
|
|
||||||
|
|
||||||
for (y=0; y<h; y++) {
|
|
||||||
bmp_address = bmp_write_line (bmp, _y)+_x;
|
|
||||||
|
|
||||||
for (x=0; x<w; x++) {
|
|
||||||
bmp_write16(bmp_address,
|
|
||||||
makecol16((*addr) & 0xff,
|
|
||||||
((*addr)>>8) & 0xff,
|
|
||||||
((*addr)>>16) & 0xff));
|
|
||||||
addr++;
|
|
||||||
bmp_address += 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
_y++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 24:
|
|
||||||
_x *= 3;
|
|
||||||
|
|
||||||
for (y=0; y<h; y++) {
|
|
||||||
bmp_address = bmp_write_line(bmp, _y)+_x;
|
|
||||||
|
|
||||||
for (x=0; x<w; x++) {
|
|
||||||
bmp_write24(bmp_address,
|
|
||||||
makecol24((*addr) & 0xff,
|
|
||||||
((*addr)>>8) & 0xff,
|
|
||||||
((*addr)>>16) & 0xff));
|
|
||||||
addr++;
|
|
||||||
bmp_address += 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
_y++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 32:
|
|
||||||
_x <<= 2;
|
|
||||||
|
|
||||||
for (y=0; y<h; y++) {
|
|
||||||
bmp_address = bmp_write_line(bmp, _y)+_x;
|
|
||||||
|
|
||||||
for (x=0; x<w; x++) {
|
|
||||||
bmp_write32(bmp_address,
|
|
||||||
makeacol32((*addr) & 0xff,
|
|
||||||
((*addr)>>8) & 0xff,
|
|
||||||
((*addr)>>16) & 0xff,
|
|
||||||
((*addr)>>24) & 0xff));
|
|
||||||
addr++;
|
|
||||||
bmp_address += 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
_y++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
bmp_unwrite_line(bmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<>
|
|
||||||
void ImageImpl<GrayscaleTraits>::to_allegro(BITMAP *bmp, int _x, int _y) const
|
|
||||||
{
|
|
||||||
const_address_t addr = raw_pixels();
|
|
||||||
unsigned long bmp_address;
|
|
||||||
int depth = bitmap_color_depth(bmp);
|
|
||||||
int x, y;
|
|
||||||
|
|
||||||
bmp_select(bmp);
|
|
||||||
|
|
||||||
switch (depth) {
|
|
||||||
|
|
||||||
case 8:
|
|
||||||
#if defined GFX_MODEX && !defined ALLEGRO_UNIX
|
|
||||||
if (is_planar_bitmap(bmp)) {
|
|
||||||
for (y=0; y<h; y++) {
|
|
||||||
bmp_address = (unsigned long)bmp->line[_y];
|
|
||||||
|
|
||||||
for (x=0; x<w; x++) {
|
|
||||||
outportw(0x3C4, (0x100<<((_x+x)&3))|2);
|
|
||||||
bmp_write8(bmp_address+((_x+x)>>2),
|
|
||||||
_index_cmap[(*addr) & 0xff]);
|
|
||||||
addr++;
|
|
||||||
}
|
|
||||||
|
|
||||||
_y++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
#endif
|
|
||||||
for (y=0; y<h; y++) {
|
|
||||||
bmp_address = bmp_write_line(bmp, _y)+_x;
|
|
||||||
|
|
||||||
for (x=0; x<w; x++) {
|
|
||||||
bmp_write8(bmp_address, _index_cmap[(*addr) & 0xff]);
|
|
||||||
addr++;
|
|
||||||
bmp_address++;
|
|
||||||
}
|
|
||||||
|
|
||||||
_y++;
|
|
||||||
}
|
|
||||||
#if defined GFX_MODEX && !defined ALLEGRO_UNIX
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 15:
|
|
||||||
_x <<= 1;
|
|
||||||
|
|
||||||
for (y=0; y<h; y++) {
|
|
||||||
bmp_address = bmp_write_line(bmp, _y)+_x;
|
|
||||||
|
|
||||||
for (x=0; x<w; x++) {
|
|
||||||
bmp_write15(bmp_address,
|
|
||||||
makecol15((*addr) & 0xff,
|
|
||||||
(*addr) & 0xff,
|
|
||||||
(*addr) & 0xff));
|
|
||||||
addr++;
|
|
||||||
bmp_address += 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
_y++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 16:
|
|
||||||
_x <<= 1;
|
|
||||||
|
|
||||||
for (y=0; y<h; y++) {
|
|
||||||
bmp_address = bmp_write_line(bmp, _y)+_x;
|
|
||||||
|
|
||||||
for (x=0; x<w; x++) {
|
|
||||||
bmp_write16(bmp_address,
|
|
||||||
makecol16((*addr) & 0xff,
|
|
||||||
(*addr) & 0xff,
|
|
||||||
(*addr) & 0xff));
|
|
||||||
addr++;
|
|
||||||
bmp_address += 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
_y++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 24:
|
|
||||||
_x *= 3;
|
|
||||||
|
|
||||||
for (y=0; y<h; y++) {
|
|
||||||
bmp_address = bmp_write_line(bmp, _y)+_x;
|
|
||||||
|
|
||||||
for (x=0; x<w; x++) {
|
|
||||||
bmp_write24(bmp_address,
|
|
||||||
makecol24((*addr) & 0xff,
|
|
||||||
(*addr) & 0xff,
|
|
||||||
(*addr) & 0xff));
|
|
||||||
addr++;
|
|
||||||
bmp_address += 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
_y++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 32:
|
|
||||||
_x <<= 2;
|
|
||||||
|
|
||||||
for (y=0; y<h; y++) {
|
|
||||||
bmp_address = bmp_write_line(bmp, _y)+_x;
|
|
||||||
|
|
||||||
for (x=0; x<w; x++) {
|
|
||||||
bmp_write32(bmp_address,
|
|
||||||
makeacol32((*addr) & 0xff,
|
|
||||||
(*addr) & 0xff,
|
|
||||||
(*addr) & 0xff, 255));
|
|
||||||
addr++;
|
|
||||||
bmp_address += 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
_y++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
bmp_unwrite_line(bmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<>
|
|
||||||
void ImageImpl<IndexedTraits>::to_allegro(BITMAP *bmp, int _x, int _y) const
|
|
||||||
{
|
|
||||||
#define RGB_TRIPLET \
|
|
||||||
_rgb_scale_6[_current_palette[_index_cmap[(*addr)]].r], \
|
|
||||||
_rgb_scale_6[_current_palette[_index_cmap[(*addr)]].g], \
|
|
||||||
_rgb_scale_6[_current_palette[_index_cmap[(*addr)]].b]
|
|
||||||
|
|
||||||
const_address_t addr = raw_pixels();
|
|
||||||
unsigned long bmp_address;
|
|
||||||
int depth = bitmap_color_depth(bmp);
|
|
||||||
int x, y;
|
|
||||||
|
|
||||||
bmp_select(bmp);
|
|
||||||
|
|
||||||
switch (depth) {
|
|
||||||
|
|
||||||
case 8:
|
|
||||||
#if defined GFX_MODEX && !defined ALLEGRO_UNIX
|
|
||||||
if (is_planar_bitmap (bmp)) {
|
|
||||||
for (y=0; y<h; y++) {
|
|
||||||
bmp_address = (unsigned long)bmp->line[_y];
|
|
||||||
|
|
||||||
for (x=0; x<w; x++) {
|
|
||||||
outportw(0x3C4, (0x100<<((_x+x)&3))|2);
|
|
||||||
bmp_write8(bmp_address+((_x+x)>>2), _index_cmap[(*addr)]);
|
|
||||||
address++;
|
|
||||||
}
|
|
||||||
|
|
||||||
_y++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
#endif
|
|
||||||
for (y=0; y<h; y++) {
|
|
||||||
bmp_address = bmp_write_line(bmp, _y)+_x;
|
|
||||||
|
|
||||||
for (x=0; x<w; x++) {
|
|
||||||
bmp_write8(bmp_address, _index_cmap[(*addr)]);
|
|
||||||
addr++;
|
|
||||||
bmp_address++;
|
|
||||||
}
|
|
||||||
|
|
||||||
_y++;
|
|
||||||
}
|
|
||||||
#if defined GFX_MODEX && !defined ALLEGRO_UNIX
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 15:
|
|
||||||
_x <<= 1;
|
|
||||||
|
|
||||||
for (y=0; y<h; y++) {
|
|
||||||
bmp_address = bmp_write_line(bmp, _y)+_x;
|
|
||||||
|
|
||||||
for (x=0; x<w; x++) {
|
|
||||||
bmp_write15(bmp_address, makecol15(RGB_TRIPLET));
|
|
||||||
addr++;
|
|
||||||
bmp_address += 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
_y++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 16:
|
|
||||||
_x <<= 1;
|
|
||||||
|
|
||||||
for (y=0; y<h; y++) {
|
|
||||||
bmp_address = bmp_write_line(bmp, _y)+_x;
|
|
||||||
|
|
||||||
for (x=0; x<w; x++) {
|
|
||||||
bmp_write16(bmp_address, makecol16(RGB_TRIPLET));
|
|
||||||
addr++;
|
|
||||||
bmp_address += 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
_y++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 24:
|
|
||||||
_x *= 3;
|
|
||||||
|
|
||||||
for (y=0; y<h; y++) {
|
|
||||||
bmp_address = bmp_write_line(bmp, _y)+_x;
|
|
||||||
|
|
||||||
for (x=0; x<w; x++) {
|
|
||||||
bmp_write24(bmp_address, makecol24(RGB_TRIPLET));
|
|
||||||
addr++;
|
|
||||||
bmp_address += 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
_y++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 32:
|
|
||||||
_x <<= 2;
|
|
||||||
|
|
||||||
for (y=0; y<h; y++) {
|
|
||||||
bmp_address = bmp_write_line(bmp, _y)+_x;
|
|
||||||
|
|
||||||
for (x=0; x<w; x++) {
|
|
||||||
bmp_write32(bmp_address, makeacol32(RGB_TRIPLET, 255));
|
|
||||||
addr++;
|
|
||||||
bmp_address += 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
_y++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
bmp_unwrite_line(bmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<>
|
|
||||||
void ImageImpl<BitmapTraits>::to_allegro(BITMAP *bmp, int _x, int _y) const
|
|
||||||
{
|
|
||||||
const_address_t addr;
|
|
||||||
unsigned long bmp_address;
|
|
||||||
int depth = bitmap_color_depth(bmp);
|
|
||||||
div_t d, beg_d = div(0, 8);
|
|
||||||
int color[2];
|
|
||||||
int x, y;
|
|
||||||
|
|
||||||
bmp_select(bmp);
|
|
||||||
|
|
||||||
switch (depth) {
|
|
||||||
|
|
||||||
case 8:
|
|
||||||
color[0] = makecol8(0, 0, 0);
|
|
||||||
color[1] = makecol8(255, 255, 255);
|
|
||||||
|
|
||||||
#if defined GFX_MODEX && !defined ALLEGRO_UNIX
|
|
||||||
if (is_planar_bitmap(bmp)) {
|
|
||||||
for (y=0; y<h; y++) {
|
|
||||||
addr = line_address(y);
|
|
||||||
bmp_address = (unsigned long)bmp->line[_y];
|
|
||||||
|
|
||||||
d = beg_d;
|
|
||||||
for (x=0; x<w; x++) {
|
|
||||||
outportw (0x3C4, (0x100<<((_x+x)&3))|2);
|
|
||||||
bmp_write8(bmp_addr+((_x+x)>>2),
|
|
||||||
color[((*addr) & (1<<d.rem))? 1: 0]);
|
|
||||||
_image_bitmap_next_bit(d, addr);
|
|
||||||
}
|
|
||||||
|
|
||||||
_y++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
#endif
|
|
||||||
for (y=0; y<h; y++) {
|
|
||||||
addr = line_address(y);
|
|
||||||
bmp_address = bmp_write_line(bmp, _y)+_x;
|
|
||||||
|
|
||||||
d = beg_d;
|
|
||||||
for (x=0; x<w; x++) {
|
|
||||||
bmp_write8 (bmp_address++, color[((*addr) & (1<<d.rem))? 1: 0]);
|
|
||||||
_image_bitmap_next_bit(d, addr);
|
|
||||||
}
|
|
||||||
|
|
||||||
_y++;
|
|
||||||
}
|
|
||||||
#if defined GFX_MODEX && !defined ALLEGRO_UNIX
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 15:
|
|
||||||
color[0] = makecol15(0, 0, 0);
|
|
||||||
color[1] = makecol15(255, 255, 255);
|
|
||||||
|
|
||||||
_x <<= 1;
|
|
||||||
|
|
||||||
for (y=0; y<h; y++) {
|
|
||||||
addr = line_address(y);
|
|
||||||
bmp_address = bmp_write_line(bmp, _y)+_x;
|
|
||||||
|
|
||||||
d = beg_d;
|
|
||||||
for (x=0; x<w; x++) {
|
|
||||||
bmp_write15(bmp_address, color[((*addr) & (1<<d.rem))? 1: 0]);
|
|
||||||
bmp_address += 2;
|
|
||||||
_image_bitmap_next_bit(d, addr);
|
|
||||||
}
|
|
||||||
|
|
||||||
_y++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 16:
|
|
||||||
color[0] = makecol16(0, 0, 0);
|
|
||||||
color[1] = makecol16(255, 255, 255);
|
|
||||||
|
|
||||||
_x <<= 1;
|
|
||||||
|
|
||||||
for (y=0; y<h; y++) {
|
|
||||||
addr = line_address(y);
|
|
||||||
bmp_address = bmp_write_line(bmp, _y)+_x;
|
|
||||||
|
|
||||||
d = beg_d;
|
|
||||||
for (x=0; x<w; x++) {
|
|
||||||
bmp_write16(bmp_address, color[((*addr) & (1<<d.rem))? 1: 0]);
|
|
||||||
bmp_address += 2;
|
|
||||||
_image_bitmap_next_bit(d, addr);
|
|
||||||
}
|
|
||||||
|
|
||||||
_y++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 24:
|
|
||||||
color[0] = makecol24 (0, 0, 0);
|
|
||||||
color[1] = makecol24 (255, 255, 255);
|
|
||||||
|
|
||||||
_x *= 3;
|
|
||||||
|
|
||||||
for (y=0; y<h; y++) {
|
|
||||||
addr = line_address(y);
|
|
||||||
bmp_address = bmp_write_line(bmp, _y)+_x;
|
|
||||||
|
|
||||||
d = beg_d;
|
|
||||||
for (x=0; x<w; x++) {
|
|
||||||
bmp_write24(bmp_address, color[((*addr) & (1<<d.rem))? 1: 0]);
|
|
||||||
bmp_address += 3;
|
|
||||||
_image_bitmap_next_bit (d, addr);
|
|
||||||
}
|
|
||||||
|
|
||||||
_y++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 32:
|
|
||||||
color[0] = makeacol32 (0, 0, 0, 255);
|
|
||||||
color[1] = makeacol32 (255, 255, 255, 255);
|
|
||||||
|
|
||||||
_x <<= 2;
|
|
||||||
|
|
||||||
for (y=0; y<h; y++) {
|
|
||||||
addr = line_address(y);
|
|
||||||
bmp_address = bmp_write_line(bmp, _y)+_x;
|
|
||||||
|
|
||||||
d = beg_d;
|
|
||||||
for (x=0; x<w; x++) {
|
|
||||||
bmp_write32(bmp_address, color[((*addr) & (1<<d.rem))? 1: 0]);
|
|
||||||
bmp_address += 4;
|
|
||||||
_image_bitmap_next_bit(d, addr);
|
|
||||||
}
|
|
||||||
|
|
||||||
_y++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
bmp_unwrite_line(bmp);
|
|
||||||
}
|
|
@ -490,4 +490,522 @@ void ImageImpl<BitmapTraits>::merge(const Image* src, int x, int y, int opacity,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void ImageImpl<RgbTraits>::to_allegro(BITMAP *bmp, int _x, int _y) const
|
||||||
|
{
|
||||||
|
const_address_t addr = raw_pixels();
|
||||||
|
unsigned long bmp_address;
|
||||||
|
int depth = bitmap_color_depth(bmp);
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
bmp_select(bmp);
|
||||||
|
|
||||||
|
switch (depth) {
|
||||||
|
|
||||||
|
case 8:
|
||||||
|
#if defined GFX_MODEX && !defined ALLEGRO_UNIX
|
||||||
|
if (is_planar_bitmap(bmp)) {
|
||||||
|
for (y=0; y<h; y++) {
|
||||||
|
bmp_address = (unsigned long)bmp->line[_y];
|
||||||
|
|
||||||
|
for (x=0; x<image->w; x++) {
|
||||||
|
outportw(0x3C4, (0x100<<((_x+x)&3))|2);
|
||||||
|
bmp_write8(bmp_address+((_x+x)>>2),
|
||||||
|
makecol8((*addr) & 0xff,
|
||||||
|
((*addr)>>8) & 0xff,
|
||||||
|
((*addr)>>16) & 0xff));
|
||||||
|
addr++;
|
||||||
|
}
|
||||||
|
|
||||||
|
_y++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
#endif
|
||||||
|
for (y=0; y<h; y++) {
|
||||||
|
bmp_address = bmp_write_line(bmp, _y)+_x;
|
||||||
|
|
||||||
|
for (x=0; x<w; x++) {
|
||||||
|
bmp_write8(bmp_address,
|
||||||
|
makecol8((*addr) & 0xff,
|
||||||
|
((*addr)>>8) & 0xff,
|
||||||
|
((*addr)>>16) & 0xff));
|
||||||
|
addr++;
|
||||||
|
bmp_address++;
|
||||||
|
}
|
||||||
|
|
||||||
|
_y++;
|
||||||
|
}
|
||||||
|
#if defined GFX_MODEX && !defined ALLEGRO_UNIX
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 15:
|
||||||
|
_x <<= 1;
|
||||||
|
|
||||||
|
for (y=0; y<h; y++) {
|
||||||
|
bmp_address = bmp_write_line(bmp, _y)+_x;
|
||||||
|
|
||||||
|
for (x=0; x<w; x++) {
|
||||||
|
bmp_write15(bmp_address,
|
||||||
|
makecol15((*addr) & 0xff,
|
||||||
|
((*addr)>>8) & 0xff,
|
||||||
|
((*addr)>>16) & 0xff));
|
||||||
|
addr++;
|
||||||
|
bmp_address += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
_y++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 16:
|
||||||
|
_x <<= 1;
|
||||||
|
|
||||||
|
for (y=0; y<h; y++) {
|
||||||
|
bmp_address = bmp_write_line (bmp, _y)+_x;
|
||||||
|
|
||||||
|
for (x=0; x<w; x++) {
|
||||||
|
bmp_write16(bmp_address,
|
||||||
|
makecol16((*addr) & 0xff,
|
||||||
|
((*addr)>>8) & 0xff,
|
||||||
|
((*addr)>>16) & 0xff));
|
||||||
|
addr++;
|
||||||
|
bmp_address += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
_y++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 24:
|
||||||
|
_x *= 3;
|
||||||
|
|
||||||
|
for (y=0; y<h; y++) {
|
||||||
|
bmp_address = bmp_write_line(bmp, _y)+_x;
|
||||||
|
|
||||||
|
for (x=0; x<w; x++) {
|
||||||
|
bmp_write24(bmp_address,
|
||||||
|
makecol24((*addr) & 0xff,
|
||||||
|
((*addr)>>8) & 0xff,
|
||||||
|
((*addr)>>16) & 0xff));
|
||||||
|
addr++;
|
||||||
|
bmp_address += 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
_y++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 32:
|
||||||
|
_x <<= 2;
|
||||||
|
|
||||||
|
for (y=0; y<h; y++) {
|
||||||
|
bmp_address = bmp_write_line(bmp, _y)+_x;
|
||||||
|
|
||||||
|
for (x=0; x<w; x++) {
|
||||||
|
bmp_write32(bmp_address,
|
||||||
|
makeacol32((*addr) & 0xff,
|
||||||
|
((*addr)>>8) & 0xff,
|
||||||
|
((*addr)>>16) & 0xff,
|
||||||
|
((*addr)>>24) & 0xff));
|
||||||
|
addr++;
|
||||||
|
bmp_address += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
_y++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
bmp_unwrite_line(bmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void ImageImpl<GrayscaleTraits>::to_allegro(BITMAP *bmp, int _x, int _y) const
|
||||||
|
{
|
||||||
|
const_address_t addr = raw_pixels();
|
||||||
|
unsigned long bmp_address;
|
||||||
|
int depth = bitmap_color_depth(bmp);
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
bmp_select(bmp);
|
||||||
|
|
||||||
|
switch (depth) {
|
||||||
|
|
||||||
|
case 8:
|
||||||
|
#if defined GFX_MODEX && !defined ALLEGRO_UNIX
|
||||||
|
if (is_planar_bitmap(bmp)) {
|
||||||
|
for (y=0; y<h; y++) {
|
||||||
|
bmp_address = (unsigned long)bmp->line[_y];
|
||||||
|
|
||||||
|
for (x=0; x<w; x++) {
|
||||||
|
outportw(0x3C4, (0x100<<((_x+x)&3))|2);
|
||||||
|
bmp_write8(bmp_address+((_x+x)>>2),
|
||||||
|
_index_cmap[(*addr) & 0xff]);
|
||||||
|
addr++;
|
||||||
|
}
|
||||||
|
|
||||||
|
_y++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
#endif
|
||||||
|
for (y=0; y<h; y++) {
|
||||||
|
bmp_address = bmp_write_line(bmp, _y)+_x;
|
||||||
|
|
||||||
|
for (x=0; x<w; x++) {
|
||||||
|
bmp_write8(bmp_address, _index_cmap[(*addr) & 0xff]);
|
||||||
|
addr++;
|
||||||
|
bmp_address++;
|
||||||
|
}
|
||||||
|
|
||||||
|
_y++;
|
||||||
|
}
|
||||||
|
#if defined GFX_MODEX && !defined ALLEGRO_UNIX
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 15:
|
||||||
|
_x <<= 1;
|
||||||
|
|
||||||
|
for (y=0; y<h; y++) {
|
||||||
|
bmp_address = bmp_write_line(bmp, _y)+_x;
|
||||||
|
|
||||||
|
for (x=0; x<w; x++) {
|
||||||
|
bmp_write15(bmp_address,
|
||||||
|
makecol15((*addr) & 0xff,
|
||||||
|
(*addr) & 0xff,
|
||||||
|
(*addr) & 0xff));
|
||||||
|
addr++;
|
||||||
|
bmp_address += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
_y++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 16:
|
||||||
|
_x <<= 1;
|
||||||
|
|
||||||
|
for (y=0; y<h; y++) {
|
||||||
|
bmp_address = bmp_write_line(bmp, _y)+_x;
|
||||||
|
|
||||||
|
for (x=0; x<w; x++) {
|
||||||
|
bmp_write16(bmp_address,
|
||||||
|
makecol16((*addr) & 0xff,
|
||||||
|
(*addr) & 0xff,
|
||||||
|
(*addr) & 0xff));
|
||||||
|
addr++;
|
||||||
|
bmp_address += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
_y++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 24:
|
||||||
|
_x *= 3;
|
||||||
|
|
||||||
|
for (y=0; y<h; y++) {
|
||||||
|
bmp_address = bmp_write_line(bmp, _y)+_x;
|
||||||
|
|
||||||
|
for (x=0; x<w; x++) {
|
||||||
|
bmp_write24(bmp_address,
|
||||||
|
makecol24((*addr) & 0xff,
|
||||||
|
(*addr) & 0xff,
|
||||||
|
(*addr) & 0xff));
|
||||||
|
addr++;
|
||||||
|
bmp_address += 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
_y++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 32:
|
||||||
|
_x <<= 2;
|
||||||
|
|
||||||
|
for (y=0; y<h; y++) {
|
||||||
|
bmp_address = bmp_write_line(bmp, _y)+_x;
|
||||||
|
|
||||||
|
for (x=0; x<w; x++) {
|
||||||
|
bmp_write32(bmp_address,
|
||||||
|
makeacol32((*addr) & 0xff,
|
||||||
|
(*addr) & 0xff,
|
||||||
|
(*addr) & 0xff, 255));
|
||||||
|
addr++;
|
||||||
|
bmp_address += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
_y++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
bmp_unwrite_line(bmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void ImageImpl<IndexedTraits>::to_allegro(BITMAP *bmp, int _x, int _y) const
|
||||||
|
{
|
||||||
|
#define RGB_TRIPLET \
|
||||||
|
_rgb_scale_6[_current_palette[_index_cmap[(*addr)]].r], \
|
||||||
|
_rgb_scale_6[_current_palette[_index_cmap[(*addr)]].g], \
|
||||||
|
_rgb_scale_6[_current_palette[_index_cmap[(*addr)]].b]
|
||||||
|
|
||||||
|
const_address_t addr = raw_pixels();
|
||||||
|
unsigned long bmp_address;
|
||||||
|
int depth = bitmap_color_depth(bmp);
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
bmp_select(bmp);
|
||||||
|
|
||||||
|
switch (depth) {
|
||||||
|
|
||||||
|
case 8:
|
||||||
|
#if defined GFX_MODEX && !defined ALLEGRO_UNIX
|
||||||
|
if (is_planar_bitmap (bmp)) {
|
||||||
|
for (y=0; y<h; y++) {
|
||||||
|
bmp_address = (unsigned long)bmp->line[_y];
|
||||||
|
|
||||||
|
for (x=0; x<w; x++) {
|
||||||
|
outportw(0x3C4, (0x100<<((_x+x)&3))|2);
|
||||||
|
bmp_write8(bmp_address+((_x+x)>>2), _index_cmap[(*addr)]);
|
||||||
|
address++;
|
||||||
|
}
|
||||||
|
|
||||||
|
_y++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
#endif
|
||||||
|
for (y=0; y<h; y++) {
|
||||||
|
bmp_address = bmp_write_line(bmp, _y)+_x;
|
||||||
|
|
||||||
|
for (x=0; x<w; x++) {
|
||||||
|
bmp_write8(bmp_address, _index_cmap[(*addr)]);
|
||||||
|
addr++;
|
||||||
|
bmp_address++;
|
||||||
|
}
|
||||||
|
|
||||||
|
_y++;
|
||||||
|
}
|
||||||
|
#if defined GFX_MODEX && !defined ALLEGRO_UNIX
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 15:
|
||||||
|
_x <<= 1;
|
||||||
|
|
||||||
|
for (y=0; y<h; y++) {
|
||||||
|
bmp_address = bmp_write_line(bmp, _y)+_x;
|
||||||
|
|
||||||
|
for (x=0; x<w; x++) {
|
||||||
|
bmp_write15(bmp_address, makecol15(RGB_TRIPLET));
|
||||||
|
addr++;
|
||||||
|
bmp_address += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
_y++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 16:
|
||||||
|
_x <<= 1;
|
||||||
|
|
||||||
|
for (y=0; y<h; y++) {
|
||||||
|
bmp_address = bmp_write_line(bmp, _y)+_x;
|
||||||
|
|
||||||
|
for (x=0; x<w; x++) {
|
||||||
|
bmp_write16(bmp_address, makecol16(RGB_TRIPLET));
|
||||||
|
addr++;
|
||||||
|
bmp_address += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
_y++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 24:
|
||||||
|
_x *= 3;
|
||||||
|
|
||||||
|
for (y=0; y<h; y++) {
|
||||||
|
bmp_address = bmp_write_line(bmp, _y)+_x;
|
||||||
|
|
||||||
|
for (x=0; x<w; x++) {
|
||||||
|
bmp_write24(bmp_address, makecol24(RGB_TRIPLET));
|
||||||
|
addr++;
|
||||||
|
bmp_address += 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
_y++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 32:
|
||||||
|
_x <<= 2;
|
||||||
|
|
||||||
|
for (y=0; y<h; y++) {
|
||||||
|
bmp_address = bmp_write_line(bmp, _y)+_x;
|
||||||
|
|
||||||
|
for (x=0; x<w; x++) {
|
||||||
|
bmp_write32(bmp_address, makeacol32(RGB_TRIPLET, 255));
|
||||||
|
addr++;
|
||||||
|
bmp_address += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
_y++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
bmp_unwrite_line(bmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void ImageImpl<BitmapTraits>::to_allegro(BITMAP *bmp, int _x, int _y) const
|
||||||
|
{
|
||||||
|
const_address_t addr;
|
||||||
|
unsigned long bmp_address;
|
||||||
|
int depth = bitmap_color_depth(bmp);
|
||||||
|
div_t d, beg_d = div(0, 8);
|
||||||
|
int color[2];
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
bmp_select(bmp);
|
||||||
|
|
||||||
|
switch (depth) {
|
||||||
|
|
||||||
|
case 8:
|
||||||
|
color[0] = makecol8(0, 0, 0);
|
||||||
|
color[1] = makecol8(255, 255, 255);
|
||||||
|
|
||||||
|
#if defined GFX_MODEX && !defined ALLEGRO_UNIX
|
||||||
|
if (is_planar_bitmap(bmp)) {
|
||||||
|
for (y=0; y<h; y++) {
|
||||||
|
addr = line_address(y);
|
||||||
|
bmp_address = (unsigned long)bmp->line[_y];
|
||||||
|
|
||||||
|
d = beg_d;
|
||||||
|
for (x=0; x<w; x++) {
|
||||||
|
outportw (0x3C4, (0x100<<((_x+x)&3))|2);
|
||||||
|
bmp_write8(bmp_addr+((_x+x)>>2),
|
||||||
|
color[((*addr) & (1<<d.rem))? 1: 0]);
|
||||||
|
_image_bitmap_next_bit(d, addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
_y++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
#endif
|
||||||
|
for (y=0; y<h; y++) {
|
||||||
|
addr = line_address(y);
|
||||||
|
bmp_address = bmp_write_line(bmp, _y)+_x;
|
||||||
|
|
||||||
|
d = beg_d;
|
||||||
|
for (x=0; x<w; x++) {
|
||||||
|
bmp_write8 (bmp_address++, color[((*addr) & (1<<d.rem))? 1: 0]);
|
||||||
|
_image_bitmap_next_bit(d, addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
_y++;
|
||||||
|
}
|
||||||
|
#if defined GFX_MODEX && !defined ALLEGRO_UNIX
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 15:
|
||||||
|
color[0] = makecol15(0, 0, 0);
|
||||||
|
color[1] = makecol15(255, 255, 255);
|
||||||
|
|
||||||
|
_x <<= 1;
|
||||||
|
|
||||||
|
for (y=0; y<h; y++) {
|
||||||
|
addr = line_address(y);
|
||||||
|
bmp_address = bmp_write_line(bmp, _y)+_x;
|
||||||
|
|
||||||
|
d = beg_d;
|
||||||
|
for (x=0; x<w; x++) {
|
||||||
|
bmp_write15(bmp_address, color[((*addr) & (1<<d.rem))? 1: 0]);
|
||||||
|
bmp_address += 2;
|
||||||
|
_image_bitmap_next_bit(d, addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
_y++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 16:
|
||||||
|
color[0] = makecol16(0, 0, 0);
|
||||||
|
color[1] = makecol16(255, 255, 255);
|
||||||
|
|
||||||
|
_x <<= 1;
|
||||||
|
|
||||||
|
for (y=0; y<h; y++) {
|
||||||
|
addr = line_address(y);
|
||||||
|
bmp_address = bmp_write_line(bmp, _y)+_x;
|
||||||
|
|
||||||
|
d = beg_d;
|
||||||
|
for (x=0; x<w; x++) {
|
||||||
|
bmp_write16(bmp_address, color[((*addr) & (1<<d.rem))? 1: 0]);
|
||||||
|
bmp_address += 2;
|
||||||
|
_image_bitmap_next_bit(d, addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
_y++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 24:
|
||||||
|
color[0] = makecol24 (0, 0, 0);
|
||||||
|
color[1] = makecol24 (255, 255, 255);
|
||||||
|
|
||||||
|
_x *= 3;
|
||||||
|
|
||||||
|
for (y=0; y<h; y++) {
|
||||||
|
addr = line_address(y);
|
||||||
|
bmp_address = bmp_write_line(bmp, _y)+_x;
|
||||||
|
|
||||||
|
d = beg_d;
|
||||||
|
for (x=0; x<w; x++) {
|
||||||
|
bmp_write24(bmp_address, color[((*addr) & (1<<d.rem))? 1: 0]);
|
||||||
|
bmp_address += 3;
|
||||||
|
_image_bitmap_next_bit (d, addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
_y++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 32:
|
||||||
|
color[0] = makeacol32 (0, 0, 0, 255);
|
||||||
|
color[1] = makeacol32 (255, 255, 255, 255);
|
||||||
|
|
||||||
|
_x <<= 2;
|
||||||
|
|
||||||
|
for (y=0; y<h; y++) {
|
||||||
|
addr = line_address(y);
|
||||||
|
bmp_address = bmp_write_line(bmp, _y)+_x;
|
||||||
|
|
||||||
|
d = beg_d;
|
||||||
|
for (x=0; x<w; x++) {
|
||||||
|
bmp_write32(bmp_address, color[((*addr) & (1<<d.rem))? 1: 0]);
|
||||||
|
bmp_address += 4;
|
||||||
|
_image_bitmap_next_bit(d, addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
_y++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
bmp_unwrite_line(bmp);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // RASTER_IMAGE_IMPL_H
|
#endif // RASTER_IMAGE_IMPL_H
|
||||||
|
@ -191,6 +191,15 @@ struct BitmapTraits
|
|||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template<class Traits>
|
||||||
|
inline typename Traits::address_t image_address_fast(const Image* image, int x, int y)
|
||||||
|
{
|
||||||
|
assert(x >= 0 && x < image->w);
|
||||||
|
assert(y >= 0 && y < image->h);
|
||||||
|
|
||||||
|
return ((((typename Traits::pixel_t**)image->line)[y])+x);
|
||||||
|
}
|
||||||
|
|
||||||
template<class Traits>
|
template<class Traits>
|
||||||
inline typename Traits::pixel_t image_getpixel_fast(const Image* image, int x, int y)
|
inline typename Traits::pixel_t image_getpixel_fast(const Image* image, int x, int y)
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#include "modules/palettes.h"
|
#include "modules/palettes.h"
|
||||||
#include "modules/tools.h"
|
#include "modules/tools.h"
|
||||||
#include "raster/image.h"
|
#include "raster/image.h"
|
||||||
#include "raster/image_impl.h"
|
|
||||||
#include "raster/raster.h"
|
#include "raster/raster.h"
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
@ -157,8 +156,8 @@ static void merge_zoomed_image(Image *dst, Image *src,
|
|||||||
assert(dst_x >= 0 && dst_x < dst->w);
|
assert(dst_x >= 0 && dst_x < dst->w);
|
||||||
|
|
||||||
// get addresses to each line (beginning of 'src', 'dst', etc.)
|
// get addresses to each line (beginning of 'src', 'dst', etc.)
|
||||||
src_address = ((ImageImpl<Traits>*)src)->line_address(src_y) + src_x;
|
src_address = image_address_fast<Traits>(src, src_x, src_y);
|
||||||
dst_address = ((ImageImpl<Traits>*)dst)->line_address(dst_y) + dst_x;
|
dst_address = image_address_fast<Traits>(dst, dst_x, dst_y);
|
||||||
dst_address_end = dst_address + dst_w;
|
dst_address_end = dst_address + dst_w;
|
||||||
scanline_address = scanline;
|
scanline_address = scanline;
|
||||||
|
|
||||||
@ -166,10 +165,11 @@ static void merge_zoomed_image(Image *dst, Image *src,
|
|||||||
for (x=0; x<src_w; x++) {
|
for (x=0; x<src_w; x++) {
|
||||||
assert(scanline_address >= scanline);
|
assert(scanline_address >= scanline);
|
||||||
assert(scanline_address < scanline + src_w);
|
assert(scanline_address < scanline + src_w);
|
||||||
assert(src_address >= ((ImageImpl<Traits>*)src)->line_address(src_y) + src_x);
|
|
||||||
assert(src_address < ((ImageImpl<Traits>*)src)->line_address(src_y) + src_x + src_w);
|
assert(src_address >= image_address_fast<Traits>(src, src_x, src_y));
|
||||||
assert(dst_address >= ((ImageImpl<Traits>*)dst)->line_address(dst_y) + dst_x);
|
assert(src_address <= image_address_fast<Traits>(src, src_x+src_w-1, src_y));
|
||||||
assert(dst_address < ((ImageImpl<Traits>*)dst)->line_address(dst_y) + dst_x + dst_w);
|
assert(dst_address >= image_address_fast<Traits>(dst, dst_x, dst_y));
|
||||||
|
assert(dst_address <= image_address_fast<Traits>(dst, dst_x+dst_w-1, dst_y));
|
||||||
assert(dst_address < dst_address_end);
|
assert(dst_address < dst_address_end);
|
||||||
|
|
||||||
blender(scanline_address, dst_address, src_address, opacity);
|
blender(scanline_address, dst_address, src_address, opacity);
|
||||||
@ -193,7 +193,7 @@ static void merge_zoomed_image(Image *dst, Image *src,
|
|||||||
|
|
||||||
// draw the line in `dst'
|
// draw the line in `dst'
|
||||||
for (box_y=0; box_y<line_h; box_y++) {
|
for (box_y=0; box_y<line_h; box_y++) {
|
||||||
dst_address = ((ImageImpl<Traits>*)dst)->line_address(dst_y) + dst_x;
|
dst_address = image_address_fast<Traits>(dst, dst_x, dst_y);
|
||||||
dst_address_end = dst_address + dst_w;
|
dst_address_end = dst_address + dst_w;
|
||||||
scanline_address = scanline;
|
scanline_address = scanline;
|
||||||
|
|
||||||
@ -204,8 +204,8 @@ static void merge_zoomed_image(Image *dst, Image *src,
|
|||||||
for (box_x=0; box_x<offsetx; box_x++) {
|
for (box_x=0; box_x<offsetx; box_x++) {
|
||||||
assert(scanline_address >= scanline);
|
assert(scanline_address >= scanline);
|
||||||
assert(scanline_address < scanline + src_w);
|
assert(scanline_address < scanline + src_w);
|
||||||
assert(dst_address >= ((ImageImpl<Traits>*)dst)->line_address(dst_y) + dst_x);
|
assert(dst_address >= image_address_fast<Traits>(dst, dst_x, dst_y));
|
||||||
assert(dst_address < ((ImageImpl<Traits>*)dst)->line_address(dst_y) + dst_x + dst_w);
|
assert(dst_address <= image_address_fast<Traits>(dst, dst_x+dst_w-1, dst_y));
|
||||||
assert(dst_address < dst_address_end);
|
assert(dst_address < dst_address_end);
|
||||||
|
|
||||||
(*dst_address++) = (*scanline_address);
|
(*dst_address++) = (*scanline_address);
|
||||||
@ -221,8 +221,9 @@ static void merge_zoomed_image(Image *dst, Image *src,
|
|||||||
// the rest of the line
|
// the rest of the line
|
||||||
for (; x<src_w; x++) {
|
for (; x<src_w; x++) {
|
||||||
for (box_x=0; box_x<box_w; box_x++) {
|
for (box_x=0; box_x<box_w; box_x++) {
|
||||||
assert(dst_address >= ((ImageImpl<Traits>*)dst)->line_address(dst_y) + dst_x);
|
assert(dst_address >= image_address_fast<Traits>(dst, dst_x, dst_y));
|
||||||
assert(dst_address < ((ImageImpl<Traits>*)dst)->line_address(dst_y) + dst_x + dst_w);
|
assert(dst_address <= image_address_fast<Traits>(dst, dst_x+dst_w-1, dst_y));
|
||||||
|
assert(dst_address < dst_address_end);
|
||||||
|
|
||||||
(*dst_address++) = (*scanline_address);
|
(*dst_address++) = (*scanline_address);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user