mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-20 18:40:57 +00:00
Remove Allegro dependency from several files
This commit is contained in:
parent
e8d4388061
commit
a2718f83e4
@ -20,8 +20,6 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <allegro.h>
|
|
||||||
|
|
||||||
#include "app/color.h"
|
#include "app/color.h"
|
||||||
#include "app/color_utils.h"
|
#include "app/color_utils.h"
|
||||||
#include "app/modules/palettes.h"
|
#include "app/modules/palettes.h"
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "ui/graphics.h"
|
#include "ui/graphics.h"
|
||||||
#include "ui/menu.h"
|
#include "ui/menu.h"
|
||||||
#include "ui/paint_event.h"
|
#include "ui/paint_event.h"
|
||||||
|
#include "ui/system.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
@ -36,8 +36,6 @@
|
|||||||
#define MIN_ZOOM 0
|
#define MIN_ZOOM 0
|
||||||
#define MAX_ZOOM 5
|
#define MAX_ZOOM 5
|
||||||
|
|
||||||
struct BITMAP;
|
|
||||||
|
|
||||||
namespace raster {
|
namespace raster {
|
||||||
class Sprite;
|
class Sprite;
|
||||||
class Layer;
|
class Layer;
|
||||||
|
@ -281,7 +281,7 @@ void PaletteView::onPaint(ui::PaintEvent& ev)
|
|||||||
int x, y, u, v;
|
int x, y, u, v;
|
||||||
int c, color;
|
int c, color;
|
||||||
Palette* palette = get_current_palette();
|
Palette* palette = get_current_palette();
|
||||||
int bordercolor = makecol(255, 255, 255);
|
gfx::Color bordercolor = gfx::rgba(255, 255, 255);
|
||||||
|
|
||||||
g->fillRect(gfx::rgba(0 , 0, 0), bounds);
|
g->fillRect(gfx::rgba(0 , 0, 0), bounds);
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "base/signal.h"
|
#include "base/signal.h"
|
||||||
#include "ui/widget.h"
|
#include "ui/widget.h"
|
||||||
|
|
||||||
#include <allegro/color.h>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include "gfx/color.h"
|
#include "gfx/color.h"
|
||||||
#include "gfx/fwd.h"
|
#include "gfx/fwd.h"
|
||||||
#include "ui/manager.h"
|
#include "ui/manager.h"
|
||||||
#include "ui/system.h"
|
|
||||||
#include "ui/theme.h"
|
#include "ui/theme.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
@ -45,14 +45,10 @@
|
|||||||
#include "app/util/clipboard.h"
|
#include "app/util/clipboard.h"
|
||||||
#include "app/util/misc.h"
|
#include "app/util/misc.h"
|
||||||
#include "raster/raster.h"
|
#include "raster/raster.h"
|
||||||
#include "ui/ui.h"
|
|
||||||
#include "undo/undo_history.h"
|
#include "undo/undo_history.h"
|
||||||
|
|
||||||
#include <allegro.h>
|
#if defined WIN32
|
||||||
#include <allegro/internal/aintern.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#if defined ALLEGRO_WINDOWS
|
|
||||||
#include <winalleg.h>
|
|
||||||
|
|
||||||
#include "app/util/clipboard_win32.h"
|
#include "app/util/clipboard_win32.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -18,6 +18,11 @@
|
|||||||
|
|
||||||
// included by clipboard.cpp
|
// included by clipboard.cpp
|
||||||
|
|
||||||
|
#include "raster/color_scales.h"
|
||||||
|
#include "she/display.h"
|
||||||
|
#include "she/system.h"
|
||||||
|
#include "ui/alert.h"
|
||||||
|
|
||||||
#ifndef LCS_WINDOWS_COLOR_SPACE
|
#ifndef LCS_WINDOWS_COLOR_SPACE
|
||||||
#define LCS_WINDOWS_COLOR_SPACE 'Win '
|
#define LCS_WINDOWS_COLOR_SPACE 'Win '
|
||||||
#endif
|
#endif
|
||||||
@ -54,7 +59,8 @@ static bool win32_clipboard_contains_bitmap()
|
|||||||
*/
|
*/
|
||||||
static void set_win32_clipboard_bitmap(Image* image, Palette* palette)
|
static void set_win32_clipboard_bitmap(Image* image, Palette* palette)
|
||||||
{
|
{
|
||||||
if (!OpenClipboard(win_get_window()))
|
HWND hwnd = static_cast<HWND>(she::instance()->defaultDisplay()->nativeHandle());
|
||||||
|
if (!OpenClipboard(hwnd))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!EmptyClipboard()) {
|
if (!EmptyClipboard()) {
|
||||||
@ -183,7 +189,8 @@ static void get_win32_clipboard_bitmap(Image*& image, Palette*& palette)
|
|||||||
if (!win32_clipboard_contains_bitmap())
|
if (!win32_clipboard_contains_bitmap())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!OpenClipboard(win_get_window()))
|
HWND hwnd = static_cast<HWND>(she::instance()->defaultDisplay()->nativeHandle());
|
||||||
|
if (!OpenClipboard(hwnd))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BITMAPINFO* bi = (BITMAPINFO*)GetClipboardData(CF_DIB);
|
BITMAPINFO* bi = (BITMAPINFO*)GetClipboardData(CF_DIB);
|
||||||
@ -278,9 +285,9 @@ static void get_win32_clipboard_bitmap(Image*& image, Palette*& palette)
|
|||||||
for (int x=0; x<image->width(); ++x) {
|
for (int x=0; x<image->width(); ++x) {
|
||||||
b1 = *(src++);
|
b1 = *(src++);
|
||||||
b2 = *(src++);
|
b2 = *(src++);
|
||||||
b = _rgb_scale_5[((b1 & 0xf800) >> 11)];
|
b = scale_5bits_to_8bits((b1 & 0xf800) >> 11);
|
||||||
g = _rgb_scale_6[((b2 & 0x07e0) >> 5)];
|
g = scale_6bits_to_8bits((b2 & 0x07e0) >> 5);
|
||||||
r = _rgb_scale_5[(b2 & 0x001f)];
|
r = scale_5bits_to_8bits(b2 & 0x001f);
|
||||||
put_pixel_fast<RgbTraits>(image, x, y, rgba(r, g, b, 255));
|
put_pixel_fast<RgbTraits>(image, x, y, rgba(r, g, b, 255));
|
||||||
}
|
}
|
||||||
src += padding;
|
src += padding;
|
||||||
@ -339,8 +346,9 @@ static bool get_win32_clipboard_bitmap_size(gfx::Size& size)
|
|||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
if (win32_clipboard_contains_bitmap() &&
|
HWND hwnd = static_cast<HWND>(she::instance()->defaultDisplay()->nativeHandle());
|
||||||
OpenClipboard(win_get_window())) {
|
|
||||||
|
if (win32_clipboard_contains_bitmap() && OpenClipboard(hwnd)) {
|
||||||
BITMAPINFO* bi = (BITMAPINFO*)GetClipboardData(CF_DIB);
|
BITMAPINFO* bi = (BITMAPINFO*)GetClipboardData(CF_DIB);
|
||||||
if (bi) {
|
if (bi) {
|
||||||
size.w = bi->bmiHeader.biWidth;
|
size.w = bi->bmiHeader.biWidth;
|
||||||
|
@ -20,9 +20,10 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <allegro.h>
|
|
||||||
|
|
||||||
#include "app/util/pic_file.h"
|
#include "app/util/pic_file.h"
|
||||||
|
#include "base/cfile.h"
|
||||||
|
#include "base/file_handle.h"
|
||||||
|
#include "base/fs.h"
|
||||||
#include "base/unique_ptr.h"
|
#include "base/unique_ptr.h"
|
||||||
#include "raster/image.h"
|
#include "raster/image.h"
|
||||||
#include "raster/mask.h"
|
#include "raster/mask.h"
|
||||||
@ -34,29 +35,22 @@ using namespace raster;
|
|||||||
// Loads a MSK file (Animator and Animator Pro format)
|
// Loads a MSK file (Animator and Animator Pro format)
|
||||||
Mask* load_msk_file(const char* filename)
|
Mask* load_msk_file(const char* filename)
|
||||||
{
|
{
|
||||||
#if (MAKE_VERSION(4, 2, 1) >= MAKE_VERSION(ALLEGRO_VERSION, \
|
int orig_size = base::file_size(filename);
|
||||||
ALLEGRO_SUB_VERSION, \
|
|
||||||
ALLEGRO_WIP_VERSION))
|
|
||||||
int orig_size = file_size(filename);
|
|
||||||
#else
|
|
||||||
int orig_size = file_size_ex(filename);
|
|
||||||
#endif
|
|
||||||
int i, c, u, v, byte, magic, size;
|
int i, c, u, v, byte, magic, size;
|
||||||
Mask *mask = NULL;
|
Mask* mask = NULL;
|
||||||
PACKFILE *f;
|
|
||||||
|
|
||||||
f = pack_fopen(filename, F_READ);
|
FILE* f = base::open_file_raw(filename, "r");
|
||||||
if (!f)
|
if (!f)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
size = pack_igetl(f);
|
size = base::fgetl(f);
|
||||||
magic = pack_igetw(f);
|
magic = base::fgetw(f);
|
||||||
|
|
||||||
// Animator Pro MSK format
|
// Animator Pro MSK format
|
||||||
if ((size == orig_size) && (magic == 0x9500)) {
|
if ((size == orig_size) && (magic == 0x9500)) {
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
pack_fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
// Just load an Animator Pro PIC file
|
// Just load an Animator Pro PIC file
|
||||||
base::UniquePtr<Image> image(load_pic_file(filename, &x, &y, NULL));
|
base::UniquePtr<Image> image(load_pic_file(filename, &x, &y, NULL));
|
||||||
@ -70,7 +64,7 @@ Mask* load_msk_file(const char* filename)
|
|||||||
|
|
||||||
u = v = 0;
|
u = v = 0;
|
||||||
for (i=0; i<8000; i++) {
|
for (i=0; i<8000; i++) {
|
||||||
byte = pack_getc (f);
|
byte = getc(f);
|
||||||
for (c=0; c<8; c++) {
|
for (c=0; c<8; c++) {
|
||||||
mask->bitmap()->putPixel(u, v, byte & (1<<(7-c)));
|
mask->bitmap()->putPixel(u, v, byte & (1<<(7-c)));
|
||||||
u++;
|
u++;
|
||||||
@ -80,10 +74,10 @@ Mask* load_msk_file(const char* filename)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pack_fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pack_fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mask;
|
return mask;
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
|
|
||||||
#include "tinyxml.h"
|
#include "tinyxml.h"
|
||||||
|
|
||||||
#include <allegro.h>
|
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
@ -177,11 +176,11 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget
|
|||||||
for (c=0; c<4; ++c)
|
for (c=0; c<4; ++c)
|
||||||
b[c] = 0;
|
b[c] = 0;
|
||||||
|
|
||||||
for (tok=ustrtok(bevel, " "), c=0;
|
for (tok=strtok(bevel, " "), c=0;
|
||||||
tok;
|
tok;
|
||||||
tok=ustrtok(NULL, " "), ++c) {
|
tok=strtok(NULL, " "), ++c) {
|
||||||
if (c < 4)
|
if (c < 4)
|
||||||
b[c] = ustrtol(tok, NULL, 10);
|
b[c] = strtol(tok, NULL, 10);
|
||||||
}
|
}
|
||||||
base_free(bevel);
|
base_free(bevel);
|
||||||
|
|
||||||
@ -545,34 +544,34 @@ static int convert_align_value_to_flags(const char *value)
|
|||||||
char *tok, *ptr = base_strdup(value);
|
char *tok, *ptr = base_strdup(value);
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
|
|
||||||
for (tok=ustrtok(ptr, " ");
|
for (tok=strtok(ptr, " ");
|
||||||
tok != NULL;
|
tok != NULL;
|
||||||
tok=ustrtok(NULL, " ")) {
|
tok=strtok(NULL, " ")) {
|
||||||
if (ustrcmp(tok, "horizontal") == 0) {
|
if (strcmp(tok, "horizontal") == 0) {
|
||||||
flags |= JI_HORIZONTAL;
|
flags |= JI_HORIZONTAL;
|
||||||
}
|
}
|
||||||
else if (ustrcmp(tok, "vertical") == 0) {
|
else if (strcmp(tok, "vertical") == 0) {
|
||||||
flags |= JI_VERTICAL;
|
flags |= JI_VERTICAL;
|
||||||
}
|
}
|
||||||
else if (ustrcmp(tok, "left") == 0) {
|
else if (strcmp(tok, "left") == 0) {
|
||||||
flags |= JI_LEFT;
|
flags |= JI_LEFT;
|
||||||
}
|
}
|
||||||
else if (ustrcmp(tok, "center") == 0) {
|
else if (strcmp(tok, "center") == 0) {
|
||||||
flags |= JI_CENTER;
|
flags |= JI_CENTER;
|
||||||
}
|
}
|
||||||
else if (ustrcmp(tok, "right") == 0) {
|
else if (strcmp(tok, "right") == 0) {
|
||||||
flags |= JI_RIGHT;
|
flags |= JI_RIGHT;
|
||||||
}
|
}
|
||||||
else if (ustrcmp(tok, "top") == 0) {
|
else if (strcmp(tok, "top") == 0) {
|
||||||
flags |= JI_TOP;
|
flags |= JI_TOP;
|
||||||
}
|
}
|
||||||
else if (ustrcmp(tok, "middle") == 0) {
|
else if (strcmp(tok, "middle") == 0) {
|
||||||
flags |= JI_MIDDLE;
|
flags |= JI_MIDDLE;
|
||||||
}
|
}
|
||||||
else if (ustrcmp(tok, "bottom") == 0) {
|
else if (strcmp(tok, "bottom") == 0) {
|
||||||
flags |= JI_BOTTOM;
|
flags |= JI_BOTTOM;
|
||||||
}
|
}
|
||||||
else if (ustrcmp(tok, "homogeneous") == 0) {
|
else if (strcmp(tok, "homogeneous") == 0) {
|
||||||
flags |= JI_HOMOGENEOUS;
|
flags |= JI_HOMOGENEOUS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user