|
@@ -186,6 +186,8 @@ void ElementSVG::UpdateTexture()
|
|
|
auto texture_callback = [this](const CallbackTextureInterface& texture_interface) -> bool {
|
|
auto texture_callback = [this](const CallbackTextureInterface& texture_interface) -> bool {
|
|
|
RMLUI_ASSERT(svg_document);
|
|
RMLUI_ASSERT(svg_document);
|
|
|
lunasvg::Bitmap bitmap = svg_document->renderToBitmap(render_dimensions.x, render_dimensions.y);
|
|
lunasvg::Bitmap bitmap = svg_document->renderToBitmap(render_dimensions.x, render_dimensions.y);
|
|
|
|
|
+ if (!bitmap.valid() || !bitmap.data())
|
|
|
|
|
+ return false;
|
|
|
|
|
|
|
|
// Swap red and blue channels, assuming LunaSVG v2.3.2 or newer, to convert to RmlUi's expected RGBA-ordering.
|
|
// Swap red and blue channels, assuming LunaSVG v2.3.2 or newer, to convert to RmlUi's expected RGBA-ordering.
|
|
|
const size_t bitmap_byte_size = bitmap.width() * bitmap.height() * 4;
|
|
const size_t bitmap_byte_size = bitmap.width() * bitmap.height() * 4;
|
|
@@ -193,8 +195,6 @@ void ElementSVG::UpdateTexture()
|
|
|
for (size_t i = 0; i < bitmap_byte_size; i += 4)
|
|
for (size_t i = 0; i < bitmap_byte_size; i += 4)
|
|
|
std::swap(bitmap_data[i], bitmap_data[i + 2]);
|
|
std::swap(bitmap_data[i], bitmap_data[i + 2]);
|
|
|
|
|
|
|
|
- if (!bitmap.valid() || !bitmap.data())
|
|
|
|
|
- return false;
|
|
|
|
|
if (!texture_interface.GenerateTexture({reinterpret_cast<const Rml::byte*>(bitmap.data()), bitmap_byte_size}, render_dimensions))
|
|
if (!texture_interface.GenerateTexture({reinterpret_cast<const Rml::byte*>(bitmap.data()), bitmap_byte_size}, render_dimensions))
|
|
|
return false;
|
|
return false;
|
|
|
return true;
|
|
return true;
|