mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1093811 - Convert the gfxFont::GetGlyphWidth() virtual method to take a Moz2D DrawTarget instead of a Thebes gfxContext. r=jfkthame
This commit is contained in:
parent
34c0ce8374
commit
788f36f152
@ -584,7 +584,7 @@ gfxDWriteFont::ProvidesGlyphWidths() const
|
||||
}
|
||||
|
||||
int32_t
|
||||
gfxDWriteFont::GetGlyphWidth(gfxContext *aCtx, uint16_t aGID)
|
||||
gfxDWriteFont::GetGlyphWidth(DrawTarget& aDrawTarget, uint16_t aGID)
|
||||
{
|
||||
if (!mGlyphWidths) {
|
||||
mGlyphWidths = new nsDataHashtable<nsUint32HashKey,int32_t>(128);
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
|
||||
virtual bool ProvidesGlyphWidths() const;
|
||||
|
||||
virtual int32_t GetGlyphWidth(gfxContext *aCtx, uint16_t aGID);
|
||||
virtual int32_t GetGlyphWidth(DrawTarget& aDrawTarget, uint16_t aGID);
|
||||
|
||||
virtual mozilla::TemporaryRef<mozilla::gfx::GlyphRenderingOptions>
|
||||
GetGlyphRenderingOptions(const TextRunDrawParams* aRunParams = nullptr) MOZ_OVERRIDE;
|
||||
|
@ -168,7 +168,7 @@ gfxFT2FontBase::GetGlyph(uint32_t unicode, uint32_t variation_selector)
|
||||
}
|
||||
|
||||
int32_t
|
||||
gfxFT2FontBase::GetGlyphWidth(gfxContext *aCtx, uint16_t aGID)
|
||||
gfxFT2FontBase::GetGlyphWidth(DrawTarget& aDrawTarget, uint16_t aGID)
|
||||
{
|
||||
cairo_text_extents_t extents;
|
||||
GetGlyphExtents(aGID, &extents);
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
virtual bool ProvidesGetGlyph() const { return true; }
|
||||
virtual uint32_t GetGlyph(uint32_t unicode, uint32_t variation_selector);
|
||||
virtual bool ProvidesGlyphWidths() const { return true; }
|
||||
virtual int32_t GetGlyphWidth(gfxContext *aCtx, uint16_t aGID);
|
||||
virtual int32_t GetGlyphWidth(DrawTarget& aDrawTarget, uint16_t aGID);
|
||||
|
||||
cairo_scaled_font_t *CairoScaledFont() { return mScaledFont; };
|
||||
virtual bool SetupCairoFont(gfxContext *aContext);
|
||||
|
@ -791,7 +791,7 @@ gfxFont::GetGlyphHAdvance(gfxContext *aCtx, uint16_t aGID)
|
||||
return 0;
|
||||
}
|
||||
if (ProvidesGlyphWidths()) {
|
||||
return GetGlyphWidth(aCtx, aGID) / 65536.0;
|
||||
return GetGlyphWidth(*aCtx->GetDrawTarget(), aGID) / 65536.0;
|
||||
}
|
||||
if (mFUnitsConvFactor == 0.0f) {
|
||||
GetMetrics(eHorizontal);
|
||||
|
@ -1267,6 +1267,9 @@ class gfxFont {
|
||||
friend class gfxHarfBuzzShaper;
|
||||
friend class gfxGraphiteShaper;
|
||||
|
||||
protected:
|
||||
typedef mozilla::gfx::DrawTarget DrawTarget;
|
||||
|
||||
public:
|
||||
nsrefcnt AddRef(void) {
|
||||
NS_PRECONDITION(int32_t(mRefCnt) >= 0, "illegal refcnt");
|
||||
@ -1709,7 +1712,7 @@ public:
|
||||
|
||||
virtual FontType GetType() const = 0;
|
||||
|
||||
virtual mozilla::TemporaryRef<mozilla::gfx::ScaledFont> GetScaledFont(mozilla::gfx::DrawTarget *aTarget)
|
||||
virtual mozilla::TemporaryRef<mozilla::gfx::ScaledFont> GetScaledFont(DrawTarget* aTarget)
|
||||
{ return gfxPlatform::GetPlatform()->GetScaledFontForFont(aTarget, this); }
|
||||
|
||||
bool KerningDisabled() {
|
||||
@ -1820,7 +1823,7 @@ protected:
|
||||
|
||||
// The return value is interpreted as a horizontal advance in 16.16 fixed
|
||||
// point format.
|
||||
virtual int32_t GetGlyphWidth(gfxContext *aCtx, uint16_t aGID) {
|
||||
virtual int32_t GetGlyphWidth(DrawTarget& aDrawTarget, uint16_t aGID) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -460,7 +460,7 @@ gfxGDIFont::GetGlyph(uint32_t aUnicode, uint32_t aVarSelector)
|
||||
}
|
||||
|
||||
int32_t
|
||||
gfxGDIFont::GetGlyphWidth(gfxContext *aCtx, uint16_t aGID)
|
||||
gfxGDIFont::GetGlyphWidth(DrawTarget& aDrawTarget, uint16_t aGID)
|
||||
{
|
||||
if (!mGlyphWidths) {
|
||||
mGlyphWidths = new nsDataHashtable<nsUint32HashKey,int32_t>(128);
|
||||
@ -471,7 +471,7 @@ gfxGDIFont::GetGlyphWidth(gfxContext *aCtx, uint16_t aGID)
|
||||
return width;
|
||||
}
|
||||
|
||||
DCFromDrawTarget dc(*aCtx->GetDrawTarget());
|
||||
DCFromDrawTarget dc(aDrawTarget);
|
||||
AutoSelectFont fs(dc, GetHFONT());
|
||||
|
||||
int devWidth;
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
virtual bool ProvidesGlyphWidths() const { return true; }
|
||||
|
||||
// get hinted glyph width in pixels as 16.16 fixed-point value
|
||||
virtual int32_t GetGlyphWidth(gfxContext *aCtx, uint16_t aGID);
|
||||
virtual int32_t GetGlyphWidth(DrawTarget& aDrawTarget, uint16_t aGID);
|
||||
|
||||
virtual void AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
|
||||
FontCacheSizes* aSizes) const;
|
||||
|
@ -50,7 +50,8 @@ gfxGraphiteShaper::GrGetAdvance(const void* appFontHandle, uint16_t glyphid)
|
||||
{
|
||||
const CallbackData *cb =
|
||||
static_cast<const CallbackData*>(appFontHandle);
|
||||
return FixedToFloat(cb->mFont->GetGlyphWidth(cb->mContext, glyphid));
|
||||
return FixedToFloat(cb->mFont->GetGlyphWidth(*cb->mContext->GetDrawTarget(),
|
||||
glyphid));
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
|
@ -241,7 +241,7 @@ gfxHarfBuzzShaper::HBGetGlyphHAdvance(hb_font_t *font, void *font_data,
|
||||
static_cast<const gfxHarfBuzzShaper::FontCallbackData*>(font_data);
|
||||
gfxFont *gfxfont = fcd->mShaper->GetFont();
|
||||
if (gfxfont->ProvidesGlyphWidths()) {
|
||||
return gfxfont->GetGlyphWidth(fcd->mContext, glyph);
|
||||
return gfxfont->GetGlyphWidth(*fcd->mContext->GetDrawTarget(), glyph);
|
||||
}
|
||||
return fcd->mShaper->GetGlyphHAdvance(glyph);
|
||||
}
|
||||
@ -255,7 +255,7 @@ gfxHarfBuzzShaper::HBGetGlyphVAdvance(hb_font_t *font, void *font_data,
|
||||
static_cast<const gfxHarfBuzzShaper::FontCallbackData*>(font_data);
|
||||
gfxFont *gfxfont = fcd->mShaper->GetFont();
|
||||
if (gfxfont->ProvidesGlyphWidths()) {
|
||||
return gfxfont->GetGlyphWidth(fcd->mContext, glyph);
|
||||
return gfxfont->GetGlyphWidth(*fcd->mContext->GetDrawTarget(), glyph);
|
||||
}
|
||||
return fcd->mShaper->GetGlyphVAdvance(glyph);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user