Add width and height to NetworkTexture

This commit is contained in:
Ryan Huffman 2015-01-21 15:08:38 -08:00
parent cb536c5d4e
commit 53a70c43e1
2 changed files with 10 additions and 1 deletions

View file

@ -385,7 +385,9 @@ Texture::~Texture() {
NetworkTexture::NetworkTexture(const QUrl& url, TextureType type, const QByteArray& content) :
Resource(url, !content.isEmpty()),
_type(type),
_translucent(false) {
_translucent(false),
_width(0),
_height(0) {
if (!url.isValid()) {
_loaded = true;
@ -532,6 +534,8 @@ void NetworkTexture::loadContent(const QByteArray& content) {
void NetworkTexture::setImage(const QImage& image, bool translucent, const QColor& averageColor) {
_translucent = translucent;
_averageColor = averageColor;
_width = image.width();
_height = image.height();
finishedLoading(true);
imageLoaded(image);

View file

@ -150,6 +150,9 @@ public:
/// Returns the lazily-computed average texture color.
const QColor& getAverageColor() const { return _averageColor; }
int getWidth() const { return _width; }
int getHeight() const { return _height; }
protected:
virtual void downloadFinished(QNetworkReply* reply);
@ -163,6 +166,8 @@ private:
TextureType _type;
bool _translucent;
QColor _averageColor;
int _width;
int _height;
};
/// Caches derived, dilated textures.