[aseprite] 122/250: Fix window resize on Skia/Win port

Tobias Hansen thansen at moszumanska.debian.org
Sun Dec 20 15:27:19 UTC 2015


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository aseprite.

commit 5033713430cd26bb9b693fa0027907059a73e5da
Author: David Capello <davidcapello at gmail.com>
Date:   Fri Oct 2 11:24:04 2015 -0300

    Fix window resize on Skia/Win port
---
 src/she/skia/skia_display.cpp | 10 +++++++++-
 src/she/win/window.h          | 18 ++++++++++--------
 2 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/src/she/skia/skia_display.cpp b/src/she/skia/skia_display.cpp
index d9879d2..53519af 100644
--- a/src/she/skia/skia_display.cpp
+++ b/src/she/skia/skia_display.cpp
@@ -10,6 +10,8 @@
 
 #include "she/skia/skia_display.h"
 
+#include "she/event.h"
+#include "she/event_queue.h"
 #include "she/skia/skia_surface.h"
 #include "she/system.h"
 
@@ -35,12 +37,18 @@ void SkiaDisplay::setSkiaSurface(SkiaSurface* surface)
 
 void SkiaDisplay::resize(const gfx::Size& size)
 {
+  Event ev;
+  ev.setType(Event::ResizeDisplay);
+  ev.setDisplay(this);
+  she::queue_event(ev);
+
   if (m_customSurface)
     return;
 
   m_surface->dispose();
   m_surface = new SkiaSurface;
-  m_surface->create(size.w, size.h);
+  m_surface->create(size.w / m_window.scale(),
+                    size.h / m_window.scale());
 }
 
 void SkiaDisplay::dispose()
diff --git a/src/she/win/window.h b/src/she/win/window.h
index 731379f..840f809 100644
--- a/src/she/win/window.h
+++ b/src/she/win/window.h
@@ -31,7 +31,9 @@ namespace she {
   template<typename T>
   class WinWindow {
   public:
-    WinWindow() {
+    WinWindow()
+      : m_clientSize(1, 1)
+      , m_restoredSize(0, 0) {
       registerClass();
       m_hwnd = createHwnd(this);
       m_hcursor = NULL;
@@ -50,6 +52,7 @@ namespace she {
 
     void setScale(int scale) {
       m_scale = scale;
+      static_cast<T*>(this)->resizeImpl(m_clientSize);
     }
 
     void setVisible(bool visible) {
@@ -189,14 +192,13 @@ namespace she {
         }
 
         case WM_SIZE: {
-          switch (wparam) {
-            case SIZE_MAXIMIZED:
-            case SIZE_RESTORED:
-              m_clientSize.w = GET_X_LPARAM(lparam);
-              m_clientSize.h = GET_Y_LPARAM(lparam);
+          int w = GET_X_LPARAM(lparam);
+          int h = GET_Y_LPARAM(lparam);
 
-              static_cast<T*>(this)->resizeImpl(m_clientSize);
-              break;
+          if (w > 0 && h > 0) {
+            m_clientSize.w = w;
+            m_clientSize.h = h;
+            static_cast<T*>(this)->resizeImpl(m_clientSize);
           }
 
           WINDOWPLACEMENT pl;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git



More information about the Pkg-games-commits mailing list