Ensure BaseHandle class move noexcept (core public-api)
[platform/core/uifw/dali-core.git] / dali / public-api / rendering / texture.cpp
index f23a3f2..2f62053 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use *this file except in compliance with the License.
  */
 
 // CLASS HEADER
-#include <dali/public-api/rendering/texture.h>          // Dali::Texture
+#include <dali/public-api/rendering/texture.h> // Dali::Texture
 
 // INTERNAL INCLUDES
-#include <dali/internal/event/rendering/texture-impl.h> // Dali::Internal::Texture
 #include <dali/internal/event/images/pixel-data-impl.h> // Dali::Internal::PixelData
-
+#include <dali/internal/event/rendering/texture-impl.h> // Dali::Internal::Texture
 
 namespace Dali
 {
-
-Texture Texture::New( TextureType::Type type, Pixel::Format format, uint32_t width, uint32_t height )
+Texture Texture::New(TextureType::Type type, Pixel::Format format, uint32_t width, uint32_t height)
 {
-  Internal::TexturePtr texture = Internal::Texture::New(type, format, width, height );
-  return Texture( texture.Get() );
+  Internal::TexturePtr texture = Internal::Texture::New(type, format, width, height);
+  return Texture(texture.Get());
 }
 
-Texture Texture::New( NativeImageInterface& nativeImageInterface )
+Texture Texture::New(NativeImageInterface& nativeImageInterface)
 {
-  Internal::TexturePtr texture = Internal::Texture::New( nativeImageInterface );
-  return Texture( texture.Get() );
+  Internal::TexturePtr texture = Internal::Texture::New(nativeImageInterface);
+  return Texture(texture.Get());
 }
 
-Texture::Texture()
-{
-}
+Texture::Texture() = default;
 
-Texture::~Texture()
-{
-}
+Texture::~Texture() = default;
 
-Texture::Texture( const Texture& handle )
-: BaseHandle( handle )
-{
-}
+Texture::Texture(const Texture& handle) = default;
 
-Texture Texture::DownCast( BaseHandle handle )
+Texture Texture::DownCast(BaseHandle handle)
 {
-  return Texture( dynamic_cast<Dali::Internal::Texture*>(handle.GetObjectPtr()));
+  return Texture(dynamic_cast<Dali::Internal::Texture*>(handle.GetObjectPtr()));
 }
 
-Texture& Texture::operator=( const Texture& handle )
-{
-  BaseHandle::operator=( handle );
-  return *this;
-}
+Texture& Texture::operator=(const Texture& handle) = default;
+
+Texture::Texture(Texture&& rhs) noexcept = default;
 
-bool Texture::Upload( PixelData pixelData )
+Texture& Texture::operator=(Texture&& rhs) noexcept = default;
+
+bool Texture::Upload(PixelData pixelData)
 {
-  Internal::PixelData& internalPixelData = GetImplementation( pixelData );
-  return GetImplementation(*this).Upload( &internalPixelData );
+  Internal::PixelData& internalPixelData = GetImplementation(pixelData);
+  return GetImplementation(*this).Upload(&internalPixelData);
 }
 
-bool Texture::Upload( PixelData pixelData,
-               uint32_t layer, uint32_t mipmap,
-               uint32_t xOffset, uint32_t yOffset,
-               uint32_t width, uint32_t height )
+bool Texture::Upload(PixelData pixelData,
+                     uint32_t  layer,
+                     uint32_t  mipmap,
+                     uint32_t  xOffset,
+                     uint32_t  yOffset,
+                     uint32_t  width,
+                     uint32_t  height)
 {
-  Internal::PixelData& internalPixelData = GetImplementation( pixelData );
-  return GetImplementation(*this).Upload( &internalPixelData, layer, mipmap, xOffset, yOffset, width, height );
+  Internal::PixelData& internalPixelData = GetImplementation(pixelData);
+  return GetImplementation(*this).Upload(&internalPixelData, layer, mipmap, xOffset, yOffset, width, height);
 }
 
 void Texture::GenerateMipmaps()
@@ -92,8 +86,13 @@ uint32_t Texture::GetHeight() const
   return GetImplementation(*this).GetHeight();
 }
 
-Texture::Texture( Internal::Texture* pointer )
-: BaseHandle( pointer )
+Pixel::Format Texture::GetPixelFormat() const
+{
+  return GetImplementation(*this).GetPixelFormat();
+}
+
+Texture::Texture(Internal::Texture* pointer)
+: BaseHandle(pointer)
 {
 }