David Rose пре 17 година
родитељ
комит
53a7c78548

+ 20 - 1
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

+ 1 - 0
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);