tinyXGraphicsWindow.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // Filename: tinyXGraphicsWindow.h
  2. // Created by: drose (03May08)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) Carnegie Mellon University. All rights reserved.
  8. //
  9. // All use of this software is subject to the terms of the revised BSD
  10. // license. You should have received a copy of this license along
  11. // with this source code in a file named "LICENSE."
  12. //
  13. ////////////////////////////////////////////////////////////////////
  14. #ifndef TINYXGRAPHICSWINDOW_H
  15. #define TINYXGRAPHICSWINDOW_H
  16. #include "pandabase.h"
  17. #ifdef HAVE_X11
  18. #include "tinyXGraphicsPipe.h"
  19. #include "x11GraphicsWindow.h"
  20. #include "buttonHandle.h"
  21. ////////////////////////////////////////////////////////////////////
  22. // Class : TinyXGraphicsWindow
  23. // Description : Opens a window on X11 to display the TinyPanda
  24. // software rendering.
  25. ////////////////////////////////////////////////////////////////////
  26. class EXPCL_TINYDISPLAY TinyXGraphicsWindow : public x11GraphicsWindow {
  27. public:
  28. TinyXGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe,
  29. const string &name,
  30. const FrameBufferProperties &fb_prop,
  31. const WindowProperties &win_prop,
  32. int flags,
  33. GraphicsStateGuardian *gsg,
  34. GraphicsOutput *host);
  35. virtual ~TinyXGraphicsWindow();
  36. virtual bool begin_frame(FrameMode mode, Thread *current_thread);
  37. virtual void end_frame(FrameMode mode, Thread *current_thread);
  38. virtual void end_flip();
  39. virtual bool supports_pixel_zoom() const;
  40. virtual void process_events();
  41. protected:
  42. virtual void close_window();
  43. virtual bool open_window();
  44. virtual void pixel_factor_changed();
  45. private:
  46. void create_full_frame_buffer();
  47. void create_reduced_frame_buffer();
  48. void create_ximage();
  49. private:
  50. ZBuffer *_reduced_frame_buffer;
  51. ZBuffer *_full_frame_buffer;
  52. int _pitch;
  53. XImage *_ximage;
  54. GC _gc;
  55. int _bytes_per_pixel;
  56. Visual *_visual;
  57. int _depth;
  58. public:
  59. static TypeHandle get_class_type() {
  60. return _type_handle;
  61. }
  62. static void init_type() {
  63. x11GraphicsWindow::init_type();
  64. register_type(_type_handle, "TinyXGraphicsWindow",
  65. x11GraphicsWindow::get_class_type());
  66. }
  67. virtual TypeHandle get_type() const {
  68. return get_class_type();
  69. }
  70. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  71. private:
  72. static TypeHandle _type_handle;
  73. };
  74. #include "tinyXGraphicsWindow.I"
  75. #endif // HAVE_X11
  76. #endif