diff options
Diffstat (limited to 'recipes-qt/qt5/qtbase/0009-QOpenGLPaintDevice-sub-area-support.patch')
-rw-r--r-- | recipes-qt/qt5/qtbase/0009-QOpenGLPaintDevice-sub-area-support.patch | 157 |
1 files changed, 157 insertions, 0 deletions
diff --git a/recipes-qt/qt5/qtbase/0009-QOpenGLPaintDevice-sub-area-support.patch b/recipes-qt/qt5/qtbase/0009-QOpenGLPaintDevice-sub-area-support.patch new file mode 100644 index 00000000..f7062ffe --- /dev/null +++ b/recipes-qt/qt5/qtbase/0009-QOpenGLPaintDevice-sub-area-support.patch | |||
@@ -0,0 +1,157 @@ | |||
1 | From 47ee1da94f74c46fd692bcd55c2770f6c3be92f3 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jani Hautakangas <jani.hautakangas@ixonos.com> | ||
3 | Date: Thu, 16 May 2013 09:52:07 +0300 | ||
4 | Subject: [PATCH 09/13] QOpenGLPaintDevice sub-area support | ||
5 | |||
6 | Allows creating QOpenGLPaintDevice targetting sub-area | ||
7 | of binded framebuffer. | ||
8 | |||
9 | Upstream-Status: Pending | ||
10 | |||
11 | Change-Id: Ida2f079aa1ac0b87d36b54129e226399dbcdda80 | ||
12 | |||
13 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
14 | --- | ||
15 | src/gui/opengl/qopenglpaintdevice.cpp | 11 +++++++++++ | ||
16 | src/gui/opengl/qopenglpaintdevice.h | 2 ++ | ||
17 | src/gui/opengl/qopenglpaintdevice_p.h | 1 + | ||
18 | src/gui/opengl/qopenglpaintengine.cpp | 9 +++++++-- | ||
19 | src/gui/opengl/qopenglpaintengine_p.h | 1 + | ||
20 | src/gui/opengl/qopengltextureglyphcache.cpp | 2 +- | ||
21 | 6 files changed, 23 insertions(+), 3 deletions(-) | ||
22 | |||
23 | diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp | ||
24 | index a08d26f..cff3155 100644 | ||
25 | --- a/src/gui/opengl/qopenglpaintdevice.cpp | ||
26 | +++ b/src/gui/opengl/qopenglpaintdevice.cpp | ||
27 | @@ -135,6 +135,12 @@ QOpenGLPaintDevice::QOpenGLPaintDevice(int width, int height) | ||
28 | { | ||
29 | } | ||
30 | |||
31 | +QOpenGLPaintDevice::QOpenGLPaintDevice(int x, int y, int width, int height) | ||
32 | + : d_ptr(new QOpenGLPaintDevicePrivate(QSize(width, height))) | ||
33 | +{ | ||
34 | + d_ptr->offset = QPoint(x,y); | ||
35 | +} | ||
36 | + | ||
37 | /*! | ||
38 | \internal | ||
39 | */ | ||
40 | @@ -212,6 +218,11 @@ QOpenGLContext *QOpenGLPaintDevice::context() const | ||
41 | return d_ptr->ctx; | ||
42 | } | ||
43 | |||
44 | +QPoint QOpenGLPaintDevice::offset() const | ||
45 | +{ | ||
46 | + return d_ptr->offset; | ||
47 | +} | ||
48 | + | ||
49 | /*! | ||
50 | Returns the pixel size of the paint device. | ||
51 | |||
52 | diff --git a/src/gui/opengl/qopenglpaintdevice.h b/src/gui/opengl/qopenglpaintdevice.h | ||
53 | index 10cee84..a6683c5 100644 | ||
54 | --- a/src/gui/opengl/qopenglpaintdevice.h | ||
55 | +++ b/src/gui/opengl/qopenglpaintdevice.h | ||
56 | @@ -53,12 +53,14 @@ public: | ||
57 | QOpenGLPaintDevice(); | ||
58 | explicit QOpenGLPaintDevice(const QSize &size); | ||
59 | QOpenGLPaintDevice(int width, int height); | ||
60 | + QOpenGLPaintDevice(int x, int y, int width, int height); | ||
61 | virtual ~QOpenGLPaintDevice(); | ||
62 | |||
63 | int devType() const { return QInternal::OpenGL; } | ||
64 | QPaintEngine *paintEngine() const; | ||
65 | |||
66 | QOpenGLContext *context() const; | ||
67 | + QPoint offset() const; | ||
68 | QSize size() const; | ||
69 | void setSize(const QSize &size); | ||
70 | void setDevicePixelRatio(qreal devicePixelRatio); | ||
71 | diff --git a/src/gui/opengl/qopenglpaintdevice_p.h b/src/gui/opengl/qopenglpaintdevice_p.h | ||
72 | index 0b01129..211f2f3 100644 | ||
73 | --- a/src/gui/opengl/qopenglpaintdevice_p.h | ||
74 | +++ b/src/gui/opengl/qopenglpaintdevice_p.h | ||
75 | @@ -65,6 +65,7 @@ public: | ||
76 | |||
77 | public: | ||
78 | QSize size; | ||
79 | + QPoint offset; | ||
80 | QOpenGLContext *ctx; | ||
81 | |||
82 | qreal dpmx; | ||
83 | diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp | ||
84 | index 8eeaa31..e17520e 100644 | ||
85 | --- a/src/gui/opengl/qopenglpaintengine.cpp | ||
86 | +++ b/src/gui/opengl/qopenglpaintengine.cpp | ||
87 | @@ -2080,7 +2080,10 @@ bool QOpenGL2PaintEngineEx::begin(QPaintDevice *pdev) | ||
88 | for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i) | ||
89 | d->vertexAttributeArraysEnabledState[i] = false; | ||
90 | |||
91 | + const QPoint offset = d->device->offset(); | ||
92 | const QSize sz = d->device->size(); | ||
93 | + d->x = offset.x(); | ||
94 | + d->y = offset.y(); | ||
95 | d->width = sz.width(); | ||
96 | d->height = sz.height(); | ||
97 | d->mode = BrushDrawingMode; | ||
98 | @@ -2167,7 +2170,7 @@ void QOpenGL2PaintEngineEx::ensureActive() | ||
99 | d->device->ensureActiveTarget(); | ||
100 | |||
101 | d->transferMode(BrushDrawingMode); | ||
102 | - d->funcs.glViewport(0, 0, d->width, d->height); | ||
103 | + d->funcs.glViewport(d->x, d->y, d->width, d->height); | ||
104 | d->needsSync = false; | ||
105 | d->shaderManager->setDirty(); | ||
106 | d->syncGlState(); | ||
107 | @@ -2209,6 +2212,7 @@ void QOpenGL2PaintEngineExPrivate::updateClipScissorTest() | ||
108 | if (bounds == QRect(0, 0, width, height)) { | ||
109 | funcs.glDisable(GL_SCISSOR_TEST); | ||
110 | } else { | ||
111 | + bounds = QRect(bounds.x(), bounds.y(), bounds.width(), bounds.height()); | ||
112 | funcs.glEnable(GL_SCISSOR_TEST); | ||
113 | setScissor(bounds); | ||
114 | } | ||
115 | @@ -2217,12 +2221,13 @@ void QOpenGL2PaintEngineExPrivate::updateClipScissorTest() | ||
116 | |||
117 | void QOpenGL2PaintEngineExPrivate::setScissor(const QRect &rect) | ||
118 | { | ||
119 | - const int left = rect.left(); | ||
120 | + const int left = rect.left() + x; | ||
121 | const int width = rect.width(); | ||
122 | int bottom = height - (rect.top() + rect.height()); | ||
123 | if (device->paintFlipped()) { | ||
124 | bottom = rect.top(); | ||
125 | } | ||
126 | + bottom += y; | ||
127 | const int height = rect.height(); | ||
128 | |||
129 | funcs.glScissor(left, bottom, width, height); | ||
130 | diff --git a/src/gui/opengl/qopenglpaintengine_p.h b/src/gui/opengl/qopenglpaintengine_p.h | ||
131 | index 9722ea3..07e3163 100644 | ||
132 | --- a/src/gui/opengl/qopenglpaintengine_p.h | ||
133 | +++ b/src/gui/opengl/qopenglpaintengine_p.h | ||
134 | @@ -264,6 +264,7 @@ public: | ||
135 | QOpenGL2PaintEngineEx* q; | ||
136 | QOpenGLEngineShaderManager* shaderManager; | ||
137 | QOpenGLPaintDevice* device; | ||
138 | + int x, y; | ||
139 | int width, height; | ||
140 | QOpenGLContext *ctx; | ||
141 | EngineMode mode; | ||
142 | diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp | ||
143 | index cd268cd..997bc35 100644 | ||
144 | --- a/src/gui/opengl/qopengltextureglyphcache.cpp | ||
145 | +++ b/src/gui/opengl/qopengltextureglyphcache.cpp | ||
146 | @@ -310,7 +310,7 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) | ||
147 | funcs->glBindFramebuffer(GL_FRAMEBUFFER, (GLuint)oldFbo); | ||
148 | |||
149 | if (pex != 0) { | ||
150 | - funcs->glViewport(0, 0, pex->width, pex->height); | ||
151 | + funcs->glViewport(pex->x, pex->y, pex->width, pex->height); | ||
152 | pex->updateClipScissorTest(); | ||
153 | } else { | ||
154 | if (m_vao.isCreated()) { | ||
155 | -- | ||
156 | 2.3.1 | ||
157 | |||