[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kwin/scaling_merged] /: scale surface damage events
From: David Edmundson <kde () davidedmundson ! co ! uk>
Date: 2016-11-24 20:48:40
Message-ID: E1cA0wi-0000TY-5x () code ! kde ! org
[Download RAW message or body]
Git commit c4d21f6c9fb6b33aefdf7146d217cc77623beed4 by David Edmundson.
Committed on 23/11/2016 at 17:15.
Pushed by davidedmundson into branch 'scaling_merged'.
scale surface damage events
M +12 -6 abstract_egl_backend.cpp
https://commits.kde.org/kwin/c4d21f6c9fb6b33aefdf7146d217cc77623beed4
diff --git a/abstract_egl_backend.cpp b/abstract_egl_backend.cpp
index e019d5c..c86d6df 100644
--- a/abstract_egl_backend.cpp
+++ b/abstract_egl_backend.cpp
@@ -351,27 +351,32 @@ void AbstractEglTexture::updateTexture(WindowPixmap *pixmap)
q->bind();
const QRegion damage = s->trackedDamage();
s->resetTrackedDamage();
+ auto scale = s->scale(); //damage is normalised, so needs converting up to match \
texture
// TODO: this should be shared with GLTexture::update
if (GLPlatform::instance()->isGLES()) {
+
if (s_supportsARGB32 && (image.format() == QImage::Format_ARGB32 || \
image.format() == QImage::Format_ARGB32_Premultiplied)) {
const QImage im = \
image.convertToFormat(QImage::Format_ARGB32_Premultiplied); for (const QRect &rect : \
damage.rects()) {
- glTexSubImage2D(m_target, 0, rect.x(), rect.y(), rect.width(), \
rect.height(),
- GL_BGRA_EXT, GL_UNSIGNED_BYTE, \
im.copy(rect).bits()); + auto scaledRect = QRect(rect.x() * scale, \
rect.y() * scale, rect.width() * scale, rect.height() * scale); + \
glTexSubImage2D(m_target, 0, scaledRect.x(), scaledRect.y(), scaledRect.width(), \
scaledRect.height(), + GL_BGRA_EXT, GL_UNSIGNED_BYTE, \
im.copy(scaledRect).bits()); }
} else {
const QImage im = \
image.convertToFormat(QImage::Format_RGBA8888_Premultiplied); for (const QRect &rect \
: damage.rects()) {
- glTexSubImage2D(m_target, 0, rect.x(), rect.y(), rect.width(), \
rect.height(),
- GL_RGBA, GL_UNSIGNED_BYTE, im.copy(rect).bits());
+ auto scaledRect = QRect(rect.x() * scale, rect.y() * scale, \
rect.width() * scale, rect.height() * scale); + \
glTexSubImage2D(m_target, 0, scaledRect.x(), scaledRect.y(), scaledRect.width(), \
scaledRect.height(), + GL_RGBA, GL_UNSIGNED_BYTE, \
im.copy(scaledRect).bits()); }
}
} else {
const QImage im = \
image.convertToFormat(QImage::Format_ARGB32_Premultiplied); for (const QRect &rect : \
damage.rects()) {
- glTexSubImage2D(m_target, 0, rect.x(), rect.y(), rect.width(), \
rect.height(),
- GL_BGRA, GL_UNSIGNED_BYTE, im.copy(rect).bits());
+ auto scaledRect = QRect(rect.x() * scale, rect.y() * scale, rect.width() \
* scale, rect.height() * scale); + glTexSubImage2D(m_target, 0, \
scaledRect.x(), scaledRect.y(), scaledRect.width(), scaledRect.height(), + \
GL_BGRA, GL_UNSIGNED_BYTE, im.copy(scaledRect).bits()); }
}
q->unbind();
@@ -390,6 +395,7 @@ bool AbstractEglTexture::loadShmTexture(const QPointer< \
KWayland::Server::Buffer q->bind();
const QSize &size = image.size();
+
// TODO: this should be shared with GLTexture(const QImage&, GLenum)
GLenum format = 0;
switch (image.format()) {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic