X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Ftexture-manager-impl.h;h=7ca7a05f493e94e1ddf0dc8f1de595a1f73f23b5;hb=0c862d5823332bc2161c64f901395f2390c82fd2;hp=48eea782b24376aeec966ff784f1a71134e24d00;hpb=a4b26c19783f73d4e0f3a9fdd23f5a1810406734;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/visuals/texture-manager-impl.h b/dali-toolkit/internal/visuals/texture-manager-impl.h index 48eea78..7ca7a05 100644 --- a/dali-toolkit/internal/visuals/texture-manager-impl.h +++ b/dali-toolkit/internal/visuals/texture-manager-impl.h @@ -75,9 +75,10 @@ public: */ enum class StorageType : uint8_t { - KEEP_PIXEL_BUFFER, - RETURN_PIXEL_BUFFER, - UPLOAD_TO_TEXTURE + KEEP_PIXEL_BUFFER, ///< Keep loaded pixel buffer inside of texture manager without making texture. This could be used for inside pixel process like mask image. + RETURN_PIXEL_BUFFER, ///< Return loaded pixel buffer without making texture. + /// Because a pixel buffer cannot be used multiple texture, this pixel buffer only cached during loading, and is removed after loading is finished. + UPLOAD_TO_TEXTURE ///< Loaded image will be uploaded to texture and the texture will be returned. }; /** @@ -177,7 +178,6 @@ public: * * @return The texture set containing the frame of animated image, or empty if still loading. */ - TextureSet LoadAnimatedImageTexture(Dali::AnimatedImageLoading animatedImageLoading, uint32_t frameIndex, Dali::SamplingMode::Type samplingMode, @@ -206,7 +206,6 @@ public: * * @return The pixel buffer containing the image, or empty if still loading. */ - Devel::PixelBuffer LoadPixelBuffer(const VisualUrl& url, Dali::ImageDimensions desiredSize, Dali::FittingMode::Type fittingMode, @@ -220,7 +219,7 @@ public: * @brief Requests an image load of the given URL. * * The parameters are used to specify how the image is loaded. - * The observer has the UploadComplete method called when the load is ready. + * The observer has the LoadComplete method called when the load is ready. * * When the client has finished with the Texture, Remove() should be called. * @@ -253,7 +252,6 @@ public: * * @return The texture set containing the image, or empty if still loading. */ - TextureSet LoadTexture(const VisualUrl& url, Dali::ImageDimensions desiredSize, Dali::FittingMode::Type fittingMode, @@ -278,7 +276,7 @@ public: * @brief Requests an image load of the given URL. * * The parameters are used to specify how the image is loaded. - * The observer has the UploadComplete method called when the load is ready. + * The observer has the LoadComplete method called when the load is ready. * * When the client has finished with the Texture, Remove() should be called. * @@ -293,6 +291,7 @@ public: * @param[in] orientationCorrection Whether to rotate image to match embedded orientation data * @param[in] reloadPolicy Forces a reload of the texture even if already cached * @param[in,out] preMultiplyOnLoad True if the image color should be multiplied by it's alpha. Set to false if the image has no alpha channel + * @param[in] synchronousLoading true if the frame should be loaded synchronously * @return A TextureId to use as a handle to reference this Texture */ TextureId RequestLoad(const VisualUrl& url, @@ -303,7 +302,8 @@ public: TextureUploadObserver* observer, bool orientationCorrection, TextureManager::ReloadPolicy reloadPolicy, - MultiplyOnLoad& preMultiplyOnLoad); + MultiplyOnLoad& preMultiplyOnLoad, + bool synchronousLoading = false); /** * @brief Requests an image load of the given URL, when the texture has @@ -311,7 +311,7 @@ public: * the blended texture. * * The parameters are used to specify how the image is loaded. - * The observer has the UploadComplete method called when the load is ready. + * The observer has the LoadComplete method called when the load is ready. * * When the client has finished with the Texture, Remove() should be called. * @@ -335,6 +335,7 @@ public: * @param[in] reloadPolicy Forces a reload of the texture even if already cached * @param[in] preMultiplyOnLoad True if the image color should be multiplied by it's alpha. Set to false if the * image has no alpha channel + * @param[in] synchronousLoading true if the frame should be loaded synchronously * @return A TextureId to use as a handle to reference this Texture */ TextureId RequestLoad(const VisualUrl& url, @@ -348,13 +349,15 @@ public: TextureUploadObserver* observer, bool orientationCorrection, TextureManager::ReloadPolicy reloadPolicy, - MultiplyOnLoad& preMultiplyOnLoad); + MultiplyOnLoad& preMultiplyOnLoad, + bool synchronousLoading = false); /** * Requests a masking image to be loaded. This mask is not uploaded to GL, * instead, it is stored in CPU memory, and can be used for CPU blending. */ - TextureId RequestMaskLoad(const VisualUrl& maskUrl); + TextureId RequestMaskLoad(const VisualUrl& maskUrl, + bool synchronousLoading = false); /** * @brief Remove a Texture from the TextureManager. @@ -466,7 +469,7 @@ private: * CPU blend with the mask, and upload the blend texture. * * The parameters are used to specify how the image is loaded. - * The observer has the UploadComplete method called when the load is ready. + * The observer has the LoadComplete method called when the load is ready. * * When the client has finished with the Texture, Remove() should be called. * @@ -492,6 +495,7 @@ private: * there is no alpha * @param[in] animatedImageLoading The AnimatedImageLoading to load animated image * @param[in] frameIndex The frame index of a frame to be loaded frame + * @param[in] synchronousLoading true if the frame should be loaded synchronously * @return A TextureId to use as a handle to reference this Texture */ TextureId RequestLoadInternal( @@ -509,7 +513,8 @@ private: TextureManager::ReloadPolicy reloadPolicy, MultiplyOnLoad& preMultiplyOnLoad, Dali::AnimatedImageLoading animatedImageLoading, - uint32_t frameIndex); + uint32_t frameIndex, + bool synchronousLoading); /** * @brief Get the current state of a texture @@ -519,6 +524,23 @@ private: */ LoadState GetTextureStateInternal(TextureId textureId); + /** + * @brief Load a new image synchronously. + * @param[in] url The URL of the image to load + * @param[in] desiredSize The size the image is likely to appear at. + * This can be set to 0,0 for automatic + * @param[in] fittingMode The FittingMode to use + * @param[in] samplingMode The SamplingMode to use + * @param[in] orientationCorrection Whether to use image metadata to rotate or flip the image, + * e.g., from portrait to landscape + * @return PixelBuffer of loaded image. + */ + Devel::PixelBuffer LoadImageSynchronously(const VisualUrl& url, + const ImageDimensions desiredSize, + FittingMode::Type fittingMode, + Dali::SamplingMode::Type samplingMode, + bool orientationCorrection); + typedef size_t TextureHash; ///< The type used to store the hash used for Texture caching. // Structs: @@ -730,12 +752,6 @@ private: bool CreateTiledGeometry(const Devel::PixelBuffer& pixelBuffer, TextureInfo& textureInfo); /** - * Mark the texture as complete, and inform observers - * @param[in] textureInfo The struct associated with this Texture - */ - void UploadComplete(TextureInfo& textureInfo); - - /** * Notify the current observers that the texture upload is complete, * then remove the observers from the list. * @param[in] textureInfo The struct associated with this Texture