2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.h>
22 #include <dali/public-api/adaptor-framework/singleton-service.h>
25 #include <dali-toolkit/internal/atlas-manager/atlas-manager-impl.h>
26 #include <dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager-impl.h>
34 AtlasGlyphManager::AtlasGlyphManager()
38 AtlasGlyphManager::~AtlasGlyphManager()
42 AtlasGlyphManager AtlasGlyphManager::Get()
44 AtlasGlyphManager manager;
46 // Check whether the AtlasGlyphManager is already created
47 SingletonService singletonService( SingletonService::Get() );
48 if ( singletonService )
50 Dali::BaseHandle handle = singletonService.GetSingleton(typeid(AtlasGlyphManager));
53 // If so, downcast the handle of singleton to AtlasGlyphManager
54 manager = AtlasGlyphManager(dynamic_cast<Internal::AtlasGlyphManager*>(handle.GetObjectPtr()));
59 // If not, create the AtlasGlyphManager and register it as a singleton
60 manager = AtlasGlyphManager(new Internal::AtlasGlyphManager());
61 singletonService.Register(typeid(manager), manager);
67 AtlasGlyphManager::AtlasGlyphManager(Internal::AtlasGlyphManager *impl)
72 void AtlasGlyphManager::Add( const Text::GlyphInfo& glyph,
73 const BufferImage& bitmap,
74 AtlasManager::AtlasSlot& slot )
76 GetImplementation(*this).Add( glyph, bitmap, slot );
79 void AtlasGlyphManager::GenerateMeshData( uint32_t imageId,
80 const Vector2& position,
83 GetImplementation(*this).GenerateMeshData( imageId,
88 void AtlasGlyphManager::StitchMesh( MeshData& first,
89 const MeshData& second )
91 GetImplementation(*this).StitchMesh( first, second );
94 void AtlasGlyphManager::Cached( Text::FontId fontId,
95 Text::GlyphIndex index,
96 AtlasManager::AtlasSlot& slot )
98 GetImplementation(*this).Cached( fontId, index, slot );
101 void AtlasGlyphManager::SetAtlasSize( const Vector2& size,
102 const Vector2& blockSize )
104 GetImplementation(*this).SetAtlasSize( size, blockSize );
107 void AtlasGlyphManager::Remove( uint32_t imageId )
109 GetImplementation(*this).Remove( imageId );
112 Pixel::Format AtlasGlyphManager::GetPixelFormat( uint32_t atlasId )
114 return GetImplementation(*this).GetPixelFormat( atlasId );
117 } // namespace Toolkit