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