mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-29 19:20:09 +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/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()
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user