From 53a7c78548056f481f448658d1004761b8bef4ac Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 8 May 2008 23:44:09 +0000 Subject: [PATCH] x zoom --- panda/src/tinydisplay/tinyXGraphicsWindow.cxx | 21 ++++++++++++++++++- panda/src/tinydisplay/tinyXGraphicsWindow.h | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/panda/src/tinydisplay/tinyXGraphicsWindow.cxx b/panda/src/tinydisplay/tinyXGraphicsWindow.cxx index 89b30679d2..bc0cc209bd 100644 --- a/panda/src/tinydisplay/tinyXGraphicsWindow.cxx +++ b/panda/src/tinydisplay/tinyXGraphicsWindow.cxx @@ -213,7 +213,7 @@ end_frame(FrameMode mode, Thread *current_thread) { //////////////////////////////////////////////////////////////////// void TinyXGraphicsWindow:: begin_flip() { - if (_bytes_per_pixel == 4) { + if (_bytes_per_pixel == 4 && _pitch == _frame_buffer->linesize) { // If we match the expected bpp, we don't need an intervening copy // operation. Just point the XImage directly at the framebuffer // data. @@ -227,6 +227,25 @@ begin_flip() { XFlush(_display); } +//////////////////////////////////////////////////////////////////// +// Function: TinyXGraphicsWindow::supports_pixel_zoom +// Access: Published, Virtual +// Description: Returns true if a call to set_pixel_zoom() will be +// respected, false if it will be ignored. If this +// returns false, then get_pixel_factor() will always +// return 1.0, regardless of what value you specify for +// set_pixel_zoom(). +// +// This may return false if the underlying renderer +// doesn't support pixel zooming, or if you have called +// this on a DisplayRegion that doesn't have both +// set_clear_color() and set_clear_depth() enabled. +//////////////////////////////////////////////////////////////////// +bool TinyXGraphicsWindow:: +supports_pixel_zoom() const { + return true; +} + //////////////////////////////////////////////////////////////////// // Function: TinyXGraphicsWindow::process_events // Access: Public, Virtual diff --git a/panda/src/tinydisplay/tinyXGraphicsWindow.h b/panda/src/tinydisplay/tinyXGraphicsWindow.h index c00cc85bb7..53f2391593 100644 --- a/panda/src/tinydisplay/tinyXGraphicsWindow.h +++ b/panda/src/tinydisplay/tinyXGraphicsWindow.h @@ -47,6 +47,7 @@ public: virtual bool begin_frame(FrameMode mode, Thread *current_thread); virtual void end_frame(FrameMode mode, Thread *current_thread); virtual void begin_flip(); + virtual bool supports_pixel_zoom() const; virtual void process_events(); virtual void set_properties_now(WindowProperties &properties);