From: Ferran Sole Date: Wed, 6 Jul 2016 14:46:23 +0000 (+0100) Subject: Changed Texture::Upload to return a boolean to indicate whether the update can be... X-Git-Tag: dali_1.1.43~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F42%2F78742%2F3;p=platform%2Fcore%2Fuifw%2Fdali-core.git Changed Texture::Upload to return a boolean to indicate whether the update can be performed Upload will return true if the upload operation can be performed, false otherwise Change-Id: I94d852d65bddaa5c4b59b9b26bd84fd753c8a036 --- diff --git a/dali/devel-api/rendering/texture.cpp b/dali/devel-api/rendering/texture.cpp index 99ced3c..8bb15fe 100644 --- a/dali/devel-api/rendering/texture.cpp +++ b/dali/devel-api/rendering/texture.cpp @@ -61,13 +61,13 @@ Texture& Texture::operator=( const Texture& handle ) return *this; } -void Texture::Upload( PixelData pixelData ) +bool Texture::Upload( PixelData pixelData ) { Internal::PixelData& internalPixelData = GetImplementation( pixelData ); return GetImplementation(*this).Upload( &internalPixelData ); } -void Texture::Upload( PixelData pixelData, +bool Texture::Upload( PixelData pixelData, unsigned int layer, unsigned int mipmap, unsigned int xOffset, unsigned int yOffset, unsigned int width, unsigned int height ) diff --git a/dali/devel-api/rendering/texture.h b/dali/devel-api/rendering/texture.h index 85ee5ea..1f04ca8 100644 --- a/dali/devel-api/rendering/texture.h +++ b/dali/devel-api/rendering/texture.h @@ -122,8 +122,9 @@ public: /** * @brief Upload data to the texture from a PixelData object * @param[in] pixelData The pixelData object + * @return True if the PixelData object has compatible pixel format and fits within the texture, false otherwise */ - void Upload( PixelData pixelData ); + bool Upload( PixelData pixelData ); /** * @brief Upload data to the texture from a PixelData object @@ -134,9 +135,10 @@ public: * @param[in] yOffset Specifies a vertical offset of the rectangular area in the texture that will be updated * @param[in] width Specifies the width of the rectangular area in the texture that will be updated * @param[in] height Specifies the height of the rectangular area in the texture that will be updated + * @return True if the PixelData object has compatible pixel format and fits in the rectangle specified, false otherwise * @note Upload does not upsample or downsample pixel data to fit the specified rectangular area in the texture. */ - void Upload( PixelData pixelData, + bool Upload( PixelData pixelData, unsigned int layer, unsigned int mipmap, unsigned int xOffset, unsigned int yOffset, unsigned int width, unsigned int height ); diff --git a/dali/internal/event/rendering/texture-impl.cpp b/dali/internal/event/rendering/texture-impl.cpp index abea005..d6392fb 100644 --- a/dali/internal/event/rendering/texture-impl.cpp +++ b/dali/internal/event/rendering/texture-impl.cpp @@ -90,16 +90,17 @@ NewTexture::~NewTexture() } } -void NewTexture::Upload( PixelDataPtr pixelData ) +bool NewTexture::Upload( PixelDataPtr pixelData ) { - Upload( pixelData, 0u, 0u, 0u, 0u, mWidth, mHeight ); + return Upload( pixelData, 0u, 0u, 0u, 0u, mWidth, mHeight ); } -void NewTexture::Upload( PixelDataPtr pixelData, +bool NewTexture::Upload( PixelDataPtr pixelData, unsigned int layer, unsigned int mipmap, unsigned int xOffset, unsigned int yOffset, unsigned int width, unsigned int height ) { + bool result(false); if( mNativeImage ) { DALI_LOG_ERROR( "OpenGLES does not support uploading data to native texture"); @@ -130,6 +131,7 @@ void NewTexture::Upload( PixelDataPtr pixelData, //Parameters are correct. Send message to upload data to the texture UploadParams params = { layer, mipmap, xOffset, yOffset, width, height }; UploadTextureMessage(mEventThreadServices.GetUpdateManager(), *mRenderObject, pixelData, params ); + result = true; } } else @@ -138,6 +140,8 @@ void NewTexture::Upload( PixelDataPtr pixelData, } } } + + return result; } void NewTexture::GenerateMipmaps() diff --git a/dali/internal/event/rendering/texture-impl.h b/dali/internal/event/rendering/texture-impl.h index 349d244..bed8cb8 100644 --- a/dali/internal/event/rendering/texture-impl.h +++ b/dali/internal/event/rendering/texture-impl.h @@ -84,12 +84,12 @@ public: /** * @copydoc Dali::Texture::Upload() */ - void Upload( PixelDataPtr pixelData ); + bool Upload( PixelDataPtr pixelData ); /** * @copydoc Dali::Texture::Upload() */ - void Upload( PixelDataPtr pixelData, + bool Upload( PixelDataPtr pixelData, unsigned int layer, unsigned int mipmap, unsigned int xOffset, unsigned int yOffset, unsigned int width, unsigned int height );