webappmanager
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RemoteWindowDataOpenGLQt.h
Go to the documentation of this file.
1 
18 #ifndef REMOTEWINDOWDATAOPENGL_H
19 #define REMOTEWINDOWDATAOPENGL_H
20 
21 #include "Common.h"
22 
23 #include "RemoteWindowData.h"
24 
25 class QRect;
26 class QPainter;
27 class QImage;
28 class QGLWidget;
29 class PGSurface;
30 class PGContext;
31 class PIpcBuffer;
32 
34 {
35 public:
36 
37  RemoteWindowDataOpenGLQt(int width, int height, bool hasAlpha, bool createIpcBuffer=true);
38  virtual ~RemoteWindowDataOpenGLQt();
39 
40  virtual int key() const;
41  virtual int width() const { return m_width; }
42  virtual int height() const { return m_height; }
43  virtual bool hasAlpha() const { return m_hasAlpha; }
44  virtual bool needsClear() const { return false; }
45  virtual bool supportsPartialUpdates() const { return false; }
46  virtual void setWindowMetaDataBuffer(PIpcBuffer* metaDataBuffer);
47  virtual void flip();
48 
49  virtual PGContext* renderingContext() { return 0; }
50  virtual QPainter* qtRenderingContext();
51  virtual void beginPaint();
52  virtual void endPaint(bool preserveOnFlip, const QRect& rect, bool flipBuffers = true);
53  virtual void sendWindowUpdate(int x, int y, int w, int h);
54 
55  virtual bool hasDirectRendering() const;
56  virtual bool directRenderingAllowed(bool val);
57 
58  virtual void resize(int newWidth, int newHeight);
59  virtual void clear();
60  QGLWidget* getWidget();
61 private:
62 
63  PIpcBuffer* m_ipcBuffer;
64  int m_width;
65  int m_height;
66  bool m_hasAlpha;
67  int m_pitch;
68 
69  QPainter* m_context;
70  QImage* m_surface;
71  bool m_directRendering;
72  bool m_displayOpened;
73 
74  friend class WindowedWebApp;
75 private:
76 
79  void lock();
80  void unlock();
81  int calcPitch(int width);
82 };
83 
84 
85 #endif /* REMOTEWINDOWDATAOPENGL_H */