Merge "Clean up the code to build successfully on macOS" into devel/master
[platform/core/uifw/dali-core.git] / dali / internal / common / image-attributes.cpp
index 134debc..005e3b2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -39,18 +39,9 @@ struct ImageAttributes::ImageAttributesImpl
   {
   }
 
-  ~ImageAttributesImpl()
-  {
-  }
+  ~ImageAttributesImpl() = default;
 
-  ImageAttributesImpl(const ImageAttributesImpl& rhs)
-  : width( rhs.width ),
-    height( rhs.height ),
-    scaling( rhs.scaling ),
-    filtering( rhs.filtering ),
-    mOrientationCorrection( rhs.mOrientationCorrection )
-  {
-  }
+  ImageAttributesImpl(const ImageAttributesImpl& rhs) = default;
 
   ImageAttributesImpl& operator=(const ImageAttributesImpl& rhs)
   {
@@ -67,12 +58,11 @@ struct ImageAttributes::ImageAttributesImpl
     return *this;
   }
 
-  unsigned int  width : 16;       ///< image width in pixels
-  unsigned int  height : 16;      ///< image height in pixels
+  uint16_t  width;       ///< image width in pixels
+  uint16_t  height;      ///< image height in pixels
   ScalingMode   scaling : 3;      ///< scaling option, ShrinkToFit is default
-  FilterMode    filtering : 3;    ///< filtering option. Box is the default
+  FilterMode    filtering : 4;    ///< filtering option. Box is the default
   bool          mOrientationCorrection : 1; ///< If true, image pixels are reordered according to orientation metadata on load.
-  bool          isDistanceField : 1;  ///< true, if the image is a distancefield. Default is false.
 };
 
 
@@ -98,16 +88,16 @@ ImageAttributes::~ImageAttributes()
   delete impl;
 }
 
-void ImageAttributes::SetSize(unsigned int width, unsigned int height)
+void ImageAttributes::SetSize(uint32_t width, uint32_t height)
 {
-  impl->width = width;
-  impl->height = height;
+  impl->width = static_cast<uint16_t>( width ); // truncated
+  impl->height = static_cast<uint16_t>( height ); // truncated
 }
 
 void ImageAttributes::SetSize( const Size& size )
 {
-  impl->width = size.width;
-  impl->height = size.height;
+  impl->width = static_cast<uint16_t>( size.width ); // truncated
+  impl->height = static_cast<uint16_t>( size.height ); // truncated
 }
 
 void ImageAttributes::SetScalingMode( ScalingMode scale )
@@ -134,12 +124,12 @@ void ImageAttributes::Reset( ImageDimensions dimensions, ScalingMode scaling, Fi
   impl->mOrientationCorrection = orientationCorrection;
 }
 
-unsigned int ImageAttributes::GetWidth() const
+uint32_t ImageAttributes::GetWidth() const
 {
   return impl->width;
 }
 
-unsigned int ImageAttributes::GetHeight() const
+uint32_t ImageAttributes::GetHeight() const
 {
   return impl->height;
 }
@@ -169,14 +159,6 @@ ImageAttributes ImageAttributes::New()
   return ImageAttributes();
 }
 
-ImageAttributes ImageAttributes::New(unsigned int imageWidth, unsigned int imageHeight)
-{
-  ImageAttributes attributes;
-  attributes.impl->width = imageWidth;
-  attributes.impl->height = imageHeight;
-  return attributes;
-}
-
 /**
  * Less then comparison operator.
  * @param [in] a parameter tested
@@ -184,12 +166,6 @@ ImageAttributes ImageAttributes::New(unsigned int imageWidth, unsigned int image
  */
 bool operator<(const ImageAttributes& a, const ImageAttributes& b)
 {
-  // Bail out if one is distance field and the other is not.
-  if (a.impl->isDistanceField != b.impl->isDistanceField)
-  {
-    return a.impl->isDistanceField < b.impl->isDistanceField;
-  }
-
   if (a.impl->width != b.impl->width)
   {
     return a.impl->width < b.impl->width;