Change in plasma-framework[master]: Put all non tiled frame textures in the atlas
David Edmundson (Code Review)
noreply at kde.org
Wed Feb 11 22:21:52 UTC 2015
David Edmundson has uploaded a new change for review.
https://gerrit.vesnicky.cesnet.cz/r/370
Change subject: Put all non tiled frame textures in the atlas
......................................................................
Put all non tiled frame textures in the atlas
Change-Id: I2525998ab3c1c76870fe8e395051127a673979af
---
M src/declarativeimports/core/framesvgitem.cpp
1 file changed, 17 insertions(+), 3 deletions(-)
git pull ssh://gerrit.vesnicky.cesnet.cz:29418/plasma-framework refs/changes/70/370/1
diff --git a/src/declarativeimports/core/framesvgitem.cpp b/src/declarativeimports/core/framesvgitem.cpp
index 589b103..fff1a89 100644
--- a/src/declarativeimports/core/framesvgitem.cpp
+++ b/src/declarativeimports/core/framesvgitem.cpp
@@ -121,7 +121,11 @@
void updateTexture(const QSize &size, const QString &elementId)
{
- setTexture(s_cache->loadTexture(m_frameSvg->window(), m_frameSvg->frameSvg()->image(size, elementId)));
+ QQuickWindow::CreateTextureOptions options;
+ if (m_fitMode != Tile) {
+ options = QQuickWindow::TextureCanUseAtlas;
+ }
+ setTexture(s_cache->loadTexture(m_frameSvg->window(), m_frameSvg->frameSvg()->image(size, elementId), options));
}
void reposition(const QRect& frameGeometry, QSize& fullSize)
@@ -132,11 +136,18 @@
if(!nodeRect.isValid() || nodeRect.isEmpty())
nodeRect = QRect();
- QRectF textureRect = QRectF(0,0,1,1);
+ //the position of the relevant texture within this texture ID.
+ //for atlas' this will only be a small part of the texture
+ QRectF textureRect;
+
if (m_fitMode == Tile) {
+ textureRect = QRectF(0,0,1,1); //we can never be in an atlas for tiled images.
+
+ //if tiling horizontally
if (m_border == FrameSvg::TopBorder || m_border == FrameSvg::BottomBorder || m_border == FrameSvg::NoBorder) {
textureRect.setWidth(nodeRect.width() / m_elementNativeSize.width());
}
+ //if tiling vertically
if (m_border == FrameSvg::LeftBorder || m_border == FrameSvg::RightBorder || m_border == FrameSvg::NoBorder) {
textureRect.setHeight(nodeRect.height() / m_elementNativeSize.height());
}
@@ -147,7 +158,10 @@
//re-render the SVG at new size
updateTexture(nodeRect.size(), elementId);
- } // for fast stretch, we don't have to do anything
+ textureRect = texture()->normalizedTextureSubRect();
+ } else if (texture()) { // for fast stretch.
+ textureRect = texture()->normalizedTextureSubRect();
+ }
QSGGeometry::updateTexturedRectGeometry(geometry(), nodeRect, textureRect);
markDirty(QSGNode::DirtyGeometry);
--
To view, visit https://gerrit.vesnicky.cesnet.cz/r/370
To unsubscribe, visit https://gerrit.vesnicky.cesnet.cz/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2525998ab3c1c76870fe8e395051127a673979af
Gerrit-PatchSet: 1
Gerrit-Project: plasma-framework
Gerrit-Branch: master
Gerrit-Owner: David Edmundson <david at davidedmundson.co.uk>
Gerrit-Reviewer: Aleix Pol Gonzalez <aleixpol at kde.org>
More information about the Plasma-devel
mailing list