From c29761b789ed584131722ce2e5f892755f04dbb5 Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Mon, 10 Nov 2014 21:41:41 +0000 Subject: [PATCH] Bug 1093813 - Remove the gfxContext argument from gfxHarfBuzzShaper's GetGlyphHAdvance, GetGlyphVAdvance and GetGlyphVOrigin methods. r=jfkthame --- gfx/thebes/gfxFont.cpp | 2 +- gfx/thebes/gfxHarfBuzzShaper.cpp | 18 +++++++----------- gfx/thebes/gfxHarfBuzzShaper.h | 8 +++----- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index 77730f8961f3..634fe7f859eb 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -806,7 +806,7 @@ gfxFont::GetGlyphHAdvance(gfxContext *aCtx, uint16_t aGID) if (!shaper->Initialize()) { return 0; } - return shaper->GetGlyphHAdvance(aCtx, aGID) / 65536.0; + return shaper->GetGlyphHAdvance(aGID) / 65536.0; } /*static*/ diff --git a/gfx/thebes/gfxHarfBuzzShaper.cpp b/gfx/thebes/gfxHarfBuzzShaper.cpp index 99a74e83778d..9dbf1d48696a 100644 --- a/gfx/thebes/gfxHarfBuzzShaper.cpp +++ b/gfx/thebes/gfxHarfBuzzShaper.cpp @@ -184,8 +184,7 @@ struct GlyphMetrics { }; hb_position_t -gfxHarfBuzzShaper::GetGlyphHAdvance(gfxContext *aContext, - hb_codepoint_t glyph) const +gfxHarfBuzzShaper::GetGlyphHAdvance(hb_codepoint_t glyph) const { // font did not implement GetGlyphWidth, so get an unhinted value // directly from the font tables @@ -208,8 +207,7 @@ gfxHarfBuzzShaper::GetGlyphHAdvance(gfxContext *aContext, } hb_position_t -gfxHarfBuzzShaper::GetGlyphVAdvance(gfxContext *aContext, - hb_codepoint_t glyph) const +gfxHarfBuzzShaper::GetGlyphVAdvance(hb_codepoint_t glyph) const { if (!mVmtxTable) { // Must be a "vertical" font that doesn't actually have vertical metrics; @@ -244,9 +242,8 @@ gfxHarfBuzzShaper::HBGetGlyphHAdvance(hb_font_t *font, void *font_data, gfxFont *gfxfont = fcd->mShaper->GetFont(); if (gfxfont->ProvidesGlyphWidths()) { return gfxfont->GetGlyphWidth(fcd->mContext, glyph); - } else { - return fcd->mShaper->GetGlyphHAdvance(fcd->mContext, glyph); } + return fcd->mShaper->GetGlyphHAdvance(glyph); } /* static */ @@ -259,9 +256,8 @@ gfxHarfBuzzShaper::HBGetGlyphVAdvance(hb_font_t *font, void *font_data, gfxFont *gfxfont = fcd->mShaper->GetFont(); if (gfxfont->ProvidesGlyphWidths()) { return gfxfont->GetGlyphWidth(fcd->mContext, glyph); - } else { - return fcd->mShaper->GetGlyphVAdvance(fcd->mContext, glyph); } + return fcd->mShaper->GetGlyphVAdvance(glyph); } /* static */ @@ -296,15 +292,15 @@ gfxHarfBuzzShaper::HBGetGlyphVOrigin(hb_font_t *font, void *font_data, { const gfxHarfBuzzShaper::FontCallbackData *fcd = static_cast(font_data); - fcd->mShaper->GetGlyphVOrigin(fcd->mContext, glyph, x, y); + fcd->mShaper->GetGlyphVOrigin(glyph, x, y); return true; } void -gfxHarfBuzzShaper::GetGlyphVOrigin(gfxContext *aContext, hb_codepoint_t aGlyph, +gfxHarfBuzzShaper::GetGlyphVOrigin(hb_codepoint_t aGlyph, hb_position_t *aX, hb_position_t *aY) const { - *aX = -0.5 * GetGlyphHAdvance(aContext, aGlyph); + *aX = -0.5 * GetGlyphHAdvance(aGlyph); if (mVORGTable) { // We checked in Initialize() that the VORG table is safely readable, diff --git a/gfx/thebes/gfxHarfBuzzShaper.h b/gfx/thebes/gfxHarfBuzzShaper.h index ba726a9bbad4..54ed5bdd73b8 100644 --- a/gfx/thebes/gfxHarfBuzzShaper.h +++ b/gfx/thebes/gfxHarfBuzzShaper.h @@ -42,13 +42,11 @@ public: hb_codepoint_t variation_selector) const; // get harfbuzz glyph advance, in font design units - hb_position_t GetGlyphHAdvance(gfxContext *aContext, - hb_codepoint_t glyph) const; + hb_position_t GetGlyphHAdvance(hb_codepoint_t glyph) const; - hb_position_t GetGlyphVAdvance(gfxContext *aContext, - hb_codepoint_t glyph) const; + hb_position_t GetGlyphVAdvance(hb_codepoint_t glyph) const; - void GetGlyphVOrigin(gfxContext *aContext, hb_codepoint_t aGlyph, + void GetGlyphVOrigin(hb_codepoint_t aGlyph, hb_position_t *aX, hb_position_t *aY) const; // get harfbuzz horizontal advance in 16.16 fixed point format.