mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
Add width and height to NetworkTexture
This commit is contained in:
parent
cb536c5d4e
commit
53a70c43e1
2 changed files with 10 additions and 1 deletions
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue