summaryrefslogtreecommitdiffstats
path: root/gfx/2d
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 15:12:12 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 15:12:12 +0000
commita7c14e2f29831f4bc5eb18e23e55eb6f7a4e3431 (patch)
tree54617b4f5f04ee87a2c9e3b97cc88b8626859124 /gfx/2d
parentReleasing progress-linux version 115.7.0esr-1~deb12u1progress7u1. (diff)
downloadfirefox-esr-a7c14e2f29831f4bc5eb18e23e55eb6f7a4e3431.tar.xz
firefox-esr-a7c14e2f29831f4bc5eb18e23e55eb6f7a4e3431.zip
Merging upstream version 115.8.0esr.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/2d')
-rw-r--r--gfx/2d/DrawTarget.cpp5
-rw-r--r--gfx/2d/ScaledFontBase.cpp16
2 files changed, 15 insertions, 6 deletions
diff --git a/gfx/2d/DrawTarget.cpp b/gfx/2d/DrawTarget.cpp
index eb7b23f3be..7f95dc6661 100644
--- a/gfx/2d/DrawTarget.cpp
+++ b/gfx/2d/DrawTarget.cpp
@@ -183,8 +183,9 @@ void DrawTarget::StrokeGlyphs(ScaledFont* aFont, const GlyphBuffer& aBuffer,
const Pattern& aPattern,
const StrokeOptions& aStrokeOptions,
const DrawOptions& aOptions) {
- RefPtr<Path> path = aFont->GetPathForGlyphs(aBuffer, this);
- Stroke(path, aPattern, aStrokeOptions, aOptions);
+ if (RefPtr<Path> path = aFont->GetPathForGlyphs(aBuffer, this)) {
+ Stroke(path, aPattern, aStrokeOptions, aOptions);
+ }
}
already_AddRefed<SourceSurface> DrawTarget::IntoLuminanceSource(
diff --git a/gfx/2d/ScaledFontBase.cpp b/gfx/2d/ScaledFontBase.cpp
index d62dcb0127..cd52df3ccd 100644
--- a/gfx/2d/ScaledFontBase.cpp
+++ b/gfx/2d/ScaledFontBase.cpp
@@ -127,7 +127,11 @@ already_AddRefed<Path> ScaledFontBase::GetPathForGlyphs(
}
#ifdef USE_CAIRO
if (aTarget->GetBackendType() == BackendType::CAIRO) {
- MOZ_ASSERT(mScaledFont);
+ auto* cairoScaledFont = GetCairoScaledFont();
+ if (!cairoScaledFont) {
+ MOZ_ASSERT_UNREACHABLE("Invalid scaled font");
+ return nullptr;
+ }
DrawTarget* dt = const_cast<DrawTarget*>(aTarget);
cairo_t* ctx = static_cast<cairo_t*>(
@@ -141,7 +145,7 @@ already_AddRefed<Path> ScaledFontBase::GetPathForGlyphs(
cairo_set_matrix(ctx, &mat);
}
- cairo_set_scaled_font(ctx, mScaledFont);
+ cairo_set_scaled_font(ctx, cairoScaledFont);
// Convert our GlyphBuffer into an array of Cairo glyphs.
std::vector<cairo_glyph_t> glyphs(aBuffer.mNumGlyphs);
@@ -181,7 +185,11 @@ void ScaledFontBase::CopyGlyphsToBuilder(const GlyphBuffer& aBuffer,
}
#ifdef USE_CAIRO
if (backendType == BackendType::CAIRO) {
- MOZ_ASSERT(mScaledFont);
+ auto* cairoScaledFont = GetCairoScaledFont();
+ if (!cairoScaledFont) {
+ MOZ_ASSERT_UNREACHABLE("Invalid scaled font");
+ return;
+ }
PathBuilderCairo* builder = static_cast<PathBuilderCairo*>(aBuilder);
cairo_t* ctx = cairo_create(DrawTargetCairo::GetDummySurface());
@@ -200,7 +208,7 @@ void ScaledFontBase::CopyGlyphsToBuilder(const GlyphBuffer& aBuffer,
glyphs[i].y = aBuffer.mGlyphs[i].mPosition.y;
}
- cairo_set_scaled_font(ctx, mScaledFont);
+ cairo_set_scaled_font(ctx, cairoScaledFont);
cairo_glyph_path(ctx, &glyphs[0], aBuffer.mNumGlyphs);
RefPtr<PathCairo> cairoPath = new PathCairo(ctx);