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