aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/util/qsgatlastexture_p.h
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@jollamobile.com>2015-01-29 12:26:31 +0000
committerGunnar Sletta <gunnar@sletta.org>2015-02-03 13:58:00 +0000
commita49b0ad7866046c28fb38f0f70ddf626e12c3099 (patch)
treefd630807d84f151d9c086d21d47c7acb62214c0a /src/quick/scenegraph/util/qsgatlastexture_p.h
parentd302abb3d056a1ae0997ef03f442bfbd6547be0c (diff)
Release atlas texture's image instance once uploaded
Sitting on the instance makes it impossible for custom texture factories to release images to keep down memory. Also, ditch the extra QRect used to store the nonpadded atlas rect as this is easily reachable from the padded one. Change-Id: I4914753cc43a6f3173cfc9b210e02b2770ef33fd Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Diffstat (limited to 'src/quick/scenegraph/util/qsgatlastexture_p.h')
-rw-r--r--src/quick/scenegraph/util/qsgatlastexture_p.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/quick/scenegraph/util/qsgatlastexture_p.h b/src/quick/scenegraph/util/qsgatlastexture_p.h
index 639bdc291e..29eced9eb4 100644
--- a/src/quick/scenegraph/util/qsgatlastexture_p.h
+++ b/src/quick/scenegraph/util/qsgatlastexture_p.h
@@ -87,6 +87,9 @@ public:
QSize size() const { return m_size; }
+ GLuint internalFormat() const { return m_internalFormat; }
+ GLuint externalFormat() const { return m_externalFormat; }
+
private:
QSGAreaAllocator m_allocator;
GLuint m_texture_id;
@@ -110,26 +113,26 @@ public:
~Texture();
int textureId() const { return m_atlas->textureId(); }
- QSize textureSize() const { return m_allocated_rect_without_padding.size(); }
- bool hasAlphaChannel() const { return m_image.hasAlphaChannel(); }
+ QSize textureSize() const { return atlasSubRectWithoutPadding().size(); }
+ bool hasAlphaChannel() const { return m_has_alpha; }
bool hasMipmaps() const { return false; }
bool isAtlasTexture() const { return true; }
QRectF normalizedTextureSubRect() const { return m_texture_coords_rect; }
QRect atlasSubRect() const { return m_allocated_rect; }
- QRect atlasSubRectWithoutPadding() const { return m_allocated_rect_without_padding; }
+ QRect atlasSubRectWithoutPadding() const { return m_allocated_rect.adjusted(1, 1, -1, -1); }
bool isTexture() const { return true; }
QSGTexture *removedFromAtlas() const;
+ void releaseImage() { m_image = QImage(); }
const QImage &image() const { return m_image; }
void bind();
private:
- QRect m_allocated_rect_without_padding;
QRect m_allocated_rect;
QRectF m_texture_coords_rect;
@@ -139,6 +142,7 @@ private:
mutable QSGPlainTexture *m_nonatlas_texture;
+ uint m_has_alpha : 1;
};
}