mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-10 03:44:16 +00:00
Fix window resize on Skia/Win port
This commit is contained in:
parent
311e90c58f
commit
5033713430
@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
#include "she/skia/skia_display.h"
|
#include "she/skia/skia_display.h"
|
||||||
|
|
||||||
|
#include "she/event.h"
|
||||||
|
#include "she/event_queue.h"
|
||||||
#include "she/skia/skia_surface.h"
|
#include "she/skia/skia_surface.h"
|
||||||
#include "she/system.h"
|
#include "she/system.h"
|
||||||
|
|
||||||
@ -35,12 +37,18 @@ void SkiaDisplay::setSkiaSurface(SkiaSurface* surface)
|
|||||||
|
|
||||||
void SkiaDisplay::resize(const gfx::Size& size)
|
void SkiaDisplay::resize(const gfx::Size& size)
|
||||||
{
|
{
|
||||||
|
Event ev;
|
||||||
|
ev.setType(Event::ResizeDisplay);
|
||||||
|
ev.setDisplay(this);
|
||||||
|
she::queue_event(ev);
|
||||||
|
|
||||||
if (m_customSurface)
|
if (m_customSurface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_surface->dispose();
|
m_surface->dispose();
|
||||||
m_surface = new SkiaSurface;
|
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()
|
void SkiaDisplay::dispose()
|
||||||
|
@ -31,7 +31,9 @@ namespace she {
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
class WinWindow {
|
class WinWindow {
|
||||||
public:
|
public:
|
||||||
WinWindow() {
|
WinWindow()
|
||||||
|
: m_clientSize(1, 1)
|
||||||
|
, m_restoredSize(0, 0) {
|
||||||
registerClass();
|
registerClass();
|
||||||
m_hwnd = createHwnd(this);
|
m_hwnd = createHwnd(this);
|
||||||
m_hcursor = NULL;
|
m_hcursor = NULL;
|
||||||
@ -50,6 +52,7 @@ namespace she {
|
|||||||
|
|
||||||
void setScale(int scale) {
|
void setScale(int scale) {
|
||||||
m_scale = scale;
|
m_scale = scale;
|
||||||
|
static_cast<T*>(this)->resizeImpl(m_clientSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setVisible(bool visible) {
|
void setVisible(bool visible) {
|
||||||
@ -189,14 +192,13 @@ namespace she {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case WM_SIZE: {
|
case WM_SIZE: {
|
||||||
switch (wparam) {
|
int w = GET_X_LPARAM(lparam);
|
||||||
case SIZE_MAXIMIZED:
|
int h = GET_Y_LPARAM(lparam);
|
||||||
case SIZE_RESTORED:
|
|
||||||
m_clientSize.w = GET_X_LPARAM(lparam);
|
|
||||||
m_clientSize.h = GET_Y_LPARAM(lparam);
|
|
||||||
|
|
||||||
static_cast<T*>(this)->resizeImpl(m_clientSize);
|
if (w > 0 && h > 0) {
|
||||||
break;
|
m_clientSize.w = w;
|
||||||
|
m_clientSize.h = h;
|
||||||
|
static_cast<T*>(this)->resizeImpl(m_clientSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
WINDOWPLACEMENT pl;
|
WINDOWPLACEMENT pl;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user