[aseprite] 166/250: Initialize windows with width/height/scale args on Skia port
Tobias Hansen
thansen at moszumanska.debian.org
Sun Dec 20 15:27:25 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 f9d0254d912b8b46a12ff9b858c20db1102ced52
Author: David Capello <davidcapello at gmail.com>
Date: Wed Oct 14 10:25:24 2015 -0300
Initialize windows with width/height/scale args on Skia port
---
src/she/osx/window.h | 5 ++++-
src/she/osx/window.mm | 7 +++++--
src/she/skia/skia_display.cpp | 2 +-
src/she/skia/skia_window_osx.h | 3 ++-
src/she/skia/skia_window_osx.mm | 14 ++++++++++----
src/she/skia/skia_window_win.cpp | 6 ++++--
src/she/skia/skia_window_win.h | 3 ++-
src/she/win/window.h | 10 +++++-----
8 files changed, 33 insertions(+), 17 deletions(-)
diff --git a/src/she/osx/window.h b/src/she/osx/window.h
index f76f40d..12c200e 100644
--- a/src/she/osx/window.h
+++ b/src/she/osx/window.h
@@ -36,7 +36,10 @@ public:
OSXWindowDelegate* m_delegate;
int m_scale;
}
-- (OSXWindow*)initWithImpl:(OSXWindowImpl*)impl;
+- (OSXWindow*)initWithImpl:(OSXWindowImpl*)impl
+ width:(int)width
+ height:(int)height
+ scale:(int)scale;
- (OSXWindowImpl*)impl;
- (int)scale;
- (void)setScale:(int)scale;
diff --git a/src/she/osx/window.mm b/src/she/osx/window.mm
index 6d64e76..236988b 100644
--- a/src/she/osx/window.mm
+++ b/src/she/osx/window.mm
@@ -18,11 +18,14 @@
@implementation OSXWindow
- (OSXWindow*)initWithImpl:(OSXWindowImpl*)impl
+ width:(int)width
+ height:(int)height
+ scale:(int)scale
{
m_impl = impl;
- m_scale = 1;
+ m_scale = scale;
- NSRect rect = NSMakeRect(0, 0, 640, 480);
+ NSRect rect = NSMakeRect(0, 0, width, height);
self = [self initWithContentRect:rect
styleMask:(NSTitledWindowMask | NSClosableWindowMask |
NSMiniaturizableWindowMask | NSResizableWindowMask)
diff --git a/src/she/skia/skia_display.cpp b/src/she/skia/skia_display.cpp
index 7144e21..8b501f5 100644
--- a/src/she/skia/skia_display.cpp
+++ b/src/she/skia/skia_display.cpp
@@ -18,7 +18,7 @@
namespace she {
SkiaDisplay::SkiaDisplay(int width, int height, int scale)
- : m_window(instance()->eventQueue(), this)
+ : m_window(instance()->eventQueue(), this, width, height, scale)
, m_surface(new SkiaSurface)
, m_customSurface(false)
, m_nativeCursor(kArrowCursor)
diff --git a/src/she/skia/skia_window_osx.h b/src/she/skia/skia_window_osx.h
index a9dc87a..28f1a73 100644
--- a/src/she/skia/skia_window_osx.h
+++ b/src/she/skia/skia_window_osx.h
@@ -22,7 +22,8 @@ class SkiaWindow {
public:
enum class Backend { NONE, GL };
- SkiaWindow(EventQueue* queue, SkiaDisplay* display);
+ SkiaWindow(EventQueue* queue, SkiaDisplay* display,
+ int width, int height, int scale);
~SkiaWindow();
int scale() const;
diff --git a/src/she/skia/skia_window_osx.mm b/src/she/skia/skia_window_osx.mm
index 7397999..6ac3856 100644
--- a/src/she/skia/skia_window_osx.mm
+++ b/src/she/skia/skia_window_osx.mm
@@ -33,12 +33,16 @@ namespace she {
class SkiaWindow::Impl : public OSXWindowImpl {
public:
- Impl(EventQueue* queue, SkiaDisplay* display)
+ Impl(EventQueue* queue, SkiaDisplay* display,
+ int width, int height, int scale)
: m_display(display)
, m_backend(Backend::NONE)
, m_nsGL(nil) {
m_closing = false;
- m_window = [[OSXWindow alloc] initWithImpl:this];
+ m_window = [[OSXWindow alloc] initWithImpl:this
+ width:width
+ height:height
+ scale:scale];
}
~Impl() {
@@ -261,8 +265,10 @@ private:
#endif
};
-SkiaWindow::SkiaWindow(EventQueue* queue, SkiaDisplay* display)
- : m_impl(new Impl(queue, display))
+SkiaWindow::SkiaWindow(EventQueue* queue, SkiaDisplay* display,
+ int width, int height, int scale)
+ : m_impl(new Impl(queue, display,
+ width, height, scale))
{
}
diff --git a/src/she/skia/skia_window_win.cpp b/src/she/skia/skia_window_win.cpp
index 647a001..602df48 100644
--- a/src/she/skia/skia_window_win.cpp
+++ b/src/she/skia/skia_window_win.cpp
@@ -23,8 +23,10 @@
namespace she {
-SkiaWindow::SkiaWindow(EventQueue* queue, SkiaDisplay* display)
- : m_queue(queue)
+SkiaWindow::SkiaWindow(EventQueue* queue, SkiaDisplay* display,
+ int width, int height, int scale)
+ : WinWindow<SkiaWindow>(width, height, scale)
+ , m_queue(queue)
, m_display(display)
, m_backend(Backend::NONE)
#if SK_SUPPORT_GPU
diff --git a/src/she/skia/skia_window_win.h b/src/she/skia/skia_window_win.h
index 839788a..79470be 100644
--- a/src/she/skia/skia_window_win.h
+++ b/src/she/skia/skia_window_win.h
@@ -27,7 +27,8 @@ class SkiaWindow : public WinWindow<SkiaWindow> {
public:
enum class Backend { NONE, GL, ANGLE };
- SkiaWindow(EventQueue* queue, SkiaDisplay* display);
+ SkiaWindow(EventQueue* queue, SkiaDisplay* display,
+ int width, int height, int scale);
~SkiaWindow();
void queueEventImpl(Event& ev);
diff --git a/src/she/win/window.h b/src/she/win/window.h
index 6282092..ceaa312 100644
--- a/src/she/win/window.h
+++ b/src/she/win/window.h
@@ -31,15 +31,15 @@ namespace she {
template<typename T>
class WinWindow {
public:
- WinWindow()
+ WinWindow(int width, int height, int scale)
: m_clientSize(1, 1)
, m_restoredSize(0, 0) {
registerClass();
- m_hwnd = createHwnd(this);
+ m_hwnd = createHwnd(this, width, height);
m_hcursor = NULL;
m_hasMouse = false;
m_captureMouse = false;
- m_scale = 1;
+ m_scale = scale;
}
void queueEvent(Event& ev) {
@@ -484,14 +484,14 @@ namespace she {
throw std::runtime_error("Error registering window class");
}
- static HWND createHwnd(WinWindow* self) {
+ static HWND createHwnd(WinWindow* self, int width, int height) {
HWND hwnd = CreateWindowEx(
WS_EX_APPWINDOW | WS_EX_ACCEPTFILES,
SHE_WND_CLASS_NAME,
L"",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, CW_USEDEFAULT,
+ width, height,
nullptr,
nullptr,
GetModuleHandle(nullptr),
--
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