forked from organicmaps/organicmaps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[drape] Moved Glyph out of GlyphManager (organicmaps#7860)
* [drape] Moved Glyph out of GlyphManager Also did small refactoring in a GlyphManager Signed-off-by: Alexander Borsuk <[email protected]>
- Loading branch information
Showing
9 changed files
with
132 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#pragma once | ||
|
||
#include "base/assert.hpp" | ||
#include "base/shared_buffer_manager.hpp" | ||
#include "base/string_utils.hpp" | ||
|
||
namespace dp | ||
{ | ||
struct GlyphMetrics | ||
{ | ||
float m_xAdvance; | ||
float m_yAdvance; | ||
float m_xOffset; | ||
float m_yOffset; | ||
bool m_isValid; | ||
}; | ||
|
||
struct GlyphImage | ||
{ | ||
~GlyphImage() | ||
{ | ||
ASSERT_NOT_EQUAL(m_data.use_count(), 1, ("Probably you forgot to call Destroy()")); | ||
} | ||
|
||
void Destroy() | ||
{ | ||
if (m_data != nullptr) | ||
{ | ||
SharedBufferManager::instance().freeSharedBuffer(m_data->size(), m_data); | ||
m_data = nullptr; | ||
} | ||
} | ||
|
||
uint32_t m_width; | ||
uint32_t m_height; | ||
|
||
uint32_t m_bitmapRows; | ||
int m_bitmapPitch; | ||
|
||
SharedBufferManager::shared_buffer_ptr_t m_data; | ||
}; | ||
|
||
struct Glyph | ||
{ | ||
GlyphMetrics m_metrics; | ||
GlyphImage m_image; | ||
int m_fontIndex; | ||
strings::UniChar m_code; | ||
int m_fixedSize; | ||
}; | ||
} // namespace dp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.