Qt 4.8
Classes | Functions | Variables
qpixmapdata_gl.cpp File Reference
#include "qpixmap.h"
#include "qglframebufferobject.h"
#include <private/qpaintengine_raster_p.h>
#include "qpixmapdata_gl_p.h"
#include <private/qgl_p.h>
#include <private/qdrawhelper_p.h>
#include <private/qimage_p.h>
#include <private/qfont_p.h>
#include <private/qpaintengineex_opengl2_p.h>
#include <qdesktopwidget.h>
#include <qfile.h>
#include <qimagereader.h>
#include <qbuffer.h>

Go to the source code of this file.

Classes

struct  TextureBuffer
 

Functions

static int areaDiff (const QSize &size, const QGLFramebufferObject *fbo)
 
static QSize maybeRoundToNextPowerOfTwo (const QSize &sz)
 
QGLFramebufferObjectPoolqgl_fbo_pool ()
 
QRgb qt_gl_convertToGLFormat (QRgb src_pixel, GLenum texture_format)
 
QImage qt_gl_read_texture (const QSize &size, bool alpha_format, bool include_alpha)
 
Q_OPENGL_EXPORT const QGLContextqt_gl_share_context ()
 
int qt_next_power_of_two (int v)
 

Variables

static int qt_gl_pixmap_serial = 0
 

Function Documentation

◆ areaDiff()

static int areaDiff ( const QSize size,
const QGLFramebufferObject fbo 
)
inlinestatic

Definition at line 81 of file qpixmapdata_gl.cpp.

Referenced by QGLFramebufferObjectPool::acquire().

82 {
83  return qAbs(size.width() * size.height() - fbo->width() * fbo->height());
84 }
int height() const
Definition: qpaintdevice.h:92
Q_DECL_CONSTEXPR T qAbs(const T &t)
Definition: qglobal.h:1201
int width() const
Returns the width.
Definition: qsize.h:126
int width() const
Definition: qpaintdevice.h:91
int height() const
Returns the height.
Definition: qsize.h:129

◆ maybeRoundToNextPowerOfTwo()

static QSize maybeRoundToNextPowerOfTwo ( const QSize sz)
inlinestatic

Definition at line 88 of file qpixmapdata_gl.cpp.

Referenced by QGLFramebufferObjectPool::acquire().

89 {
90 #ifdef QT_OPENGL_ES_2
92  if (rounded.width() * rounded.height() < 1.20 * sz.width() * sz.height())
93  return rounded;
94 #endif
95  return sz;
96 }
int qt_next_power_of_two(int v)
Definition: qgl.cpp:1886
int width() const
Returns the width.
Definition: qsize.h:126
int height() const
Returns the height.
Definition: qsize.h:129
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ qgl_fbo_pool()

QGLFramebufferObjectPool* qgl_fbo_pool ( )

Definition at line 663 of file qpixmapdata_gl.cpp.

Referenced by QGLPixmapGLPaintDevice::endPaint(), QGLWindowSurface::flush(), and QGLPixmapData::paintEngine().

664 {
665  return _qgl_fbo_pool();
666 }

◆ qt_gl_convertToGLFormat()

QRgb qt_gl_convertToGLFormat ( QRgb  src_pixel,
GLenum  texture_format 
)

Definition at line 2281 of file qgl.cpp.

Referenced by QGLPixmapData::bind(), and QGLPixmapData::paintEngine().

2282 {
2283  return qt_gl_convertToGLFormatHelper(src_pixel, texture_format);
2284 }
static QRgb qt_gl_convertToGLFormatHelper(QRgb src_pixel, GLenum texture_format)
Definition: qgl.cpp:2259

◆ qt_gl_read_texture()

QImage qt_gl_read_texture ( const QSize size,
bool  alpha_format,
bool  include_alpha 
)

Definition at line 1871 of file qgl.cpp.

Referenced by QGLPixmapData::fillImage(), and QGLPixmapData::toImage().

1872 {
1874  int w = size.width();
1875  int h = size.height();
1876 #if !defined(QT_OPENGL_ES_2) && !defined(QT_OPENGL_ES_1)
1877  //### glGetTexImage not in GL ES 2.0, need to do something else here!
1878  glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, img.bits());
1879 #endif
1880  convertFromGLImage(img, w, h, alpha_format, include_alpha);
1881  return img;
1882 }
#define GL_TEXTURE_2D
int width() const
Returns the width.
Definition: qsize.h:126
static void convertFromGLImage(QImage &img, int w, int h, bool alpha_format, bool include_alpha)
Definition: qgl.cpp:1818
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
#define GL_UNSIGNED_BYTE
int height() const
Returns the height.
Definition: qsize.h:129
#define GL_RGBA

◆ qt_gl_share_context()

Q_OPENGL_EXPORT const QGLContext* qt_gl_share_context ( )

Definition at line 284 of file qwindowsurface_gl.cpp.

Referenced by QGLPixmapData::copy(), QGLPixmapData::copyBackFromRenderFbo(), QGLPixmapData::createPixmapForImage(), QGLPixmapData::ensureCreated(), QGLPixmapData::fromData(), QGLPixmapData::fromFile(), QGLWindowSurface::hijackWindow(), QGLPixmapData::isValidContext(), QGLPixmapData::paintEngine(), QGLPixmapData::resize(), QGLPixmapData::toImage(), QGLPixmapData::~QGLPixmapData(), and QGLWindowSurface::~QGLWindowSurface().

285 {
287  if (widget)
288  return widget->context();
289  return 0;
290 }
QPointer< QWidget > widget
const QGLContext * context() const
Returns the context of this widget.
Definition: qgl.cpp:5303
The QGLWidget class is a widget for rendering OpenGL graphics.
Definition: qgl.h:474
QGLWidget * qt_gl_share_widget()

◆ qt_next_power_of_two()

int qt_next_power_of_two ( int  v)

Definition at line 1886 of file qgl.cpp.

Referenced by areaDiff(), and maybeRoundToNextPowerOfTwo().

1887 {
1888  v--;
1889  v |= v >> 1;
1890  v |= v >> 2;
1891  v |= v >> 4;
1892  v |= v >> 8;
1893  v |= v >> 16;
1894  ++v;
1895  return v;
1896 }

Variable Documentation

◆ qt_gl_pixmap_serial

int qt_gl_pixmap_serial = 0
static