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/devel-api/adaptor-framework/singleton-service.h>
25 #include <dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager-impl.h>
33 AtlasGlyphManager::AtlasGlyphManager()
37 AtlasGlyphManager::~AtlasGlyphManager()
41 AtlasGlyphManager AtlasGlyphManager::Get()
43 AtlasGlyphManager manager;
45 // Check whether the AtlasGlyphManager is already created
46 SingletonService singletonService( SingletonService::Get() );
47 if ( singletonService )
49 Dali::BaseHandle handle = singletonService.GetSingleton(typeid(AtlasGlyphManager));
52 // If so, downcast the handle of singleton to AtlasGlyphManager
53 manager = AtlasGlyphManager(dynamic_cast<Internal::AtlasGlyphManager*>(handle.GetObjectPtr()));
58 // If not, create the AtlasGlyphManager and register it as a singleton
59 manager = AtlasGlyphManager(new Internal::AtlasGlyphManager());
60 singletonService.Register(typeid(manager), manager);
66 AtlasGlyphManager::AtlasGlyphManager(Internal::AtlasGlyphManager *impl)
71 void AtlasGlyphManager::Add( const Text::GlyphInfo& glyph,
72 const uint32_t outlineWidth,
73 const PixelData& bitmap,
74 AtlasManager::AtlasSlot& slot )
76 GetImplementation(*this).Add( glyph, outlineWidth, bitmap, slot );
79 void AtlasGlyphManager::GenerateMeshData( uint32_t imageId,
80 const Vector2& position,
81 Toolkit::AtlasManager::Mesh2D& mesh )
83 GetImplementation(*this).GenerateMeshData( imageId,
88 bool AtlasGlyphManager::IsCached( Text::FontId fontId,
89 Text::GlyphIndex index,
90 uint32_t outlineWidth,
91 AtlasManager::AtlasSlot& slot )
93 return GetImplementation(*this).IsCached( fontId, index, outlineWidth, slot );
96 void AtlasGlyphManager::SetNewAtlasSize( uint32_t width, uint32_t height, uint32_t blockWidth, uint32_t blockHeight )
98 GetImplementation(*this).SetNewAtlasSize( width, height, blockWidth, blockHeight );
101 Vector2 AtlasGlyphManager::GetAtlasSize( uint32_t atlasId )
103 return GetImplementation(*this).GetAtlasSize( atlasId );
106 Pixel::Format AtlasGlyphManager::GetPixelFormat( uint32_t atlasId )
108 return GetImplementation(*this).GetPixelFormat( atlasId );
111 TextureSet AtlasGlyphManager::GetTextures( uint32_t atlasId ) const
113 return GetImplementation(*this).GetTextures( atlasId );
116 const Toolkit::AtlasGlyphManager::Metrics& AtlasGlyphManager::GetMetrics()
118 return GetImplementation(*this).GetMetrics();
121 void AtlasGlyphManager::AdjustReferenceCount( Text::FontId fontId, Text::GlyphIndex index, uint32_t outlineWidth, int32_t delta )
123 GetImplementation(*this).AdjustReferenceCount( fontId, index, outlineWidth, delta );
126 } // namespace Toolkit