mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-29 01:20:17 +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()) {
|
||||
|
||||
case doc::ColorMode::RGB: {
|
||||
auto skImg = SkImage::MakeRasterData(
|
||||
auto skImg = SkImages::RasterFromData(
|
||||
SkImageInfo::Make(srcImage->width(),
|
||||
srcImage->height(),
|
||||
kRGBA_8888_SkColorType,
|
||||
@ -444,7 +444,7 @@ void ShaderRenderer::drawImage(SkCanvas* canvas,
|
||||
|
||||
case doc::ColorMode::GRAYSCALE: {
|
||||
// We use kR8G8_unorm_SkColorType to access gray and alpha
|
||||
auto skImg = SkImage::MakeRasterData(
|
||||
auto skImg = SkImages::RasterFromData(
|
||||
SkImageInfo::Make(srcImage->width(),
|
||||
srcImage->height(),
|
||||
kR8G8_unorm_SkColorType,
|
||||
@ -472,7 +472,7 @@ void ShaderRenderer::drawImage(SkCanvas* canvas,
|
||||
|
||||
case doc::ColorMode::INDEXED: {
|
||||
// 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(),
|
||||
srcImage->height(),
|
||||
kAlpha_8_SkColorType,
|
||||
@ -486,7 +486,7 @@ void ShaderRenderer::drawImage(SkCanvas* canvas,
|
||||
auto skPalData = SkData::MakeWithoutCopy(
|
||||
(const void*)m_palette.rawColorsData(),
|
||||
palSize);
|
||||
auto skPal = SkImage::MakeRasterData(
|
||||
auto skPal = SkImages::RasterFromData(
|
||||
SkImageInfo::Make(m_palette.size(), 1,
|
||||
kRGBA_8888_SkColorType,
|
||||
kUnpremul_SkAlphaType),
|
||||
|
@ -40,16 +40,16 @@ ColorSpectrum::ColorSpectrum()
|
||||
const char* ColorSpectrum::getMainAreaShader()
|
||||
{
|
||||
if (m_mainShader.empty()) {
|
||||
m_mainShader += "uniform half3 iRes;"
|
||||
"uniform half4 iHsl;";
|
||||
m_mainShader += kHSL_to_RGB_sksl;
|
||||
m_mainShader += R"(
|
||||
uniform half3 iRes;
|
||||
uniform half4 iHsl;
|
||||
|
||||
half4 main(vec2 fragcoord) {
|
||||
vec2 d = fragcoord.xy / iRes.xy;
|
||||
half hue = d.x;
|
||||
half sat = iHsl.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()
|
||||
{
|
||||
if (m_bottomShader.empty()) {
|
||||
m_bottomShader += "uniform half3 iRes;"
|
||||
"uniform half4 iHsl;";
|
||||
m_bottomShader += kHSL_to_RGB_sksl;
|
||||
m_bottomShader += R"(
|
||||
uniform half3 iRes;
|
||||
uniform half4 iHsl;
|
||||
|
||||
half4 main(vec2 fragcoord) {
|
||||
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"
|
||||
|
||||
// To include kRGB_to_HSL_sksl and kHSL_to_RGB_sksl
|
||||
#include "src/core/SkRuntimeEffectPriv.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
// rgb_to_hsl() and hsv_to_hsl() functions by Sam Hocevar licensed
|
||||
|
@ -14,6 +14,8 @@
|
||||
|
||||
#if LAF_SKIA
|
||||
#include "include/core/SkBitmap.h"
|
||||
#include "include/core/SkShader.h"
|
||||
#include "include/core/SkTileMode.h"
|
||||
#endif
|
||||
|
||||
namespace ui {
|
||||
|
Loading…
x
Reference in New Issue
Block a user