44 #include "private/qglengineshadersource_p.h" 46 #if defined QT_OPENGL_ES_2 && !defined(QT_NO_EGL) 47 #include "private/qeglcontext_p.h" 63 , m_filterMode(Nearest)
64 , m_serialNumber(qgltextureglyphcache_serial_number.fetchAndAddRelaxed(1))
66 #ifdef QT_GL_TEXTURE_GLYPH_CACHE_DEBUG 67 qDebug(
" -> QGLTextureGlyphCache() %p for context %p.",
this,
ctx);
92 #ifdef QT_GL_TEXTURE_GLYPH_CACHE_DEBUG 93 qDebug(
" -> ~QGLTextureGlyphCache() %p.",
this);
107 qWarning(
"QGLTextureGlyphCache::createTextureData: Called with no context");
124 glGenTextures(1, &glyphTexture->
m_texture);
132 for (
int i = 0; i < data.
size(); ++i)
137 for (
int i = 0; i < data.
size(); ++i)
152 qWarning(
"QGLTextureGlyphCache::resizeTextureData: Called with no context");
157 int oldWidth = glyphTexture->
m_width;
158 int oldHeight = glyphTexture->
m_height;
166 GLuint oldTexture = glyphTexture->
m_texture;
173 glDeleteTextures(1, &oldTexture);
183 glGenTextures(1, &tmp_texture);
207 glViewport(0, 0, oldWidth, oldHeight);
266 glCopyTexSubImage2D(
GL_TEXTURE_2D, 0, 0, 0, 0, 0, oldWidth, oldHeight);
270 glDeleteTextures(1, &tmp_texture);
271 glDeleteTextures(1, &oldTexture);
284 qWarning(
"QGLTextureGlyphCache::fillTexture: Called with no context");
296 for (
int i=0; i<c.
h; ++i) {
304 const int maskWidth = mask.
width();
305 const int maskHeight = mask.
height();
309 for (
int y = 0; y < maskHeight; ++y) {
311 for (
int x = 0; x < maskWidth; ++x)
317 for (
int y = 0; y < maskHeight; ++y) {
319 for (
int x = 0; x < maskWidth; ++x) {
320 uchar r = src[x] >> 16;
321 uchar g = src[x] >> 8;
324 src[x] = (src[x] & 0x00ffffff) | (avg << 24);
350 for (
int i = 0; i < maskHeight; ++i)
void bindAttributeLocation(const char *name, int location)
Binds the attribute name to the specified location.
static bool hasOpenGLFramebufferObjects()
Returns true if the OpenGL GL_EXT_framebuffer_object extension is present on this system; otherwise r...
virtual int maxTextureWidth() const
void disableAttributeArray(int location)
Disables the vertex array at location in this shader program that was enabled by a previous call to e...
QScopedPointer< QGLContextPrivate > d_ptr
void setVertexAttributePointer(unsigned int arrayIndex, const GLfloat *pointer)
#define GL_TEXTURE_MIN_FILTER
bool compileSourceCode(const char *source)
Sets the source code for this shader and compiles it.
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
T * value(const QGLContext *context)
#define QT_END_NAMESPACE
This macro expands to.
QHash< GlyphAndSubPixelPosition, Coord > coords
Q_GUI_EXPORT bool qt_cleartype_enabled
QGLEngineShaderManager * shaderManager
static const char *const qglslMainFragmentShader
#define QT_IMAGE_TEXTURE_UNIT
const QImage & image() const
virtual void fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition)
QGLShaderProgram * blitProgram()
The QByteArray class provides an array of bytes.
virtual void fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition)
virtual void createTextureData(int width, int height)
#define glVertexAttribPointer
#define GL_TEXTURE_WRAP_S
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
GLfloat m_vertexCoordinateArray[8]
int bytesPerLine() const
Returns the number of bytes per image scanline.
uint workaround_brokenTexSubImage
#define GL_FRAMEBUFFER_EXT
The QString class provides a Unicode character string.
QImage textureMapForGlyph(glyph_t g, QFixed subPixelPosition) const
void updateClipScissorTest()
#define Q_BASIC_ATOMIC_INITIALIZER(a)
virtual int maxTextureHeight() const
#define glBindFramebuffer
void cleanup(const QGLContext *context)
QFontEngineGlyphCache::Type m_type
Format format() const
Returns the format of the image.
#define GL_COLOR_ATTACHMENT0_EXT
uint workaround_brokenAlphaTexSubImage
virtual void createTextureData(int width, int height)
static const GLuint QT_OPACITY_ATTR
const QGLContext * context() const
Q_CORE_EXPORT void qDebug(const char *,...)
QGLContextGroupResource< QGLGlyphTexture > m_textureResource
#define QT_BEGIN_NAMESPACE
This macro expands to.
virtual void resizeTextureData(int width, int height)
The QGLContext class encapsulates an OpenGL rendering context.
#define GL_RENDERBUFFER_EXT
GLfloat m_textureCoordinateArray[8]
The QGLShader class allows OpenGL shaders to be compiled.
uint workaround_brokenAlphaTexSubImage_init
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
virtual int glyphPadding() const
static const char * data(const QByteArray &arr)
QGLTextureGlyphCache(const QGLContext *context, QFontEngineGlyphCache::Type type, const QTransform &matrix)
const uchar * constBits() const
Returns a pointer to the first pixel data.
int indexOf(char c, int from=0) const
Returns the index position of the first occurrence of the character ch in the byte array...
virtual bool link()
Links together the shaders that were added to this program with addShader().
uchar * bits()
Returns a pointer to the first pixel data.
#define GL_TEXTURE_WRAP_T
int width() const
Returns the width of the image.
QImage convertToFormat(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) const Q_REQUIRED_RESULT
Returns a copy of the image in the given format.
QString & append(QChar c)
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.
QGLShaderProgram * m_blitProgram
static const GLuint QT_TEXTURE_COORDS_ATTR
int height() const
Returns the height of the image.
bool addShader(QGLShader *shader)
Adds a compiled shader to this shader program.
static const char *const qglslMainWithTexCoordsVertexShader
QBasicAtomicInt qgltextureglyphcache_serial_number
#define glFramebufferRenderbuffer
void transferMode(EngineMode newMode)
virtual int maxTextureWidth() const
static const char *const qglslImageSrcFragmentShader
static const char *const qglslUntransformedPositionVertexShader
#define GL_TEXTURE_MAG_FILTER
static const GLuint QT_VERTEX_COORDS_ATTR
bool bind()
Binds this shader program to the active QGLContext and makes it the current shader program...
#define glFramebufferTexture2D
QGL2PaintEngineExPrivate * pex
void enableAttributeArray(int location)
Enables the vertex array at location in this shader program so that the value set by setAttributeArra...
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
virtual void resizeTextureData(int width, int height)
uchar * scanLine(int)
Returns a pointer to the pixel data at the scanline with index i.
uint workaround_brokenFBOReadBack
void setContext(const QGLContext *context)
virtual int maxTextureHeight() const