diff --git a/es-core/src/components/ImageComponent.cpp b/es-core/src/components/ImageComponent.cpp index 80c6f9424..6b11eefe7 100644 --- a/es-core/src/components/ImageComponent.cpp +++ b/es-core/src/components/ImageComponent.cpp @@ -166,14 +166,14 @@ void ImageComponent::setImage(const std::string& path, bool tile) // we perform the actual rasterization to have the cache entry updated with the proper // texture. For SVG images this requires that every call to setImage is made only after // a call to setResize or setMaxSize (so the requested size is known upfront). - mTexture = TextureResource::get(path, tile, mForceLoad, mDynamic, mLinearInterpolation, - false, 0, 0, mTileWidth, mTileHeight); + mTexture = TextureResource::get(path, tile, mForceLoad, mDynamic, mLinearInterpolation, 0, + 0, mTileWidth, mTileHeight); if (isScalable) { resize(false); mTexture.reset(); mTexture = TextureResource::get(path, tile, mForceLoad, mDynamic, mLinearInterpolation, - false, static_cast(mSize.x), + static_cast(mSize.x), static_cast(mSize.y), mTileWidth, mTileHeight); mTexture->rasterizeAt(mSize.x, mSize.y); onSizeChanged(); diff --git a/es-core/src/components/NinePatchComponent.cpp b/es-core/src/components/NinePatchComponent.cpp index 39e438ac6..942bdecb2 100644 --- a/es-core/src/components/NinePatchComponent.cpp +++ b/es-core/src/components/NinePatchComponent.cpp @@ -66,7 +66,7 @@ void NinePatchComponent::buildVertices() } glm::vec2 texSize {relCornerSize * 3.0f}; - mTexture = TextureResource::get(mPath, false, false, false, false, false, + mTexture = TextureResource::get(mPath, false, false, false, false, static_cast(texSize.x), static_cast(texSize.y)); mTexture->rasterizeAt(texSize.x, texSize.y); diff --git a/es-core/src/resources/TextureData.cpp b/es-core/src/resources/TextureData.cpp index b664c5609..78108a956 100644 --- a/es-core/src/resources/TextureData.cpp +++ b/es-core/src/resources/TextureData.cpp @@ -38,7 +38,6 @@ TextureData::TextureData(bool tile) , mHasRGBAData {false} , mPendingRasterization {false} , mLinearMagnify {false} - , mForceRasterization {false} { } @@ -84,11 +83,9 @@ bool TextureData::initSVGFromMemory(const std::string& fileData) } } - // If there is no image size defined yet, then don't rasterize unless mForceRasterization has - // been set. + // If there is no image size defined yet, then don't rasterize. if (mSourceWidth == 0.0f && mSourceHeight == 0.0f) { - if (!mForceRasterization) - rasterize = false; + rasterize = false; // Set a small temporary size that maintains the image aspect ratio. mSourceWidth = 64.0f; mSourceHeight = 64.0f * (svgImage->height / svgImage->width); diff --git a/es-core/src/resources/TextureData.h b/es-core/src/resources/TextureData.h index b2023c796..072f945ac 100644 --- a/es-core/src/resources/TextureData.h +++ b/es-core/src/resources/TextureData.h @@ -66,8 +66,6 @@ public: // Whether to use linear filtering when magnifying the texture. void setLinearMagnify(bool setting) { mLinearMagnify = setting; } - // Whether to rasterize the image even if a size has not been set yet. - void setForceRasterization(bool setting) { mForceRasterization = setting; } // Has the image been loaded but not yet been rasterized as the size was not known? const bool getPendingRasterization() { return mPendingRasterization; } @@ -96,7 +94,6 @@ private: std::atomic mPendingRasterization; bool mLinearMagnify; bool mReloadable; - bool mForceRasterization; }; #endif // ES_CORE_RESOURCES_TEXTURE_DATA_H diff --git a/es-core/src/resources/TextureResource.cpp b/es-core/src/resources/TextureResource.cpp index 8e904fd77..490a60f09 100644 --- a/es-core/src/resources/TextureResource.cpp +++ b/es-core/src/resources/TextureResource.cpp @@ -20,8 +20,7 @@ TextureResource::TextureResource(const std::string& path, bool tile, bool dynamic, bool linearMagnify, - bool scalable, - bool forceRasterization) + bool scalable) : mTextureData {nullptr} , mForceLoad {false} { @@ -35,7 +34,6 @@ TextureResource::TextureResource(const std::string& path, data->initFromPath(path); data->setTileSize(tileWidth, tileHeight); data->setLinearMagnify(linearMagnify); - data->setForceRasterization(forceRasterization); // Force the texture manager to load it using a blocking load. sTextureDataManager.load(data, true); } @@ -45,7 +43,6 @@ TextureResource::TextureResource(const std::string& path, data->initFromPath(path); data->setTileSize(tileWidth, tileHeight); data->setLinearMagnify(linearMagnify); - data->setForceRasterization(forceRasterization); // Load it so we can read the width/height. data->load(); } @@ -156,7 +153,6 @@ std::shared_ptr TextureResource::get(const std::string& path, bool forceLoad, bool dynamic, bool linearMagnify, - bool forceRasterization, size_t width, size_t height, float tileWidth, @@ -164,8 +160,8 @@ std::shared_ptr TextureResource::get(const std::string& path, { const std::string canonicalPath {Utils::FileSystem::getCanonicalPath(path)}; if (canonicalPath.empty()) { - std::shared_ptr tex(new TextureResource( - "", tileWidth, tileHeight, tile, false, linearMagnify, false, forceRasterization)); + std::shared_ptr tex( + new TextureResource("", tileWidth, tileHeight, tile, false, linearMagnify, false)); // Make sure we get properly deinitialized even though we do nothing on reinitialization. ResourceManager::getInstance().addReloadable(tex); return tex; @@ -210,9 +206,8 @@ std::shared_ptr TextureResource::get(const std::string& path, } // Need to create it. - std::shared_ptr tex {std::shared_ptr( - new TextureResource(std::get<0>(key), tileWidth, tileHeight, tile, dynamic, linearMagnify, - isScalable, forceRasterization))}; + std::shared_ptr tex {std::shared_ptr(new TextureResource( + std::get<0>(key), tileWidth, tileHeight, tile, dynamic, linearMagnify, isScalable))}; std::shared_ptr data {sTextureDataManager.get(tex.get())}; if (!isScalable || (isScalable && width != 0.0f && height != 0.0f)) { diff --git a/es-core/src/resources/TextureResource.h b/es-core/src/resources/TextureResource.h index 4f5d70ec8..597a34c5a 100644 --- a/es-core/src/resources/TextureResource.h +++ b/es-core/src/resources/TextureResource.h @@ -31,7 +31,6 @@ public: bool forceLoad = false, bool dynamic = true, bool linearMagnify = false, - bool forceRasterization = false, size_t width = 0, size_t height = 0, float tileWidth = 0.0f, @@ -86,8 +85,7 @@ protected: bool tile, bool dynamic, bool linearMagnify, - bool scalable, - bool forceRasterization); + bool scalable); virtual void unload(ResourceManager& rm); virtual void reload(ResourceManager& rm);