summaryrefslogtreecommitdiffstats
path: root/recipes-qt/qt5/qtbase-git/0010-QOpenGLPaintDevice-sub-area-support.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-qt/qt5/qtbase-git/0010-QOpenGLPaintDevice-sub-area-support.patch')
-rw-r--r--recipes-qt/qt5/qtbase-git/0010-QOpenGLPaintDevice-sub-area-support.patch152
1 files changed, 152 insertions, 0 deletions
diff --git a/recipes-qt/qt5/qtbase-git/0010-QOpenGLPaintDevice-sub-area-support.patch b/recipes-qt/qt5/qtbase-git/0010-QOpenGLPaintDevice-sub-area-support.patch
new file mode 100644
index 00000000..db979bd4
--- /dev/null
+++ b/recipes-qt/qt5/qtbase-git/0010-QOpenGLPaintDevice-sub-area-support.patch
@@ -0,0 +1,152 @@
1From 709c35b889e46f2b1bc36d88c732f1b440e6c236 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 10/11] 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 | 9 +++++++--
18 src/gui/opengl/qopenglpaintengine_p.h | 1 +
19 src/gui/opengl/qopengltextureglyphcache.cpp | 2 +-
20 5 files changed, 23 insertions(+), 3 deletions(-)
21
22diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp
23index 59bca6e..ea0ee88 100644
24--- a/src/gui/opengl/qopenglpaintdevice.cpp
25+++ b/src/gui/opengl/qopenglpaintdevice.cpp
26@@ -103,6 +103,7 @@ class QOpenGLPaintDevicePrivate
27 public:
28 QOpenGLPaintDevicePrivate(const QSize &size);
29
30+ QPoint offset;
31 QSize size;
32 QOpenGLContext *ctx;
33
34@@ -151,6 +152,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@@ -220,6 +227,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 e1be9b5..1a3ddbc 100644
61--- a/src/gui/opengl/qopenglpaintdevice.h
62+++ b/src/gui/opengl/qopenglpaintdevice.h
63@@ -54,12 +54,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 21bc4a9..ce008a4 100644
80--- a/src/gui/opengl/qopenglpaintengine.cpp
81+++ b/src/gui/opengl/qopenglpaintengine.cpp
82@@ -1999,7 +1999,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@@ -2084,7 +2087,7 @@ void QOpenGL2PaintEngineEx::ensureActive()
94 d->device->ensureActiveTarget();
95
96 d->transferMode(BrushDrawingMode);
97- d->funcs.glViewport(0, 0, d->width, d->height);
98+ d->funcs.glViewport(d->x, d->y, d->width, d->height);
99 d->needsSync = false;
100 d->lastMaskTextureUsed = 0;
101 d->shaderManager->setDirty();
102@@ -2127,6 +2130,7 @@ void QOpenGL2PaintEngineExPrivate::updateClipScissorTest()
103 if (bounds == QRect(0, 0, width, height)) {
104 funcs.glDisable(GL_SCISSOR_TEST);
105 } else {
106+ bounds = QRect(bounds.x(), bounds.y(), bounds.width(), bounds.height());
107 funcs.glEnable(GL_SCISSOR_TEST);
108 setScissor(bounds);
109 }
110@@ -2135,12 +2139,13 @@ 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 funcs.glScissor(left, bottom, width, height);
125diff --git a/src/gui/opengl/qopenglpaintengine_p.h b/src/gui/opengl/qopenglpaintengine_p.h
126index 5ef0366..c5b517d 100644
127--- a/src/gui/opengl/qopenglpaintengine_p.h
128+++ b/src/gui/opengl/qopenglpaintengine_p.h
129@@ -256,6 +256,7 @@ public:
130 QOpenGL2PaintEngineEx* q;
131 QOpenGLEngineShaderManager* shaderManager;
132 QOpenGLPaintDevice* device;
133+ int x, y;
134 int width, height;
135 QOpenGLContext *ctx;
136 EngineMode mode;
137diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp
138index 6e16b2d..ddec9bb 100644
139--- a/src/gui/opengl/qopengltextureglyphcache.cpp
140+++ b/src/gui/opengl/qopengltextureglyphcache.cpp
141@@ -308,7 +308,7 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height)
142 funcs->glBindFramebuffer(GL_FRAMEBUFFER, (GLuint)oldFbo);
143
144 if (pex != 0) {
145- funcs->glViewport(0, 0, pex->width, pex->height);
146+ funcs->glViewport(pex->x, pex->y, pex->width, pex->height);
147 pex->updateClipScissorTest();
148 } else {
149 if (m_vao.isCreated()) {
150--
1512.1.1
152