MCPcopy Create free account
hub / github.com/comaps/comaps / UploadResources

Method UploadResources

libs/drape/font_texture.cpp:171–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169}
170
171void GlyphIndex::UploadResources(ref_ptr<GraphicsContext> context, ref_ptr<Texture> texture)
172{
173 PendingNodes pendingNodes;
174 {
175 std::lock_guard lock(m_mutex);
176 if (m_pendingNodes.empty())
177 return;
178 m_pendingNodes.swap(pendingNodes);
179 }
180
181 for (auto it = pendingNodes.begin(); it != pendingNodes.end();)
182 {
183 // TODO(AB): Is it possible to mark and check if there is no image before uploading?
184 m_mng->MarkGlyphReady(it->second.m_key);
185
186 if (it->second.m_image.m_data)
187 ++it;
188 else
189 it = pendingNodes.erase(it);
190 }
191
192 if (pendingNodes.empty())
193 return;
194
195 for (auto & [rect, glyph] : pendingNodes)
196 {
197 ASSERT(glyph.m_image.m_width != 0 && glyph.m_image.m_height != 0 && rect.SizeX() != 0 && rect.SizeY() != 0, ());
198 ASSERT_EQUAL(glyph.m_image.m_width, rect.SizeX(), ());
199 ASSERT_EQUAL(glyph.m_image.m_height, rect.SizeY(), ());
200
201 m2::PointU const zeroPoint = rect.LeftBottom();
202 uint8_t * srcMemory = SharedBufferManager::GetRawPointer(glyph.m_image.m_data);
203 texture->UploadData(context, zeroPoint.x, zeroPoint.y, rect.SizeX(), rect.SizeY(), make_ref(srcMemory));
204
205 glyph.m_image.Destroy();
206 }
207}
208} // namespace dp

Callers 2

UpdateStateMethod · 0.45
UNIT_TESTFunction · 0.45

Calls 13

ASSERTFunction · 0.85
make_refFunction · 0.85
SizeXMethod · 0.80
SizeYMethod · 0.80
LeftBottomMethod · 0.80
emptyMethod · 0.45
swapMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
MarkGlyphReadyMethod · 0.45
eraseMethod · 0.45
UploadDataMethod · 0.45

Tested by 1

UNIT_TESTFunction · 0.36