Qt 4.8
Classes | Macros | Functions | Variables
qpaintengineex_opengl2.cpp File Reference
#include "qglgradientcache_p.h"
#include "qpaintengineex_opengl2_p.h"
#include <string.h>
#include <qmath.h>
#include <private/qgl_p.h>
#include <private/qmath_p.h>
#include <private/qpaintengineex_p.h>
#include <QPaintEngine>
#include <private/qpainter_p.h>
#include <private/qfontengine_p.h>
#include <private/qpixmapdata_gl_p.h>
#include <private/qdatabuffer_p.h>
#include <private/qstatictext_p.h>
#include <private/qtriangulator_p.h>
#include "qglengineshadermanager_p.h"
#include "qgl2pexvertexarray_p.h"
#include "qtriangulatingstroker_p.h"
#include "qtextureglyphcache_gl_p.h"
#include <QDebug>

Go to the source code of this file.

Classes

struct  QGL2PEVectorPathCache
 

Macros

#define QT_MAX_CACHED_GLYPH_SIZE   64
 

Functions

static bool fontSmoothingApproximately (qreal target)
 
static bool isPowerOfTwo (uint x)
 
Q_GUI_EXPORT QImage qt_imageForBrush (int brushStyle, bool invert)
 
QColor qt_premultiplyColor (QColor c, GLfloat opacity)
 
Q_GUI_EXPORT bool qt_scaleForTransform (const QTransform &transform, qreal *scale)
 
static qreal qt_sRGB_to_linear_RGB (qreal f)
 
static const QRectF scaleRect (const QRectF &r, qreal sx, qreal sy)
 
static void setCoords (GLfloat *coords, const QGLRect &rect)
 

Variables

bool qt_applefontsmoothing_enabled
 
Q_GUI_EXPORT bool qt_cleartype_enabled
 

Macro Definition Documentation

◆ QT_MAX_CACHED_GLYPH_SIZE

#define QT_MAX_CACHED_GLYPH_SIZE   64

Function Documentation

◆ fontSmoothingApproximately()

static bool fontSmoothingApproximately ( qreal  target)
static

Definition at line 1578 of file qpaintengineex_opengl2.cpp.

Referenced by QGL2PaintEngineEx::begin(), and QGL2PaintEngineExPrivate::drawCachedGlyphs().

1579 {
1580  extern Q_GUI_EXPORT qreal qt_fontsmoothing_gamma; // qapplication_win.cpp
1581  return (qAbs(qt_fontsmoothing_gamma - target) < 0.2);
1582 }
double qreal
Definition: qglobal.h:1193
#define Q_GUI_EXPORT
Definition: qglobal.h:1450
Q_DECL_CONSTEXPR T qAbs(const T &t)
Definition: qglobal.h:1201
Q_GUI_EXPORT qreal qt_fontsmoothing_gamma

◆ isPowerOfTwo()

static bool isPowerOfTwo ( uint  x)
inlinestatic

Definition at line 93 of file qpaintengineex_opengl2.cpp.

Referenced by QGL2PaintEngineExPrivate::drawCachedGlyphs(), and QGL2PaintEngineExPrivate::updateBrushTexture().

94 {
95  return x && !(x & (x - 1));
96 }

◆ qt_imageForBrush()

Q_GUI_EXPORT QImage qt_imageForBrush ( int  brushStyle,
bool  invert 
)

Definition at line 167 of file qbrush.cpp.

Referenced by QGL2PaintEngineExPrivate::updateBrushTexture().

168 {
169  return qt_brushPatternImageCache()->getImage(brushStyle, invert);
170 }

◆ qt_premultiplyColor()

QColor qt_premultiplyColor ( QColor  c,
GLfloat  opacity 
)
inline

Definition at line 151 of file qpaintengineex_opengl2.cpp.

Referenced by QGL2PaintEngineExPrivate::drawCachedGlyphs(), QGL2PaintEngineExPrivate::drawPixmapFragments(), QGL2PaintEngineExPrivate::drawTexture(), and QGL2PaintEngineExPrivate::updateBrushUniforms().

152 {
153  qreal alpha = c.alphaF() * opacity;
154  c.setAlphaF(alpha);
155  c.setRedF(c.redF() * alpha);
156  c.setGreenF(c.greenF() * alpha);
157  c.setBlueF(c.blueF() * alpha);
158  return c;
159 }
qreal alphaF() const
Returns the alpha color component of this color.
Definition: qcolor.cpp:1106
double qreal
Definition: qglobal.h:1193
unsigned char c[8]
Definition: qnumeric_p.h:62
qreal greenF() const
Returns the green color component of this color.
Definition: qcolor.cpp:1241
void setGreenF(qreal green)
Sets the green color component of this color to green.
Definition: qcolor.cpp:1255
void setRedF(qreal red)
Sets the red color component of this color to red.
Definition: qcolor.cpp:1227
void setBlueF(qreal blue)
Sets the blue color component of this color to blue.
Definition: qcolor.cpp:1282
void setAlphaF(qreal alpha)
Sets the alpha of this color to alpha.
Definition: qcolor.cpp:1117
qreal redF() const
Returns the red color component of this color.
Definition: qcolor.cpp:1213
qreal blueF() const
Returns the blue color component of this color.
Definition: qcolor.cpp:1269

◆ qt_scaleForTransform()

Q_GUI_EXPORT bool qt_scaleForTransform ( const QTransform transform,
qreal scale 
)

Definition at line 2407 of file qtransform.cpp.

Referenced by QGL2PaintEngineEx::fill(), and QGL2PaintEngineEx::stroke().

2408 {
2409  const QTransform::TransformationType type = transform.type();
2410  if (type <= QTransform::TxTranslate) {
2411  if (scale)
2412  *scale = 1;
2413  return true;
2414  } else if (type == QTransform::TxScale) {
2415  const qreal xScale = qAbs(transform.m11());
2416  const qreal yScale = qAbs(transform.m22());
2417  if (scale)
2418  *scale = qMax(xScale, yScale);
2419  return qFuzzyCompare(xScale, yScale);
2420  }
2421 
2422  const qreal xScale = transform.m11() * transform.m11()
2423  + transform.m21() * transform.m21();
2424  const qreal yScale = transform.m12() * transform.m12()
2425  + transform.m22() * transform.m22();
2426  if (scale)
2427  *scale = qSqrt(qMax(xScale, yScale));
2428  return type == QTransform::TxRotate && qFuzzyCompare(xScale, yScale);
2429 }
int type
Definition: qmetatype.cpp:239
double qreal
Definition: qglobal.h:1193
qreal m21() const
Returns the horizontal shearing factor.
Definition: qtransform.h:249
qreal m22() const
Returns the vertical scaling factor.
Definition: qtransform.h:253
Q_DECL_CONSTEXPR T qAbs(const T &t)
Definition: qglobal.h:1201
TransformationType type() const
Returns the transformation type of this matrix.
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
qreal m12() const
Returns the vertical shearing factor.
Definition: qtransform.h:241
TransformationType
Definition: qtransform.h:68
bool qFuzzyCompare(const QMatrix &m1, const QMatrix &m2)
The qFuzzyCompare function is for comparing two matrices using a fuzziness factor.
Definition: qmatrix.h:172
qreal qSqrt(qreal v)
Definition: qmath.h:205
qreal m11() const
Returns the horizontal scaling factor.
Definition: qtransform.h:237

◆ qt_sRGB_to_linear_RGB()

static qreal qt_sRGB_to_linear_RGB ( qreal  f)
inlinestatic

Definition at line 1585 of file qpaintengineex_opengl2.cpp.

Referenced by QGL2PaintEngineExPrivate::drawCachedGlyphs().

1586 {
1587  return f > 0.04045 ? qPow((f + 0.055) / 1.055, 2.4) : f / 12.92;
1588 }
qreal qPow(qreal x, qreal y)
Definition: qmath.h:244

◆ scaleRect()

static const QRectF scaleRect ( const QRectF r,
qreal  sx,
qreal  sy 
)
static

Definition at line 1369 of file qpaintengineex_opengl2.cpp.

Referenced by QGL2PaintEngineEx::drawImage(), and QGL2PaintEngineEx::drawPixmap().

1370 {
1371  return QRectF(r.x() * sx, r.y() * sy, r.width() * sx, r.height() * sy);
1372 }
qreal y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:667
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
qreal height() const
Returns the height of the rectangle.
Definition: qrect.h:710
qreal width() const
Returns the width of the rectangle.
Definition: qrect.h:707
qreal x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:664

◆ setCoords()

static void setCoords ( GLfloat *  coords,
const QGLRect rect 
)
inlinestatic

Definition at line 511 of file qpaintengineex_opengl2.cpp.

Referenced by QGL2PaintEngineExPrivate::composite(), QGL2PaintEngineExPrivate::drawTexture(), and QRect::QRect().

512 {
513  coords[0] = rect.left;
514  coords[1] = rect.top;
515  coords[2] = rect.right;
516  coords[3] = rect.top;
517  coords[4] = rect.right;
518  coords[5] = rect.bottom;
519  coords[6] = rect.left;
520  coords[7] = rect.bottom;
521 }

Variable Documentation

◆ qt_applefontsmoothing_enabled

bool qt_applefontsmoothing_enabled

◆ qt_cleartype_enabled

Q_GUI_EXPORT bool qt_cleartype_enabled

Definition at line 241 of file qapplication_win.cpp.

Referenced by QGL2PaintEngineEx::begin(), and isPowerOfTwo().