mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-06 03:39:51 +00:00
Move SkiaWindow to skia_window_win.cpp
Also, as the EventQueue should be shared between displays, it is now created in SkiaSystem.
This commit is contained in:
parent
2b50980cb0
commit
517e31c34b
@ -87,11 +87,11 @@ if(USE_SKIA_BACKEND)
|
||||
|
||||
list(APPEND SHE_SOURCES
|
||||
skia/skia_display.cpp
|
||||
skia/skia_window.cpp
|
||||
skia/she.cpp)
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND SHE_SOURCES
|
||||
skia/skia_window_win.cpp
|
||||
win/vk.cpp)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include "she/scoped_surface_lock.h"
|
||||
#include "she/surface.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace she {
|
||||
|
||||
class CommonFont : public Font {
|
||||
|
@ -10,19 +10,10 @@
|
||||
|
||||
#include "she/skia/skia_display.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "she/win/event_queue.h"
|
||||
#else
|
||||
#error Your platform does not have a EventQueue implementation
|
||||
#endif
|
||||
|
||||
namespace she {
|
||||
|
||||
SkiaDisplay::SkiaDisplay(int width, int height, int scale)
|
||||
:
|
||||
#ifdef _WIN32
|
||||
m_queue(new WinEventQueue)
|
||||
#endif
|
||||
SkiaDisplay::SkiaDisplay(EventQueue* queue, int width, int height, int scale)
|
||||
: m_queue(queue)
|
||||
, m_window(m_queue, this)
|
||||
, m_surface(new SkiaSurface)
|
||||
{
|
||||
|
@ -9,7 +9,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "she/display.h"
|
||||
#include "she/skia/skia_window.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "she/skia/skia_window_win.h"
|
||||
#else
|
||||
#error There is no SkiaWindow implementation for your platform
|
||||
#endif
|
||||
|
||||
namespace she {
|
||||
|
||||
@ -17,7 +22,7 @@ class SkiaSurface;
|
||||
|
||||
class SkiaDisplay : public Display {
|
||||
public:
|
||||
SkiaDisplay(int width, int height, int scale);
|
||||
SkiaDisplay(EventQueue* queue, int width, int height, int scale);
|
||||
|
||||
void resize(const gfx::Size& size);
|
||||
void dispose() override;
|
||||
|
@ -17,6 +17,12 @@
|
||||
#include "she/skia/skia_display.h"
|
||||
#include "she/skia/skia_surface.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "she/win/event_queue.h"
|
||||
#else
|
||||
#error There is no EventQueue implementation for your platform
|
||||
#endif
|
||||
|
||||
namespace she {
|
||||
|
||||
class SkiaSystem : public CommonSystem {
|
||||
@ -44,7 +50,7 @@ public:
|
||||
}
|
||||
|
||||
Display* createDisplay(int width, int height, int scale) override {
|
||||
SkiaDisplay* display = new SkiaDisplay(width, height, scale);
|
||||
SkiaDisplay* display = new SkiaDisplay(&m_queue, width, height, scale);
|
||||
if (!m_defaultDisplay)
|
||||
m_defaultDisplay = display;
|
||||
return display;
|
||||
@ -90,6 +96,7 @@ public:
|
||||
|
||||
private:
|
||||
SkiaDisplay* m_defaultDisplay;
|
||||
EventQueueImpl m_queue;
|
||||
};
|
||||
|
||||
} // namespace she
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "she/skia/skia_window.h"
|
||||
#include "she/skia/skia_window_win.h"
|
||||
|
||||
#include "she/event_queue.h"
|
||||
#include "she/skia/skia_display.h"
|
@ -4,17 +4,12 @@
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
|
||||
#ifndef SHE_SKIA_SKIA_WINDOW_INCLUDED
|
||||
#define SHE_SKIA_SKIA_WINDOW_INCLUDED
|
||||
#ifndef SHE_SKIA_SKIA_WINDOW_WIN_INCLUDED
|
||||
#define SHE_SKIA_SKIA_WINDOW_WIN_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "she/win/window.h"
|
||||
#else
|
||||
#error There is no Window implementation
|
||||
#endif
|
||||
|
||||
#include "she/skia/skia_surface.h"
|
||||
#include "she/win/window.h"
|
||||
|
||||
namespace she {
|
||||
|
||||
@ -24,6 +19,7 @@ class SkiaDisplay;
|
||||
class SkiaWindow : public Window<SkiaWindow> {
|
||||
public:
|
||||
SkiaWindow(EventQueue* queue, SkiaDisplay* display);
|
||||
|
||||
void queueEventImpl(Event& ev);
|
||||
void paintImpl(HDC hdc);
|
||||
void resizeImpl(const gfx::Size& size);
|
@ -17,7 +17,7 @@
|
||||
|
||||
namespace she {
|
||||
|
||||
class WinEventQueue : public EventQueue {
|
||||
class EventQueueImpl : public EventQueue {
|
||||
public:
|
||||
void getEvent(Event& ev, bool canWait) override {
|
||||
MSG msg;
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#include <commctrl.h>
|
||||
#include <shellapi.h>
|
||||
|
||||
#include "gfx/size.h"
|
||||
#include "she/event.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user