mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-09 18:44:46 +00:00
Update to Skia m122 API
This commit is contained in:
parent
5337a728be
commit
a7324fabfa
2
laf
2
laf
@ -1 +1 @@
|
|||||||
Subproject commit 58723a95b3a8809bdd4621e5dea88632b0a4f5bf
|
Subproject commit fd237c17bbdf458fdcab6fe75f093daa26830ed9
|
@ -423,7 +423,7 @@ void ShaderRenderer::drawImage(SkCanvas* canvas,
|
|||||||
switch (srcImage->colorMode()) {
|
switch (srcImage->colorMode()) {
|
||||||
|
|
||||||
case doc::ColorMode::RGB: {
|
case doc::ColorMode::RGB: {
|
||||||
auto skImg = SkImage::MakeRasterData(
|
auto skImg = SkImages::RasterFromData(
|
||||||
SkImageInfo::Make(srcImage->width(),
|
SkImageInfo::Make(srcImage->width(),
|
||||||
srcImage->height(),
|
srcImage->height(),
|
||||||
kRGBA_8888_SkColorType,
|
kRGBA_8888_SkColorType,
|
||||||
@ -444,7 +444,7 @@ void ShaderRenderer::drawImage(SkCanvas* canvas,
|
|||||||
|
|
||||||
case doc::ColorMode::GRAYSCALE: {
|
case doc::ColorMode::GRAYSCALE: {
|
||||||
// We use kR8G8_unorm_SkColorType to access gray and alpha
|
// We use kR8G8_unorm_SkColorType to access gray and alpha
|
||||||
auto skImg = SkImage::MakeRasterData(
|
auto skImg = SkImages::RasterFromData(
|
||||||
SkImageInfo::Make(srcImage->width(),
|
SkImageInfo::Make(srcImage->width(),
|
||||||
srcImage->height(),
|
srcImage->height(),
|
||||||
kR8G8_unorm_SkColorType,
|
kR8G8_unorm_SkColorType,
|
||||||
@ -472,7 +472,7 @@ void ShaderRenderer::drawImage(SkCanvas* canvas,
|
|||||||
|
|
||||||
case doc::ColorMode::INDEXED: {
|
case doc::ColorMode::INDEXED: {
|
||||||
// We use kAlpha_8_SkColorType to access to the index value through the alpha channel
|
// We use kAlpha_8_SkColorType to access to the index value through the alpha channel
|
||||||
auto skImg = SkImage::MakeRasterData(
|
auto skImg = SkImages::RasterFromData(
|
||||||
SkImageInfo::Make(srcImage->width(),
|
SkImageInfo::Make(srcImage->width(),
|
||||||
srcImage->height(),
|
srcImage->height(),
|
||||||
kAlpha_8_SkColorType,
|
kAlpha_8_SkColorType,
|
||||||
@ -486,7 +486,7 @@ void ShaderRenderer::drawImage(SkCanvas* canvas,
|
|||||||
auto skPalData = SkData::MakeWithoutCopy(
|
auto skPalData = SkData::MakeWithoutCopy(
|
||||||
(const void*)m_palette.rawColorsData(),
|
(const void*)m_palette.rawColorsData(),
|
||||||
palSize);
|
palSize);
|
||||||
auto skPal = SkImage::MakeRasterData(
|
auto skPal = SkImages::RasterFromData(
|
||||||
SkImageInfo::Make(m_palette.size(), 1,
|
SkImageInfo::Make(m_palette.size(), 1,
|
||||||
kRGBA_8888_SkColorType,
|
kRGBA_8888_SkColorType,
|
||||||
kUnpremul_SkAlphaType),
|
kUnpremul_SkAlphaType),
|
||||||
|
@ -40,16 +40,16 @@ ColorSpectrum::ColorSpectrum()
|
|||||||
const char* ColorSpectrum::getMainAreaShader()
|
const char* ColorSpectrum::getMainAreaShader()
|
||||||
{
|
{
|
||||||
if (m_mainShader.empty()) {
|
if (m_mainShader.empty()) {
|
||||||
m_mainShader += "uniform half3 iRes;"
|
|
||||||
"uniform half4 iHsl;";
|
|
||||||
m_mainShader += kHSL_to_RGB_sksl;
|
|
||||||
m_mainShader += R"(
|
m_mainShader += R"(
|
||||||
|
uniform half3 iRes;
|
||||||
|
uniform half4 iHsl;
|
||||||
|
|
||||||
half4 main(vec2 fragcoord) {
|
half4 main(vec2 fragcoord) {
|
||||||
vec2 d = fragcoord.xy / iRes.xy;
|
vec2 d = fragcoord.xy / iRes.xy;
|
||||||
half hue = d.x;
|
half hue = d.x;
|
||||||
half sat = iHsl.y;
|
half sat = iHsl.y;
|
||||||
half lit = 1.0 - d.y;
|
half lit = 1.0 - d.y;
|
||||||
return hsl_to_rgb(half3(hue, sat, lit)).rgb1;
|
return $hsl_to_rgb(half3(hue, sat, lit)).rgb1;
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
}
|
}
|
||||||
@ -59,13 +59,13 @@ half4 main(vec2 fragcoord) {
|
|||||||
const char* ColorSpectrum::getBottomBarShader()
|
const char* ColorSpectrum::getBottomBarShader()
|
||||||
{
|
{
|
||||||
if (m_bottomShader.empty()) {
|
if (m_bottomShader.empty()) {
|
||||||
m_bottomShader += "uniform half3 iRes;"
|
|
||||||
"uniform half4 iHsl;";
|
|
||||||
m_bottomShader += kHSL_to_RGB_sksl;
|
|
||||||
m_bottomShader += R"(
|
m_bottomShader += R"(
|
||||||
|
uniform half3 iRes;
|
||||||
|
uniform half4 iHsl;
|
||||||
|
|
||||||
half4 main(vec2 fragcoord) {
|
half4 main(vec2 fragcoord) {
|
||||||
half s = (fragcoord.x / iRes.x);
|
half s = (fragcoord.x / iRes.x);
|
||||||
return hsl_to_rgb(half3(iHsl.x, s, iHsl.z)).rgb1;
|
return $hsl_to_rgb(half3(iHsl.x, s, iHsl.z)).rgb1;
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,6 @@
|
|||||||
|
|
||||||
#include "include/core/SkM44.h"
|
#include "include/core/SkM44.h"
|
||||||
|
|
||||||
// To include kRGB_to_HSL_sksl and kHSL_to_RGB_sksl
|
|
||||||
#include "src/core/SkRuntimeEffectPriv.h"
|
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
|
|
||||||
// rgb_to_hsl() and hsv_to_hsl() functions by Sam Hocevar licensed
|
// rgb_to_hsl() and hsv_to_hsl() functions by Sam Hocevar licensed
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
#if LAF_SKIA
|
#if LAF_SKIA
|
||||||
#include "include/core/SkBitmap.h"
|
#include "include/core/SkBitmap.h"
|
||||||
|
#include "include/core/SkShader.h"
|
||||||
|
#include "include/core/SkTileMode.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user