mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-18 16:21:07 +00:00
Render SkiaWindow with scale factor
This commit is contained in:
parent
7129873cd1
commit
6e76d50864
@ -9,9 +9,9 @@ namespace she {
|
||||
class SkiaDisplay : public Display {
|
||||
public:
|
||||
SkiaDisplay(int width, int height, int scale)
|
||||
: m_window(&m_queue, this)
|
||||
, m_scale(scale) {
|
||||
: m_window(&m_queue, this) {
|
||||
m_surface.create(width, height);
|
||||
m_window.setScale(scale);
|
||||
m_window.setVisible(true);
|
||||
}
|
||||
|
||||
@ -38,11 +38,11 @@ public:
|
||||
}
|
||||
|
||||
void setScale(int scale) override {
|
||||
m_scale = scale;
|
||||
m_window.setScale(scale);
|
||||
}
|
||||
|
||||
int scale() const override {
|
||||
return m_scale;
|
||||
return m_window.scale();
|
||||
}
|
||||
|
||||
// Returns the main surface to draw into this display.
|
||||
@ -98,7 +98,6 @@ private:
|
||||
SkiaEventQueue m_queue;
|
||||
SkiaWindow m_window;
|
||||
SkiaSurface m_surface;
|
||||
int m_scale;
|
||||
};
|
||||
|
||||
} // namespace she
|
||||
|
@ -34,15 +34,14 @@ public:
|
||||
|
||||
ASSERT(bitmap.width() * bitmap.bytesPerPixel() == bitmap.rowBytes());
|
||||
bitmap.lockPixels();
|
||||
int ret = SetDIBitsToDevice(hdc,
|
||||
0, 0,
|
||||
bitmap.width(), bitmap.height(),
|
||||
0, 0,
|
||||
0, bitmap.height(),
|
||||
|
||||
int ret = StretchDIBits(hdc,
|
||||
0, 0, bitmap.width()*scale(), bitmap.height()*scale(),
|
||||
0, 0, bitmap.width(), bitmap.height(),
|
||||
bitmap.getPixels(),
|
||||
&bmi,
|
||||
DIB_RGB_COLORS);
|
||||
&bmi, DIB_RGB_COLORS, SRCCOPY);
|
||||
(void)ret;
|
||||
|
||||
bitmap.unlockPixels();
|
||||
}
|
||||
|
||||
|
@ -310,6 +310,10 @@ static KeyScancode vkToScancode(int vk) {
|
||||
static_cast<T*>(this)->queueEventImpl(ev);
|
||||
}
|
||||
|
||||
int scale() const {
|
||||
return m_scale;
|
||||
}
|
||||
|
||||
void setScale(int scale) {
|
||||
m_scale = scale;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user