summaryrefslogtreecommitdiff
blob: 44b4bef020201256d82d9de2c3b232834bc10253 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
v1.2.12.1 patch

From 86ffa37fdd2b3267f5ccbdc29b592b208f15052d Mon Sep 17 00:00:00 2001
From: David Capello <david@igarastudio.com>
Date: Tue, 11 Jun 2019 10:42:41 -0300
Subject: [PATCH] Fix rendering bug with new engine and zoom out (canvas is not
 updated correctly)

---
 src/app/ui/editor/editor.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/app/ui/editor/editor.cpp b/src/app/ui/editor/editor.cpp
index dc8715315..0bdaf4b3b 100644
--- a/src/app/ui/editor/editor.cpp
+++ b/src/app/ui/editor/editor.cpp
@@ -668,6 +668,20 @@ void Editor::drawOneSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& sprite
     }
 
     if (tmp->nativeHandle()) {
+      if (newEngine) {
+        // Without doing something on the "tmp" surface before (like
+        // just drawing a pixel), we get a strange behavior where
+        // pixels are not updated correctly on the editor (e.g. when
+        // zoom < 100%). I didn't have enough time to investigate this
+        // issue yet, but this is a partial fix/hack.
+        //
+        // TODO review why do we need to do this, it looks like some
+        //      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));
+      }
+
       convert_image_to_surface(rendered.get(), m_sprite->palette(m_frame),
                                tmp, 0, 0, 0, 0, rc2.w, rc2.h);