From 2827618786d18b8f3dd7dcf8ca5922b429cdc2c1 Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 17 Jun 2024 14:11:14 -0300 Subject: [PATCH] [gpu] Fix outdated os::Surface to show latest changes on the canvas We have to mark the SkBitmap as modified (new generation ID) in convert_image_to_surface() so we upload the bitmap changes as a new texture in the GPU. --- laf | 2 +- src/app/util/conversion_to_surface.cpp | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/laf b/laf index 968f0e4b9..feba52e4c 160000 --- a/laf +++ b/laf @@ -1 +1 @@ -Subproject commit 968f0e4b935c77ec3701307ec963f5e058254424 +Subproject commit feba52e4ca7855219044e9fdf936ecb6b9b4d1ca diff --git a/src/app/util/conversion_to_surface.cpp b/src/app/util/conversion_to_surface.cpp index 71de7e1db..e302ac657 100644 --- a/src/app/util/conversion_to_surface.cpp +++ b/src/app/util/conversion_to_surface.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (c) 2020 Igara Studio S.A. +// Copyright (c) 2020-2024 Igara Studio S.A. // Copyright (c) 2001-2018 David Capello // // This program is distributed under the terms of @@ -20,6 +20,10 @@ #include "os/surface.h" #include "os/surface_format.h" +#if LAF_SKIA + #include "os/skia/skia_surface.h" +#endif + #include #include @@ -205,6 +209,12 @@ void convert_image_to_surface( ASSERT(false); throw std::runtime_error("conversion not supported"); } + +#if LAF_SKIA + // Increment SkBitmap generation ID so it's re-uploaded to the GPU + // as a texture if it's needed. + static_cast(surface)->bitmap().notifyPixelsChanged(); +#endif } } // namespace app