Bug 1230413 (part 2) - Change CallbackData::mContext to a DrawTarget. r=jfkthame.

Also remove CallbackData::mShaper, which is unused.

--HG--
extra : rebase_source : 6e25d4fd10b490a7b5c2f772a51b268cb05cb1f6
This commit is contained in:
Nicholas Nethercote 2015-12-06 14:13:19 -08:00
parent 937ca16d12
commit 4fdc67c5bd
4 changed files with 11 additions and 11 deletions

View File

@ -34,7 +34,6 @@ gfxGraphiteShaper::gfxGraphiteShaper(gfxFont *aFont)
mGrFont(nullptr), mFallbackToSmallCaps(false)
{
mCallbackData.mFont = aFont;
mCallbackData.mShaper = this;
}
gfxGraphiteShaper::~gfxGraphiteShaper()
@ -50,8 +49,7 @@ gfxGraphiteShaper::GrGetAdvance(const void* appFontHandle, uint16_t glyphid)
{
const CallbackData *cb =
static_cast<const CallbackData*>(appFontHandle);
return FixedToFloat(cb->mFont->GetGlyphWidth(*cb->mContext->GetDrawTarget(),
glyphid));
return FixedToFloat(cb->mFont->GetGlyphWidth(*cb->mDrawTarget, glyphid));
}
static inline uint32_t
@ -97,7 +95,7 @@ gfxGraphiteShaper::ShapeText(gfxContext *aContext,
return false;
}
mCallbackData.mContext = aContext;
mCallbackData.mDrawTarget = aContext->GetDrawTarget();
const gfxFontStyle *style = mFont->GetStyle();

View File

@ -8,6 +8,8 @@
#include "gfxFont.h"
#include "mozilla/gfx/2D.h"
struct gr_face;
struct gr_font;
struct gr_segment;
@ -42,9 +44,8 @@ protected:
gr_font *mGrFont; // owned by the shaper itself
struct CallbackData {
gfxFont *mFont;
gfxGraphiteShaper *mShaper;
gfxContext *mContext;
gfxFont* mFont;
mozilla::gfx::DrawTarget* mDrawTarget;
};
CallbackData mCallbackData;

View File

@ -335,7 +335,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->GetDrawTarget(), glyph);
return gfxfont->GetGlyphWidth(*fcd->mDrawTarget, glyph);
}
return fcd->mShaper->GetGlyphHAdvance(glyph);
}
@ -1475,7 +1475,7 @@ gfxHarfBuzzShaper::ShapeText(gfxContext *aContext,
return false;
}
mCallbackData.mContext = aContext;
mCallbackData.mDrawTarget = aContext->GetDrawTarget();
mUseVerticalPresentationForms = false;
if (!Initialize()) {

View File

@ -10,6 +10,7 @@
#include "harfbuzz/hb.h"
#include "nsUnicodeProperties.h"
#include "mozilla/gfx/2D.h"
class gfxHarfBuzzShaper : public gfxFontShaper {
public:
@ -21,8 +22,8 @@ public:
* FontCallbackData struct
*/
struct FontCallbackData {
gfxHarfBuzzShaper *mShaper;
gfxContext *mContext;
gfxHarfBuzzShaper* mShaper;
mozilla::gfx::DrawTarget* mDrawTarget;
};
bool Initialize();