Merge "(Text Controller) Moved some input properties into a different class & some...
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / rendering / vector-based / vector-blob-atlas-share.cpp
index 98c94a8..a1db81e 100644 (file)
@@ -1,5 +1,5 @@
- /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+/*
+ * Copyright (c) 2021 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.
 #include <dali-toolkit/internal/text/rendering/vector-based/vector-blob-atlas-share.h>
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/object/base-object.h>
 #include <dali/devel-api/common/singleton-service.h>
+#include <dali/public-api/object/base-object.h>
 
 namespace
 {
-
-const int INITIAL_VECTOR_BLOB_ATLAS_WIDTH = 512;
+const int INITIAL_VECTOR_BLOB_ATLAS_WIDTH  = 512;
 const int INITIAL_VECTOR_BLOB_ATLAS_HEIGHT = 512;
 
-const int NEW_VECTOR_BLOB_ATLAS_WIDTH = 1024;
+const int NEW_VECTOR_BLOB_ATLAS_WIDTH  = 1024;
 const int NEW_VECTOR_BLOB_ATLAS_HEIGHT = 1024;
 
-const int VECTOR_BLOB_ATLAS_ITEM_WIDTH = 64;
+const int VECTOR_BLOB_ATLAS_ITEM_WIDTH     = 64;
 const int VECTOR_BLOB_ATLAS_HEIGHT_QUANTUM = 8;
 
 } // unnamed namespace
 
 namespace Dali
 {
-
 namespace Toolkit
 {
-
 namespace Text
 {
-
 class VectorBlobAtlasShare::Impl : public Dali::BaseObject
 {
 public:
-
   /**
    * @brief Constructor
    */
@@ -58,9 +53,9 @@ public:
 
   VectorBlobAtlas* GetCurrentAtlas()
   {
-    if( ! mCurrentAtlas )
+    if(!mCurrentAtlas)
     {
-      mCurrentAtlas = new VectorBlobAtlas( INITIAL_VECTOR_BLOB_ATLAS_WIDTH, INITIAL_VECTOR_BLOB_ATLAS_HEIGHT, VECTOR_BLOB_ATLAS_ITEM_WIDTH, VECTOR_BLOB_ATLAS_HEIGHT_QUANTUM );
+      mCurrentAtlas = new VectorBlobAtlas(INITIAL_VECTOR_BLOB_ATLAS_WIDTH, INITIAL_VECTOR_BLOB_ATLAS_HEIGHT, VECTOR_BLOB_ATLAS_ITEM_WIDTH, VECTOR_BLOB_ATLAS_HEIGHT_QUANTUM);
     }
 
     return mCurrentAtlas.Get();
@@ -69,15 +64,14 @@ public:
   VectorBlobAtlas* GetNewAtlas()
   {
     // The current atlas should have been filled, before asking for a new one
-    DALI_ASSERT_DEBUG( mCurrentAtlas->IsFull() && "Current atlas is not full yet" );
+    DALI_ASSERT_DEBUG(mCurrentAtlas->IsFull() && "Current atlas is not full yet");
 
-    mCurrentAtlas = new VectorBlobAtlas( NEW_VECTOR_BLOB_ATLAS_WIDTH, NEW_VECTOR_BLOB_ATLAS_HEIGHT, VECTOR_BLOB_ATLAS_ITEM_WIDTH, VECTOR_BLOB_ATLAS_HEIGHT_QUANTUM );
+    mCurrentAtlas = new VectorBlobAtlas(NEW_VECTOR_BLOB_ATLAS_WIDTH, NEW_VECTOR_BLOB_ATLAS_HEIGHT, VECTOR_BLOB_ATLAS_ITEM_WIDTH, VECTOR_BLOB_ATLAS_HEIGHT_QUANTUM);
 
     return mCurrentAtlas.Get();
   }
 
 protected:
-
   /**
    * A reference counted object may only be deleted by calling Unreference()
    */
@@ -86,7 +80,6 @@ protected:
   }
 
 private:
-
   IntrusivePtr<VectorBlobAtlas> mCurrentAtlas;
 };
 
@@ -103,42 +96,42 @@ VectorBlobAtlasShare VectorBlobAtlasShare::Get()
   VectorBlobAtlasShare manager;
 
   // Check whether the VectorBlobAtlasShare is already created
-  SingletonService singletonService( SingletonService::Get() );
-  if ( singletonService )
+  SingletonService singletonService(SingletonService::Get());
+  if(singletonService)
   {
-    Dali::BaseHandle handle = singletonService.GetSingleton( typeid( VectorBlobAtlasShare ) );
-    if( handle )
+    Dali::BaseHandle handle = singletonService.GetSingleton(typeid(VectorBlobAtlasShare));
+    if(handle)
     {
       // If so, downcast the handle of singleton to VectorBlobAtlasShare
-      manager = VectorBlobAtlasShare( dynamic_cast<VectorBlobAtlasShare::Impl*>( handle.GetObjectPtr() ) );
+      manager = VectorBlobAtlasShare(dynamic_cast<VectorBlobAtlasShare::Impl*>(handle.GetObjectPtr()));
     }
 
-    if( !manager )
+    if(!manager)
     {
       // If not, create the VectorBlobAtlasShare and register it as a singleton
-      manager = VectorBlobAtlasShare( new VectorBlobAtlasShare::Impl() );
-      singletonService.Register( typeid( manager ), manager );
+      manager = VectorBlobAtlasShare(new VectorBlobAtlasShare::Impl());
+      singletonService.Register(typeid(manager), manager);
     }
   }
 
   return manager;
 }
 
-VectorBlobAtlasShare::VectorBlobAtlasShare( VectorBlobAtlasShare::Impl* impl )
-: BaseHandle( impl )
+VectorBlobAtlasShare::VectorBlobAtlasShare(VectorBlobAtlasShare::Impl* impl)
+: BaseHandle(impl)
 {
 }
 
 VectorBlobAtlas* VectorBlobAtlasShare::GetCurrentAtlas()
 {
-  VectorBlobAtlasShare::Impl& impl = static_cast<VectorBlobAtlasShare::Impl&>( GetBaseObject() );
+  VectorBlobAtlasShare::Impl& impl = static_cast<VectorBlobAtlasShare::Impl&>(GetBaseObject());
 
   return impl.GetCurrentAtlas();
 }
 
 VectorBlobAtlas* VectorBlobAtlasShare::GetNewAtlas()
 {
-  VectorBlobAtlasShare::Impl& impl = static_cast<VectorBlobAtlasShare::Impl&>( GetBaseObject() );
+  VectorBlobAtlasShare::Impl& impl = static_cast<VectorBlobAtlasShare::Impl&>(GetBaseObject());
 
   return impl.GetNewAtlas();
 }