equal
deleted
inserted
replaced
78 #define vt2f(x) X2FLOAT(x) |
78 #define vt2f(x) X2FLOAT(x) |
79 #define q_vertexType GLfixed |
79 #define q_vertexType GLfixed |
80 #define q_vertexTypeEnum GL_FIXED |
80 #define q_vertexTypeEnum GL_FIXED |
81 #endif //QT_OPENGL_ES_1_CL |
81 #endif //QT_OPENGL_ES_1_CL |
82 |
82 |
83 #ifdef QT_OPENGL_ES |
83 #if defined(QT_OPENGL_ES) || defined(QT_OPENGL_ES_2) |
84 QT_BEGIN_INCLUDE_NAMESPACE |
84 QT_BEGIN_INCLUDE_NAMESPACE |
|
85 |
85 #if defined(QT_OPENGL_ES_2) |
86 #if defined(QT_OPENGL_ES_2) |
86 #include <EGL/egl.h> |
87 # include <GLES2/gl2.h> |
|
88 #endif |
|
89 |
|
90 #if defined(QT_GLES_EGL) |
|
91 # include <GLES/egl.h> |
87 #else |
92 #else |
88 #include <GLES/egl.h> |
93 # include <EGL/egl.h> |
89 #endif |
94 #endif |
|
95 |
90 QT_END_INCLUDE_NAMESPACE |
96 QT_END_INCLUDE_NAMESPACE |
91 #endif |
97 #endif |
92 |
98 |
93 QT_BEGIN_NAMESPACE |
99 QT_BEGIN_NAMESPACE |
94 |
100 |
177 , wsurf(0) |
183 , wsurf(0) |
178 #endif |
184 #endif |
179 #if defined(Q_WS_X11) && defined(QT_OPENGL_ES) |
185 #if defined(Q_WS_X11) && defined(QT_OPENGL_ES) |
180 , eglSurfaceWindowId(0) |
186 , eglSurfaceWindowId(0) |
181 #endif |
187 #endif |
182 {} |
188 { |
|
189 isGLWidget = 1; |
|
190 } |
183 |
191 |
184 ~QGLWidgetPrivate() {} |
192 ~QGLWidgetPrivate() {} |
185 |
193 |
186 void init(QGLContext *context, const QGLWidget* shareWidget); |
194 void init(QGLContext *context, const QGLWidget* shareWidget); |
187 void initContext(QGLContext *context, const QGLWidget* shareWidget); |
195 void initContext(QGLContext *context, const QGLWidget* shareWidget); |
520 (const char *buf, int len, const char *format = 0); |
528 (const char *buf, int len, const char *format = 0); |
521 QSize bindCompressedTextureDDS(const char *buf, int len); |
529 QSize bindCompressedTextureDDS(const char *buf, int len); |
522 QSize bindCompressedTexturePVR(const char *buf, int len); |
530 QSize bindCompressedTexturePVR(const char *buf, int len); |
523 }; |
531 }; |
524 |
532 |
525 class QGLTextureCache { |
533 class Q_AUTOTEST_EXPORT QGLTextureCache { |
526 public: |
534 public: |
527 QGLTextureCache(); |
535 QGLTextureCache(); |
528 ~QGLTextureCache(); |
536 ~QGLTextureCache(); |
529 |
537 |
530 void insert(QGLContext *ctx, qint64 key, QGLTexture *texture, int cost); |
538 void insert(QGLContext *ctx, qint64 key, QGLTexture *texture, int cost); |
536 int maxCost() {return m_cache.maxCost(); } |
544 int maxCost() {return m_cache.maxCost(); } |
537 QGLTexture* getTexture(quint64 key) { return m_cache.object(key); } |
545 QGLTexture* getTexture(quint64 key) { return m_cache.object(key); } |
538 |
546 |
539 static QGLTextureCache *instance(); |
547 static QGLTextureCache *instance(); |
540 static void deleteIfEmpty(); |
548 static void deleteIfEmpty(); |
541 static void imageCleanupHook(qint64 cacheKey); |
549 static void cleanupTexturesForCacheKey(qint64 cacheKey); |
542 static void cleanupTextures(QPixmap* pixmap); |
550 static void cleanupTexturesForPixampData(QPixmapData* pixmap); |
543 #ifdef Q_WS_X11 |
551 static void cleanupBeforePixmapDestruction(QPixmapData* pixmap); |
544 // X11 needs to catch pixmap data destruction to delete EGL/GLX pixmap surfaces |
|
545 static void cleanupPixmapSurfaces(QPixmap* pixmap); |
|
546 #endif |
|
547 |
552 |
548 private: |
553 private: |
549 QCache<qint64, QGLTexture> m_cache; |
554 QCache<qint64, QGLTexture> m_cache; |
550 }; |
555 }; |
551 |
556 |
571 : GL_TEXTURE_2D; |
576 : GL_TEXTURE_2D; |
572 #endif |
577 #endif |
573 } |
578 } |
574 |
579 |
575 // One resource per group of shared contexts. |
580 // One resource per group of shared contexts. |
576 class Q_AUTOTEST_EXPORT QGLContextResource |
581 class Q_OPENGL_EXPORT QGLContextResource |
577 { |
582 { |
578 public: |
583 public: |
579 typedef void (*FreeFunc)(void *); |
584 typedef void (*FreeFunc)(void *); |
580 QGLContextResource(FreeFunc f); |
585 QGLContextResource(FreeFunc f); |
581 ~QGLContextResource(); |
586 ~QGLContextResource(); |