Changed Texture::Upload to return a boolean to indicate whether the update can be... 42/78742/3
authorFerran Sole <ferran.sole@samsung.com>
Wed, 6 Jul 2016 14:46:23 +0000 (15:46 +0100)
committerFerran Sole <ferran.sole@samsung.com>
Fri, 8 Jul 2016 13:00:43 +0000 (06:00 -0700)
Upload will return true if the upload operation can be performed, false otherwise

Change-Id: I94d852d65bddaa5c4b59b9b26bd84fd753c8a036

dali/devel-api/rendering/texture.cpp
dali/devel-api/rendering/texture.h
dali/internal/event/rendering/texture-impl.cpp
dali/internal/event/rendering/texture-impl.h

index 99ced3c..8bb15fe 100644 (file)
@@ -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 )
index 85ee5ea..1f04ca8 100644 (file)
@@ -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 );
index abea005..d6392fb 100644 (file)
@@ -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()
index 349d244..bed8cb8 100644 (file)
@@ -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 );