mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-28 06:39:53 +00:00
Use new laf + skia m81 branch
* Some minor refactors due laf changes. * Updated the instructions to compile Aseprite linking to external skia instructions and pre-built packages.
This commit is contained in:
parent
eaa2dd14b6
commit
95b655168c
176
INSTALL.md
176
INSTALL.md
@ -12,10 +12,6 @@
|
||||
* [Issues with Retina displays](#issues-with-retina-displays)
|
||||
* [Linux details](#linux-details)
|
||||
* [Using shared third party libraries](#using-shared-third-party-libraries)
|
||||
* [Building Skia dependency](#building-skia-dependency)
|
||||
* [Skia on Windows](#skia-on-windows)
|
||||
* [Skia on macOS](#skia-on-macos)
|
||||
* [Skia on Linux](#skia-on-linux)
|
||||
|
||||
# Platforms
|
||||
|
||||
@ -54,32 +50,24 @@ To compile Aseprite you will need:
|
||||
|
||||
* The latest version of [CMake](https://cmake.org) (3.14 or greater)
|
||||
* [Ninja](https://ninja-build.org) build system
|
||||
* You will need a compiled version of the Skia library.
|
||||
Please check the details about [how to build Skia](#building-skia-dependency)
|
||||
on your platform.
|
||||
* And a compiled version of the `aseprite-m81` branch of
|
||||
the [Skia library](https://github.com/aseprite/skia#readme).
|
||||
There are [pre-built packages available](https://github.com/aseprite/skia/releases).
|
||||
You can get some extra information in
|
||||
the [*laf* dependencies](https://github.com/aseprite/laf#dependencies) page.
|
||||
|
||||
## Windows dependencies
|
||||
|
||||
First of all, you will need:
|
||||
|
||||
* Windows 10 (**we don't support cross-compiling and don't know if this would be possible**)
|
||||
* [Visual Studio Community 2019](https://visualstudio.microsoft.com/downloads/)
|
||||
* The [Desktop development with C++ item + Windows 10.0.17763.0 SDK](https://imgur.com/4Pq2Cbv)
|
||||
from the Visual Studio installer
|
||||
|
||||
You will need to [compile Skia](#skia-on-windows) before and then
|
||||
continue in the [Compiling](#compiling) section. Remember to check the
|
||||
[Windows details](#windows-details) section to know how to call
|
||||
`cmake` correctly.
|
||||
|
||||
## macOS dependencies
|
||||
|
||||
On macOS you will need macOS 10.14 SDK and Xcode 10.2.1 (older
|
||||
On macOS you will need macOS 10.15 SDK and Xcode 11.2.1 (older
|
||||
versions might work).
|
||||
|
||||
You must also compile [Skia](#skia-on-macos) before starting with the
|
||||
[compilation](#compiling).
|
||||
|
||||
## Linux dependencies
|
||||
|
||||
You will need the following dependencies on Ubuntu/Debian:
|
||||
@ -88,10 +76,7 @@ You will need the following dependencies on Ubuntu/Debian:
|
||||
|
||||
On Fedora:
|
||||
|
||||
sudo yum install -y gcc-c++ cmake ninja-build libX11-devel libXcursor-devel mesa-libGL-devel fontconfig-devel
|
||||
|
||||
You must also compile [Skia](#skia-on-linux) before starting with the
|
||||
[compilation](#compiling).
|
||||
sudo dnf install -y gcc-c++ cmake ninja-build libX11-devel libXcursor-devel mesa-libGL-devel fontconfig-devel
|
||||
|
||||
# Compiling
|
||||
|
||||
@ -109,7 +94,7 @@ You must also compile [Skia](#skia-on-linux) before starting with the
|
||||
2. Enter in the new directory and execute `cmake`:
|
||||
|
||||
cd C:\aseprite\build
|
||||
cmake -G Ninja ..
|
||||
cmake -G Ninja -DLAF_BACKEND=skia ..
|
||||
|
||||
Here `cmake` needs different options depending on your
|
||||
platform. You must check the details for
|
||||
@ -129,8 +114,7 @@ You must also compile [Skia](#skia-on-linux) before starting with the
|
||||
|
||||
## Windows details
|
||||
|
||||
After you've [compiled Skia](#skia-on-windows),
|
||||
open a [developer command prompt](https://docs.microsoft.com/en-us/dotnet/framework/tools/developer-command-prompt-for-vs)
|
||||
Open a [developer command prompt](https://docs.microsoft.com/en-us/dotnet/framework/tools/developer-command-prompt-for-vs)
|
||||
or in the command line (`cmd.exe`) call:
|
||||
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat" -arch=x64
|
||||
@ -140,16 +124,15 @@ And then
|
||||
cd aseprite
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLAF_OS_BACKEND=skia -DSKIA_DIR=C:\deps\skia -DSKIA_OUT_DIR=C:\deps\skia\out\Release -G Ninja ..
|
||||
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLAF_BACKEND=skia -DSKIA_DIR=C:\deps\skia -DSKIA_LIBRARY_DIR=C:\deps\skia\out\Release-x64 -G Ninja ..
|
||||
ninja aseprite
|
||||
|
||||
In this case, `C:\deps\skia` is the directory where Skia was compiled
|
||||
as described in [Skia on Windows](#skia-on-windows) section.
|
||||
or uncompressed.
|
||||
|
||||
## macOS details
|
||||
|
||||
After [compiling Skia](#skia-on-macos), you should run `cmake` with
|
||||
the following parameters and then `ninja`:
|
||||
Run `cmake` with the following parameters and then `ninja`:
|
||||
|
||||
cd aseprite
|
||||
mkdir build
|
||||
@ -158,19 +141,18 @@ the following parameters and then `ninja`:
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 \
|
||||
-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk \
|
||||
-DLAF_OS_BACKEND=skia \
|
||||
-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk \
|
||||
-DLAF_BACKEND=skia \
|
||||
-DSKIA_DIR=$HOME/deps/skia \
|
||||
-DSKIA_OUT_DIR=$HOME/deps/skia/out/Release \
|
||||
-DSKIA_LIBRARY_DIR=$HOME/deps/skia/out/Release-x64 \
|
||||
-G Ninja \
|
||||
..
|
||||
ninja aseprite
|
||||
|
||||
In this case, `$HOME/deps/skia` is the directory where Skia was
|
||||
compiled as described in [Skia on macOS](#skia-on-macos) section.
|
||||
Make sure that `CMAKE_OSX_SYSROOT` is pointing to the correct SDK
|
||||
directory (in this case
|
||||
`/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk`),
|
||||
compiled or downloaded. Make sure that `CMAKE_OSX_SYSROOT` is
|
||||
pointing to the correct SDK directory (in this case
|
||||
`/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk`),
|
||||
but it could be different in your Mac.
|
||||
|
||||
### Issues with Retina displays
|
||||
@ -181,23 +163,22 @@ If you have a Retina display, check the following issue:
|
||||
|
||||
## Linux details
|
||||
|
||||
First you have to [compile Skia](#skia-on-linux), then you should run
|
||||
`cmake` with the following parameters and then `ninja`:
|
||||
Run `cmake` with the following parameters and then `ninja`:
|
||||
|
||||
cd aseprite
|
||||
mkdir build
|
||||
cd build
|
||||
cmake \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DLAF_OS_BACKEND=skia \
|
||||
-DLAF_BACKEND=skia \
|
||||
-DSKIA_DIR=$HOME/deps/skia \
|
||||
-DSKIA_OUT_DIR=$HOME/deps/skia/out/Release \
|
||||
-DSKIA_LIBRARY_DIR=$HOME/deps/skia/out/Release-x64 \
|
||||
-G Ninja \
|
||||
..
|
||||
ninja aseprite
|
||||
|
||||
In this case, `$HOME/deps/skia` is the directory where Skia was
|
||||
compiled as described in [Skia on Linux](#skia-on-linux) section.
|
||||
compiled or uncompressed.
|
||||
|
||||
# Using shared third party libraries
|
||||
|
||||
@ -208,116 +189,3 @@ configuring each `USE_SHARED_` option.
|
||||
After running `cmake -G`, you can edit `build/CMakeCache.txt` file,
|
||||
and enable the `USE_SHARED_` flag (set its value to `ON`) of the
|
||||
library that you want to be linked dynamically.
|
||||
|
||||
# Building Skia dependency
|
||||
|
||||
When you compile Aseprite with [Skia](https://skia.org) as back-end on
|
||||
Windows or macOS, you need to compile a specific version of Skia. In
|
||||
the following sections you will find straightforward steps to compile
|
||||
Skia.
|
||||
|
||||
You can always check the
|
||||
[official Skia instructions](https://skia.org/user/build) and select
|
||||
the OS you are building for. Aseprite uses the `aseprite-m71` Skia
|
||||
branch from `https://github.com/aseprite/skia`.
|
||||
|
||||
## Skia on Windows
|
||||
|
||||
Download
|
||||
[Google depot tools](https://storage.googleapis.com/chrome-infra/depot_tools.zip)
|
||||
and uncompress it in some place like `C:\deps\depot_tools`.
|
||||
|
||||
[It's recommended to compile Skia with Clang](https://github.com/google/skia/blob/master/site/user/build.md#a-note-on-software-backend-performance)
|
||||
to get better performance. So you will need to [download Clang](http://releases.llvm.org/8.0.0/LLVM-8.0.0-win64.exe),
|
||||
and install it on a folder like `C:\deps\llvm` (a folder without whitespaces).
|
||||
|
||||
Open a [developer command prompt](https://docs.microsoft.com/en-us/dotnet/framework/tools/developer-command-prompt-for-vs)
|
||||
or command line (`cmd.exe`) and call:
|
||||
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat" -arch=x64
|
||||
|
||||
Then:
|
||||
|
||||
set PATH=C:\deps\depot_tools;%PATH%
|
||||
cd C:\deps\depot_tools
|
||||
gclient sync
|
||||
|
||||
(The `gclient` command might print an error like
|
||||
`Error: client not configured; see 'gclient config'`.
|
||||
Just ignore it.)
|
||||
|
||||
cd C:\deps
|
||||
git clone -b aseprite-m71 https://github.com/aseprite/skia.git
|
||||
cd skia
|
||||
set GIT_EXECUTABLE=git.bat
|
||||
python tools/git-sync-deps
|
||||
|
||||
(The `tools/git-sync-deps` will take some minutes because it downloads
|
||||
a lot of packages, please wait and re-run the same command in case it
|
||||
fails.)
|
||||
|
||||
Finally, if you've downloaded Clang, use this command:
|
||||
|
||||
set PATH=C:\deps\llvm\bin;%PATH%
|
||||
gn gen out/Release --args="is_official_build=true skia_use_system_expat=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false target_cpu=""x64"" cc=""clang"" cxx=""clang++"" clang_win=""c:\deps\llvm"" win_vc=""C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC"""
|
||||
ninja -C out/Release skia
|
||||
|
||||
If you haven't installed Clang, and want to compile Skia with MSVC
|
||||
(anyway it's not recommended because the performance penalty is too
|
||||
big), you can use the following commands instead:
|
||||
|
||||
gn gen out/Release --args="is_official_build=true skia_use_system_expat=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false target_cpu=""x64"" win_vc=""C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC"""
|
||||
ninja -C out/Release skia
|
||||
|
||||
More information about these steps in the
|
||||
[official Skia documentation](https://skia.org/user/build).
|
||||
|
||||
## Skia on macOS
|
||||
|
||||
These steps will create a `deps` folder in your home directory with a
|
||||
couple of subdirectories needed to build Skia (you can change the
|
||||
`$HOME/deps` with other directory). Some of these commands will take
|
||||
several minutes to finish:
|
||||
|
||||
mkdir $HOME/deps
|
||||
cd $HOME/deps
|
||||
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
git clone -b aseprite-m71 https://github.com/aseprite/skia.git
|
||||
export PATH="${PWD}/depot_tools:${PATH}"
|
||||
cd skia
|
||||
python tools/git-sync-deps
|
||||
gn gen out/Release --args="is_official_build=true skia_use_system_expat=false skia_use_system_icu=false skia_use_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false extra_cflags_cc=[\"-frtti\"]"
|
||||
ninja -C out/Release skia
|
||||
|
||||
After this you should have all Skia libraries compiled. When you
|
||||
[compile Aseprite](#compiling), remember to add
|
||||
`-DSKIA_DIR=$HOME/deps/skia` parameter to your `cmake` call as
|
||||
described in the [macOS details](#macos-details) section.
|
||||
|
||||
More information about these steps in the
|
||||
[official Skia documentation](https://skia.org/user/build).
|
||||
|
||||
## Skia on Linux
|
||||
|
||||
These steps will create a `deps` folder in your home directory with a
|
||||
couple of subdirectories needed to build Skia (you can change the
|
||||
`$HOME/deps` with other directory). Some of these commands will take
|
||||
several minutes to finish:
|
||||
|
||||
mkdir $HOME/deps
|
||||
cd $HOME/deps
|
||||
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
git clone -b aseprite-m71 https://github.com/aseprite/skia.git
|
||||
export PATH="${PWD}/depot_tools:${PATH}"
|
||||
cd skia
|
||||
python tools/git-sync-deps
|
||||
gn gen out/Release --args="is_debug=false is_official_build=true skia_use_system_expat=false skia_use_system_icu=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false"
|
||||
ninja -C out/Release skia
|
||||
|
||||
After this you should have all Skia libraries compiled. When you
|
||||
[compile Aseprite](#compiling), remember to add
|
||||
`-DSKIA_DIR=$HOME/deps/skia` parameter to your `cmake` call as
|
||||
described in the [Linux details](#linux-details) section.
|
||||
|
||||
More information about these steps in the
|
||||
[official Skia documentation](https://skia.org/user/build).
|
||||
|
2
laf
2
laf
@ -1 +1 @@
|
||||
Subproject commit 60b2e83ce159a79368141c5386a764e16ede0c27
|
||||
Subproject commit 29d275d47087acb897f3d4791a055963934906a1
|
@ -1,5 +1,5 @@
|
||||
# Aseprite
|
||||
# Copyright (C) 2019 Igara Studio S.A.
|
||||
# Copyright (C) 2019-2020 Igara Studio S.A.
|
||||
# Copyright (C) 2001-2018 David Capello
|
||||
|
||||
######################################################################
|
||||
@ -182,6 +182,7 @@ if(ENABLE_ASEPRITE_EXE)
|
||||
if(WIN32 AND ENABLE_UI)
|
||||
set_target_properties(aseprite PROPERTIES WIN32_EXECUTABLE true)
|
||||
endif()
|
||||
set_target_properties(aseprite PROPERTIES LINK_FLAGS "${LAF_BACKEND_LINK_FLAGS}")
|
||||
target_link_libraries(aseprite app-lib)
|
||||
add_dependencies(aseprite copy_data)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2018-2019 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -636,7 +636,7 @@ void App::updateDisplayTitleBar()
|
||||
}
|
||||
|
||||
title += defaultTitle;
|
||||
os::instance()->defaultDisplay()->setTitleBar(title);
|
||||
os::instance()->defaultDisplay()->setTitle(title);
|
||||
}
|
||||
|
||||
InputChain& App::inputChain()
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2018-2019 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -217,18 +217,19 @@ void draw_alpha_slider(os::Surface* s,
|
||||
color.getGreen(),
|
||||
color.getBlue(), 255): 0);
|
||||
|
||||
os::Paint paint;
|
||||
for (int x=0; x<rc.w; ++x) {
|
||||
const int a = (255 * x / xmax);
|
||||
const doc::color_t c1 = doc::rgba_blender_normal(gridColor1, c, a);
|
||||
const doc::color_t c2 = doc::rgba_blender_normal(gridColor2, c, a);
|
||||
const int mid = rc.h/2;
|
||||
const int odd = (x / rc.h) & 1;
|
||||
s->drawVLine(
|
||||
app::color_utils::color_for_ui(app::Color::fromImage(IMAGE_RGB, odd ? c2: c1)),
|
||||
rc.x+x, rc.y, mid);
|
||||
s->drawVLine(
|
||||
app::color_utils::color_for_ui(app::Color::fromImage(IMAGE_RGB, odd ? c1: c2)),
|
||||
rc.x+x, rc.y+mid, rc.h-mid);
|
||||
|
||||
paint.color(app::color_utils::color_for_ui(app::Color::fromImage(IMAGE_RGB, odd ? c2: c1)));
|
||||
s->drawRect(gfx::Rect(rc.x+x, rc.y, 1, mid), paint);
|
||||
|
||||
paint.color(app::color_utils::color_for_ui(app::Color::fromImage(IMAGE_RGB, odd ? c1: c2)));
|
||||
s->drawRect(gfx::Rect(rc.x+x, rc.y+mid, 1, rc.h-mid), paint);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2018 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2016-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -113,7 +113,10 @@ public:
|
||||
|
||||
auto oldCanvas = m_canvas;
|
||||
m_canvas = os::instance()->createSurface(w, h, activeCS);
|
||||
m_canvas->fillRect(bgColor, gfx::Rect(0, 0, w, h));
|
||||
os::Paint paint;
|
||||
paint.color(bgColor);
|
||||
paint.style(os::Paint::Fill);
|
||||
m_canvas->drawRect(gfx::Rect(0, 0, w, h), paint);
|
||||
if (oldCanvas) {
|
||||
m_canvas->drawSurface(oldCanvas, 0, 0);
|
||||
oldCanvas->dispose();
|
||||
|
@ -1,4 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -111,11 +112,12 @@ void ColorSpectrum::onPaintSurfaceInBgThread(
|
||||
if (m_paintFlags & BottomBarFlag) {
|
||||
double lit = m_color.getHslLightness();
|
||||
double hue = m_color.getHslHue();
|
||||
os::Paint paint;
|
||||
for (int x=0; x<bottom.w && !stop; ++x) {
|
||||
gfx::Color color = color_utils::color_for_ui(
|
||||
app::Color::fromHsl(hue, double(x) / double(bottom.w), lit));
|
||||
|
||||
s->drawVLine(color, bottom.x+x, bottom.y, bottom.h);
|
||||
paint.color(
|
||||
color_utils::color_for_ui(
|
||||
app::Color::fromHsl(hue, double(x) / double(bottom.w), lit)));
|
||||
s->drawRect(gfx::Rect(bottom.x+x, bottom.y, 1, bottom.h), paint);
|
||||
}
|
||||
if (stop)
|
||||
return;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2020 Igara Studio S.A.
|
||||
// Copyright (C) 2016-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -100,12 +101,14 @@ void ColorTintShadeTone::onPaintSurfaceInBgThread(
|
||||
}
|
||||
|
||||
if (m_paintFlags & BottomBarFlag) {
|
||||
os::Paint paint;
|
||||
for (int x=0; x<bottom.w && !stop; ++x) {
|
||||
gfx::Color color = color_utils::color_for_ui(
|
||||
app::Color::fromHsv(
|
||||
(360.0 * x / bottom.w), 1.0, 1.0));
|
||||
paint.color(
|
||||
color_utils::color_for_ui(
|
||||
app::Color::fromHsv(
|
||||
(360.0 * x / bottom.w), 1.0, 1.0)));
|
||||
|
||||
s->drawVLine(color, bottom.x+x, bottom.y, bottom.h);
|
||||
s->drawRect(gfx::Rect(bottom.x+x, bottom.y, 1, bottom.h), paint);
|
||||
}
|
||||
if (stop)
|
||||
return;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -275,12 +276,13 @@ void ColorWheel::onPaintSurfaceInBgThread(os::Surface* s,
|
||||
if (m_paintFlags & BottomBarFlag) {
|
||||
double hue = m_color.getHsvHue();
|
||||
double sat = m_color.getHsvSaturation();
|
||||
|
||||
os::Paint paint;
|
||||
for (int x=0; x<bottom.w && !stop; ++x) {
|
||||
gfx::Color color = color_utils::color_for_ui(
|
||||
app::Color::fromHsv(hue, sat, double(x) / double(bottom.w)));
|
||||
paint.color(
|
||||
color_utils::color_for_ui(
|
||||
app::Color::fromHsv(hue, sat, double(x) / double(bottom.w))));
|
||||
|
||||
s->drawVLine(color, bottom.x+x, bottom.y, bottom.h);
|
||||
s->drawRect(gfx::Rect(bottom.x+x, bottom.y, 1, bottom.h), paint);
|
||||
}
|
||||
if (stop)
|
||||
return;
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2018 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2020 Igara Studio S.A.
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -142,8 +142,10 @@ private:
|
||||
|
||||
{
|
||||
os::SurfaceLock lock(surface);
|
||||
surface->fillRect(gfx::rgba(0, 0, 0, 0),
|
||||
gfx::Rect(0, 0, surface->width(), surface->height()));
|
||||
os::Paint paint;
|
||||
paint.color(gfx::rgba(0, 0, 0, 0));
|
||||
paint.style(os::Paint::Fill);
|
||||
surface->drawRect(gfx::Rect(0, 0, surface->width(), surface->height()), paint);
|
||||
}
|
||||
{
|
||||
ui::Graphics g(surface, 0, 0);
|
||||
|
@ -693,7 +693,9 @@ void Editor::drawOneSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& sprite
|
||||
// internal state of a SkCanvas or SkBitmap thing is
|
||||
// updated after this, because convert_image_to_surface()
|
||||
// will overwrite these pixels anyway.
|
||||
tmp->drawRect(gfx::rgba(0, 0, 0, 255), gfx::Rect(0, 0, 1, 1));
|
||||
os::Paint paint;
|
||||
paint.color(gfx::rgba(0, 0, 0, 255));
|
||||
tmp->drawRect(gfx::Rect(0, 0, 1, 1), paint);
|
||||
}
|
||||
|
||||
convert_image_to_surface(rendered.get(), m_sprite->palette(m_frame),
|
||||
|
@ -1,4 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -51,7 +52,7 @@ FontData::~FontData()
|
||||
|
||||
os::Font* FontData::getFont(int size)
|
||||
{
|
||||
if (m_type == os::FontType::kSpriteSheet)
|
||||
if (m_type == os::FontType::SpriteSheet)
|
||||
size = 1; // Same size always
|
||||
|
||||
// Use cache
|
||||
@ -63,10 +64,10 @@ os::Font* FontData::getFont(int size)
|
||||
os::Font* font = nullptr;
|
||||
|
||||
switch (m_type) {
|
||||
case os::FontType::kSpriteSheet:
|
||||
case os::FontType::SpriteSheet:
|
||||
font = os::instance()->loadSpriteSheetFont(m_filename.c_str(), size);
|
||||
break;
|
||||
case os::FontType::kTrueType: {
|
||||
case os::FontType::FreeType: {
|
||||
font = os::instance()->loadTrueTypeFont(m_filename.c_str(), size);
|
||||
if (font)
|
||||
font->setAntialias(m_antialias);
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2019 Igara Studio S.A.
|
||||
// Copyright (C) 2019-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -113,7 +113,7 @@ static FontData* load_font(std::map<std::string, FontData*>& fonts,
|
||||
if (type == "spritesheet") {
|
||||
const char* fileStr = xmlFont->Attribute("file");
|
||||
if (fileStr) {
|
||||
font.reset(new FontData(os::FontType::kSpriteSheet));
|
||||
font.reset(new FontData(os::FontType::SpriteSheet));
|
||||
font->setFilename(base::join_path(xmlDir, fileStr));
|
||||
}
|
||||
}
|
||||
@ -143,7 +143,7 @@ static FontData* load_font(std::map<std::string, FontData*>& fonts,
|
||||
// The filename can be empty if the font was not found, anyway we
|
||||
// want to keep the font information (e.g. to use the fallback
|
||||
// information of this font).
|
||||
font.reset(new FontData(os::FontType::kTrueType));
|
||||
font.reset(new FontData(os::FontType::FreeType));
|
||||
font->setFilename(fontFilename);
|
||||
font->setAntialias(antialias);
|
||||
|
||||
@ -934,7 +934,7 @@ int SkinTheme::getScrollbarSize()
|
||||
|
||||
gfx::Size SkinTheme::getEntryCaretSize(Widget* widget)
|
||||
{
|
||||
if (widget->font()->type() == os::FontType::kTrueType)
|
||||
if (widget->font()->type() == os::FontType::FreeType)
|
||||
return gfx::Size(2*guiscale(), widget->textHeight());
|
||||
else
|
||||
return gfx::Size(2*guiscale(), widget->textHeight()+2*guiscale());
|
||||
@ -986,7 +986,8 @@ public:
|
||||
void preProcessChar(const int index,
|
||||
const int codepoint,
|
||||
gfx::Color& fg,
|
||||
gfx::Color& bg) override {
|
||||
gfx::Color& bg,
|
||||
const gfx::Rect& charBounds) override {
|
||||
// Normal text
|
||||
auto& colors = SkinTheme::instance()->colors;
|
||||
bg = ColorNone;
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2018-2019 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -936,7 +936,10 @@ void Tabs::createFloatingOverlay(Tab* tab)
|
||||
// Fill the surface with pink color
|
||||
{
|
||||
os::SurfaceLock lock(surface);
|
||||
surface->fillRect(gfx::rgba(0, 0, 0, 0), gfx::Rect(0, 0, surface->width(), surface->height()));
|
||||
os::Paint paint;
|
||||
paint.color(gfx::rgba(0, 0, 0, 0));
|
||||
paint.style(os::Paint::Fill);
|
||||
surface->drawRect(gfx::Rect(0, 0, surface->width(), surface->height()), paint);
|
||||
}
|
||||
{
|
||||
Graphics g(surface, 0, 0);
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite UI Library
|
||||
// Copyright (C) 2018-2019 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
@ -845,7 +845,9 @@ public:
|
||||
|
||||
void preProcessChar(const int index,
|
||||
const int codepoint,
|
||||
gfx::Color& fg, gfx::Color& bg) override {
|
||||
gfx::Color& fg,
|
||||
gfx::Color& bg,
|
||||
const gfx::Rect& charBounds) override {
|
||||
if (!m_boxes.empty())
|
||||
m_boxes.back().to = index;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite UI Library
|
||||
// Copyright (C) 2019 Igara Studio S.A.
|
||||
// Copyright (C) 2019-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
@ -117,7 +117,9 @@ void Graphics::drawHLine(gfx::Color color, int x, int y, int w)
|
||||
dirty(gfx::Rect(m_dx+x, m_dy+y, w, 1));
|
||||
|
||||
os::SurfaceLock lock(m_surface);
|
||||
m_surface->drawHLine(color, m_dx+x, m_dy+y, w);
|
||||
os::Paint paint;
|
||||
paint.color(color);
|
||||
m_surface->drawRect(gfx::Rect(m_dx+x, m_dy+y, w, 1), paint);
|
||||
}
|
||||
|
||||
void Graphics::drawVLine(gfx::Color color, int x, int y, int h)
|
||||
@ -125,7 +127,9 @@ void Graphics::drawVLine(gfx::Color color, int x, int y, int h)
|
||||
dirty(gfx::Rect(m_dx+x, m_dy+y, 1, h));
|
||||
|
||||
os::SurfaceLock lock(m_surface);
|
||||
m_surface->drawVLine(color, m_dx+x, m_dy+y, h);
|
||||
os::Paint paint;
|
||||
paint.color(color);
|
||||
m_surface->drawRect(gfx::Rect(m_dx+x, m_dy+y, 1, h), paint);
|
||||
}
|
||||
|
||||
void Graphics::drawLine(gfx::Color color, const gfx::Point& _a, const gfx::Point& _b)
|
||||
@ -135,7 +139,9 @@ void Graphics::drawLine(gfx::Color color, const gfx::Point& _a, const gfx::Point
|
||||
dirty(gfx::Rect(a, b));
|
||||
|
||||
os::SurfaceLock lock(m_surface);
|
||||
m_surface->drawLine(color, a, b);
|
||||
os::Paint paint;
|
||||
paint.color(color);
|
||||
m_surface->drawLine(a, b, paint);
|
||||
}
|
||||
|
||||
void Graphics::drawRect(gfx::Color color, const gfx::Rect& rcOrig)
|
||||
@ -145,7 +151,10 @@ void Graphics::drawRect(gfx::Color color, const gfx::Rect& rcOrig)
|
||||
dirty(rc);
|
||||
|
||||
os::SurfaceLock lock(m_surface);
|
||||
m_surface->drawRect(color, rc);
|
||||
os::Paint paint;
|
||||
paint.color(color);
|
||||
paint.style(os::Paint::Stroke);
|
||||
m_surface->drawRect(rc, paint);
|
||||
}
|
||||
|
||||
void Graphics::fillRect(gfx::Color color, const gfx::Rect& rcOrig)
|
||||
@ -155,7 +164,10 @@ void Graphics::fillRect(gfx::Color color, const gfx::Rect& rcOrig)
|
||||
dirty(rc);
|
||||
|
||||
os::SurfaceLock lock(m_surface);
|
||||
m_surface->fillRect(color, rc);
|
||||
os::Paint paint;
|
||||
paint.color(color);
|
||||
paint.style(os::Paint::Fill);
|
||||
m_surface->drawRect(rc, paint);
|
||||
}
|
||||
|
||||
void Graphics::fillRegion(gfx::Color color, const gfx::Region& rgn)
|
||||
@ -321,7 +333,8 @@ public:
|
||||
void preProcessChar(const int index,
|
||||
const int codepoint,
|
||||
gfx::Color& fg,
|
||||
gfx::Color& bg) override {
|
||||
gfx::Color& bg,
|
||||
const gfx::Rect& charBounds) override {
|
||||
if (m_surface) {
|
||||
if (m_mnemonic &&
|
||||
// TODO use ICU library to lower unicode chars
|
||||
@ -344,11 +357,16 @@ public:
|
||||
if (!gfx::is_transparent(m_underscoreColor)) {
|
||||
// TODO underscore height = guiscale() should be configurable from ui::Theme
|
||||
int dy = 0;
|
||||
if (m_font->type() == os::FontType::kTrueType) // TODO use other method to locate the underline
|
||||
if (m_font->type() == os::FontType::FreeType) // TODO use other method to locate the underline
|
||||
dy += guiscale();
|
||||
gfx::Rect underscoreBounds(charBounds.x, charBounds.y+charBounds.h+dy,
|
||||
charBounds.w, guiscale());
|
||||
m_surface->fillRect(m_underscoreColor, underscoreBounds);
|
||||
|
||||
os::Paint paint;
|
||||
paint.color(m_underscoreColor);
|
||||
paint.style(os::Paint::Fill);
|
||||
m_surface->drawRect(underscoreBounds, paint);
|
||||
|
||||
m_bounds |= underscoreBounds;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user