mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 958375 - 7/9 - Make Font-related enums typed - r=Bas
Specifically: r=Bas for manual changes f=Bas for automatic changes See attachments on the bug for the specific breakdown.
This commit is contained in:
parent
2d5774ca0a
commit
3a7886f0e9
@ -971,7 +971,7 @@ DrawTargetD2D::FillGlyphs(ScaledFont *aFont,
|
||||
const DrawOptions &aOptions,
|
||||
const GlyphRenderingOptions* aRenderOptions)
|
||||
{
|
||||
if (aFont->GetType() != FONT_DWRITE) {
|
||||
if (aFont->GetType() != FontType::DWRITE) {
|
||||
gfxDebug() << *this << ": Ignoring drawing call for incompatible font.";
|
||||
return;
|
||||
}
|
||||
@ -980,7 +980,7 @@ DrawTargetD2D::FillGlyphs(ScaledFont *aFont,
|
||||
|
||||
IDWriteRenderingParams *params = nullptr;
|
||||
if (aRenderOptions) {
|
||||
if (aRenderOptions->GetType() != FONT_DWRITE) {
|
||||
if (aRenderOptions->GetType() != FontType::DWRITE) {
|
||||
gfxDebug() << *this << ": Ignoring incompatible GlyphRenderingOptions.";
|
||||
// This should never happen.
|
||||
MOZ_ASSERT(false);
|
||||
|
@ -328,7 +328,7 @@ DrawTargetD2D1::FillGlyphs(ScaledFont *aFont,
|
||||
const DrawOptions &aOptions,
|
||||
const GlyphRenderingOptions *aRenderingOptions)
|
||||
{
|
||||
if (aFont->GetType() != FONT_DWRITE) {
|
||||
if (aFont->GetType() != FontType::DWRITE) {
|
||||
gfxDebug() << *this << ": Ignoring drawing call for incompatible font.";
|
||||
return;
|
||||
}
|
||||
@ -337,7 +337,7 @@ DrawTargetD2D1::FillGlyphs(ScaledFont *aFont,
|
||||
|
||||
IDWriteRenderingParams *params = nullptr;
|
||||
if (aRenderingOptions) {
|
||||
if (aRenderingOptions->GetType() != FONT_DWRITE) {
|
||||
if (aRenderingOptions->GetType() != FontType::DWRITE) {
|
||||
gfxDebug() << *this << ": Ignoring incompatible GlyphRenderingOptions.";
|
||||
// This should never happen.
|
||||
MOZ_ASSERT(false);
|
||||
|
@ -567,9 +567,9 @@ DrawTargetSkia::FillGlyphs(ScaledFont *aFont,
|
||||
const DrawOptions &aOptions,
|
||||
const GlyphRenderingOptions *aRenderingOptions)
|
||||
{
|
||||
if (aFont->GetType() != FONT_MAC &&
|
||||
aFont->GetType() != FONT_SKIA &&
|
||||
aFont->GetType() != FONT_GDI) {
|
||||
if (aFont->GetType() != FontType::MAC &&
|
||||
aFont->GetType() != FontType::SKIA &&
|
||||
aFont->GetType() != FontType::GDI) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -582,18 +582,18 @@ DrawTargetSkia::FillGlyphs(ScaledFont *aFont,
|
||||
paint.mPaint.setTextSize(SkFloatToScalar(skiaFont->mSize));
|
||||
paint.mPaint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
|
||||
|
||||
if (aRenderingOptions && aRenderingOptions->GetType() == FONT_CAIRO) {
|
||||
if (aRenderingOptions && aRenderingOptions->GetType() == FontType::CAIRO) {
|
||||
switch (static_cast<const GlyphRenderingOptionsCairo*>(aRenderingOptions)->GetHinting()) {
|
||||
case FONT_HINTING_NONE:
|
||||
case FontHinting::NONE:
|
||||
paint.mPaint.setHinting(SkPaint::kNo_Hinting);
|
||||
break;
|
||||
case FONT_HINTING_LIGHT:
|
||||
case FontHinting::LIGHT:
|
||||
paint.mPaint.setHinting(SkPaint::kSlight_Hinting);
|
||||
break;
|
||||
case FONT_HINTING_NORMAL:
|
||||
case FontHinting::NORMAL:
|
||||
paint.mPaint.setHinting(SkPaint::kNormal_Hinting);
|
||||
break;
|
||||
case FONT_HINTING_FULL:
|
||||
case FontHinting::FULL:
|
||||
paint.mPaint.setHinting(SkPaint::kFull_Hinting);
|
||||
break;
|
||||
}
|
||||
|
@ -327,25 +327,25 @@ Factory::CreateScaledFontForNativeFont(const NativeFont &aNativeFont, Float aSiz
|
||||
{
|
||||
switch (aNativeFont.mType) {
|
||||
#ifdef WIN32
|
||||
case NATIVE_FONT_DWRITE_FONT_FACE:
|
||||
case NativeFontType::DWRITE_FONT_FACE:
|
||||
{
|
||||
return new ScaledFontDWrite(static_cast<IDWriteFontFace*>(aNativeFont.mFont), aSize);
|
||||
}
|
||||
#if defined(USE_CAIRO) || defined(USE_SKIA)
|
||||
case NATIVE_FONT_GDI_FONT_FACE:
|
||||
case NativeFontType::GDI_FONT_FACE:
|
||||
{
|
||||
return new ScaledFontWin(static_cast<LOGFONT*>(aNativeFont.mFont), aSize);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#ifdef XP_MACOSX
|
||||
case NATIVE_FONT_MAC_FONT_FACE:
|
||||
case NativeFontType::MAC_FONT_FACE:
|
||||
{
|
||||
return new ScaledFontMac(static_cast<CGFontRef>(aNativeFont.mFont), aSize);
|
||||
}
|
||||
#endif
|
||||
#if defined(USE_CAIRO) || defined(USE_SKIA_FREETYPE)
|
||||
case NATIVE_FONT_CAIRO_FONT_FACE:
|
||||
case NativeFontType::CAIRO_FONT_FACE:
|
||||
{
|
||||
return new ScaledFontCairo(static_cast<cairo_scaled_font_t*>(aNativeFont.mFont), aSize);
|
||||
}
|
||||
@ -363,7 +363,7 @@ Factory::CreateScaledFontForTrueTypeData(uint8_t *aData, uint32_t aSize,
|
||||
{
|
||||
switch (aType) {
|
||||
#ifdef WIN32
|
||||
case FONT_DWRITE:
|
||||
case FontType::DWRITE:
|
||||
{
|
||||
return new ScaledFontDWrite(aData, aSize, aFaceIndex, aGlyphSize);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
#endif
|
||||
|
||||
// Not true, but required to instantiate a ScaledFontBase.
|
||||
virtual FontType GetType() const { return FONT_SKIA; }
|
||||
virtual FontType GetType() const { return FontType::SKIA; }
|
||||
|
||||
#ifdef USE_CAIRO_SCALED_FONT
|
||||
cairo_scaled_font_t* GetCairoScaledFont() { return mScaledFont; }
|
||||
|
@ -33,7 +33,7 @@ class GlyphRenderingOptionsCairo : public GlyphRenderingOptions
|
||||
{
|
||||
public:
|
||||
GlyphRenderingOptionsCairo()
|
||||
: mHinting(FONT_HINTING_NORMAL)
|
||||
: mHinting(FontHinting::NORMAL)
|
||||
, mAutoHinting(false)
|
||||
{
|
||||
}
|
||||
@ -42,7 +42,7 @@ public:
|
||||
void SetAutoHinting(bool aAutoHinting) { mAutoHinting = aAutoHinting; }
|
||||
FontHinting GetHinting() const { return mHinting; }
|
||||
bool GetAutoHinting() const { return mAutoHinting; }
|
||||
virtual FontType GetType() const { return FONT_CAIRO; }
|
||||
virtual FontType GetType() const { return FontType::CAIRO; }
|
||||
private:
|
||||
FontHinting mHinting;
|
||||
bool mAutoHinting;
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
{}
|
||||
ScaledFontDWrite(uint8_t *aData, uint32_t aSize, uint32_t aIndex, Float aGlyphSize);
|
||||
|
||||
virtual FontType GetType() const { return FONT_DWRITE; }
|
||||
virtual FontType GetType() const { return FontType::DWRITE; }
|
||||
|
||||
virtual TemporaryRef<Path> GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget);
|
||||
virtual void CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder, BackendType aBackendType, const Matrix *aTransformHint);
|
||||
@ -53,7 +53,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual FontType GetType() const { return FONT_DWRITE; }
|
||||
virtual FontType GetType() const { return FontType::DWRITE; }
|
||||
|
||||
private:
|
||||
friend class DrawTargetD2D;
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
ScaledFontMac(CGFontRef aFont, Float aSize);
|
||||
virtual ~ScaledFontMac();
|
||||
|
||||
virtual FontType GetType() const { return FONT_MAC; }
|
||||
virtual FontType GetType() const { return FontType::MAC; }
|
||||
#ifdef USE_SKIA
|
||||
virtual SkTypeface* GetSkTypeface();
|
||||
#endif
|
||||
|
@ -17,7 +17,7 @@ class ScaledFontWin : public ScaledFontBase
|
||||
public:
|
||||
ScaledFontWin(LOGFONT* aFont, Float aSize);
|
||||
|
||||
virtual FontType GetType() const { return FONT_GDI; }
|
||||
virtual FontType GetType() const { return FontType::GDI; }
|
||||
#ifdef USE_SKIA
|
||||
virtual SkTypeface* GetSkTypeface();
|
||||
#endif
|
||||
|
@ -82,15 +82,14 @@ MOZ_BEGIN_ENUM_CLASS(BackendType)
|
||||
DIRECT2D1_1
|
||||
MOZ_END_ENUM_CLASS(BackendType)
|
||||
|
||||
enum FontType
|
||||
{
|
||||
FONT_DWRITE,
|
||||
FONT_GDI,
|
||||
FONT_MAC,
|
||||
FONT_SKIA,
|
||||
FONT_CAIRO,
|
||||
FONT_COREGRAPHICS
|
||||
};
|
||||
MOZ_BEGIN_ENUM_CLASS(FontType)
|
||||
DWRITE,
|
||||
GDI,
|
||||
MAC,
|
||||
SKIA,
|
||||
CAIRO,
|
||||
COREGRAPHICS
|
||||
MOZ_END_ENUM_CLASS(FontType)
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(NativeSurfaceType)
|
||||
D3D10_TEXTURE,
|
||||
@ -100,30 +99,27 @@ MOZ_BEGIN_ENUM_CLASS(NativeSurfaceType)
|
||||
CGCONTEXT_ACCELERATED
|
||||
MOZ_END_ENUM_CLASS(NativeSurfaceType)
|
||||
|
||||
enum NativeFontType
|
||||
{
|
||||
NATIVE_FONT_DWRITE_FONT_FACE,
|
||||
NATIVE_FONT_GDI_FONT_FACE,
|
||||
NATIVE_FONT_MAC_FONT_FACE,
|
||||
NATIVE_FONT_SKIA_FONT_FACE,
|
||||
NATIVE_FONT_CAIRO_FONT_FACE
|
||||
};
|
||||
MOZ_BEGIN_ENUM_CLASS(NativeFontType)
|
||||
DWRITE_FONT_FACE,
|
||||
GDI_FONT_FACE,
|
||||
MAC_FONT_FACE,
|
||||
SKIA_FONT_FACE,
|
||||
CAIRO_FONT_FACE
|
||||
MOZ_END_ENUM_CLASS(NativeFontType)
|
||||
|
||||
enum FontStyle
|
||||
{
|
||||
FONT_STYLE_NORMAL,
|
||||
FONT_STYLE_ITALIC,
|
||||
FONT_STYLE_BOLD,
|
||||
FONT_STYLE_BOLD_ITALIC
|
||||
};
|
||||
MOZ_BEGIN_ENUM_CLASS(FontStyle)
|
||||
NORMAL,
|
||||
ITALIC,
|
||||
BOLD,
|
||||
BOLD_ITALIC
|
||||
MOZ_END_ENUM_CLASS(FontStyle)
|
||||
|
||||
enum FontHinting
|
||||
{
|
||||
FONT_HINTING_NONE,
|
||||
FONT_HINTING_LIGHT,
|
||||
FONT_HINTING_NORMAL,
|
||||
FONT_HINTING_FULL
|
||||
};
|
||||
MOZ_BEGIN_ENUM_CLASS(FontHinting)
|
||||
NONE,
|
||||
LIGHT,
|
||||
NORMAL,
|
||||
FULL
|
||||
MOZ_END_ENUM_CLASS(FontHinting)
|
||||
|
||||
enum CompositionOp { OP_OVER, OP_ADD, OP_ATOP, OP_OUT, OP_IN, OP_SOURCE, OP_DEST_IN, OP_DEST_OUT, OP_DEST_OVER, OP_DEST_ATOP, OP_XOR,
|
||||
OP_MULTIPLY, OP_SCREEN, OP_OVERLAY, OP_DARKEN, OP_LIGHTEN, OP_COLOR_DODGE, OP_COLOR_BURN, OP_HARD_LIGHT, OP_SOFT_LIGHT, OP_DIFFERENCE, OP_EXCLUSION, OP_HUE, OP_SATURATION, OP_COLOR, OP_LUMINOSITY, OP_COUNT };
|
||||
|
@ -73,7 +73,7 @@ SetupTests(nsTArray<TestEntry>& testList)
|
||||
TestEntry *t;
|
||||
|
||||
/* some common styles */
|
||||
gfxFontStyle style_western_normal_16 (mozilla::gfx::FONT_STYLE_NORMAL,
|
||||
gfxFontStyle style_western_normal_16 (mozilla::gfx::FontStyle::NORMAL,
|
||||
400,
|
||||
0,
|
||||
16.0,
|
||||
@ -82,7 +82,7 @@ SetupTests(nsTArray<TestEntry>& testList)
|
||||
false, false,
|
||||
NS_LITERAL_STRING(""));
|
||||
|
||||
gfxFontStyle style_western_bold_16 (mozilla::gfx::FONT_STYLE_NORMAL,
|
||||
gfxFontStyle style_western_bold_16 (mozilla::gfx::FontStyle::NORMAL,
|
||||
700,
|
||||
0,
|
||||
16.0,
|
||||
|
@ -52,7 +52,7 @@ static void
|
||||
RunTest (TestEntry *test, gfxContext *ctx) {
|
||||
nsRefPtr<gfxFontGroup> fontGroup;
|
||||
if (!lastFamilies || strcmp(lastFamilies, test->mFamilies)) {
|
||||
gfxFontStyle style_western_normal_16 (mozilla::gfx::FONT_STYLE_NORMAL,
|
||||
gfxFontStyle style_western_normal_16 (mozilla::gfx::FontStyle::NORMAL,
|
||||
400,
|
||||
0,
|
||||
16.0,
|
||||
|
@ -92,7 +92,7 @@ TEST(Gfx, WordCache) {
|
||||
|
||||
nsRefPtr<gfxContext> ctx = MakeContext();
|
||||
{
|
||||
gfxFontStyle style (mozilla::gfx::FONT_STYLE_NORMAL,
|
||||
gfxFontStyle style (mozilla::gfx::FontStyle::NORMAL,
|
||||
139,
|
||||
10.0,
|
||||
0,
|
||||
|
@ -343,7 +343,7 @@ gfxAndroidPlatform::GetScaledFontForFont(DrawTarget* aTarget, gfxFont *aFont)
|
||||
{
|
||||
NativeFont nativeFont;
|
||||
if (aTarget->GetType() == BackendType::CAIRO || aTarget->GetType() == BackendType::SKIA) {
|
||||
nativeFont.mType = NATIVE_FONT_CAIRO_FONT_FACE;
|
||||
nativeFont.mType = NativeFontType::CAIRO_FONT_FACE;
|
||||
nativeFont.mFont = aFont->GetCairoScaledFont();
|
||||
return Factory::CreateScaledFontForNativeFont(nativeFont, aFont->GetAdjustedSize());
|
||||
}
|
||||
|
@ -699,7 +699,7 @@ gfxDWriteFont::GetScaledFont(mozilla::gfx::DrawTarget *aTarget)
|
||||
}
|
||||
|
||||
NativeFont nativeFont;
|
||||
nativeFont.mType = NATIVE_FONT_DWRITE_FONT_FACE;
|
||||
nativeFont.mType = NativeFontType::DWRITE_FONT_FACE;
|
||||
nativeFont.mFont = GetFontFace();
|
||||
|
||||
if (wantCairo) {
|
||||
|
@ -219,15 +219,15 @@ gfxFT2FontBase::ConstructFontOptions()
|
||||
const gfxFontStyle* style = this->GetStyle();
|
||||
if (style->style == NS_FONT_STYLE_ITALIC) {
|
||||
if (style->weight == NS_FONT_WEIGHT_BOLD) {
|
||||
mFontOptions.mStyle = FONT_STYLE_BOLD_ITALIC;
|
||||
mFontOptions.mStyle = FontStyle::BOLD_ITALIC;
|
||||
} else {
|
||||
mFontOptions.mStyle = FONT_STYLE_ITALIC;
|
||||
mFontOptions.mStyle = FontStyle::ITALIC;
|
||||
}
|
||||
} else {
|
||||
if (style->weight == NS_FONT_WEIGHT_BOLD) {
|
||||
mFontOptions.mStyle = FONT_STYLE_BOLD;
|
||||
mFontOptions.mStyle = FontStyle::BOLD;
|
||||
} else {
|
||||
mFontOptions.mStyle = FONT_STYLE_NORMAL;
|
||||
mFontOptions.mStyle = FontStyle::NORMAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -665,9 +665,9 @@ gfxFT2Font::GetGlyphRenderingOptions()
|
||||
mozilla::gfx::FontHinting hinting;
|
||||
|
||||
if (gfxPlatform::GetPlatform()->FontHintingEnabled()) {
|
||||
hinting = mozilla::gfx::FONT_HINTING_NORMAL;
|
||||
hinting = mozilla::gfx::FontHinting::NORMAL;
|
||||
} else {
|
||||
hinting = mozilla::gfx::FONT_HINTING_NONE;
|
||||
hinting = mozilla::gfx::FontHinting::NONE;
|
||||
}
|
||||
|
||||
// We don't want to force the use of the autohinter over the font's built in hints
|
||||
|
@ -410,7 +410,7 @@ gfxMacFont::GetScaledFont(DrawTarget *aTarget)
|
||||
{
|
||||
if (!mAzureScaledFont) {
|
||||
NativeFont nativeFont;
|
||||
nativeFont.mType = NATIVE_FONT_MAC_FONT_FACE;
|
||||
nativeFont.mType = NativeFontType::MAC_FONT_FACE;
|
||||
nativeFont.mFont = GetCGFontRef();
|
||||
mAzureScaledFont = mozilla::gfx::Factory::CreateScaledFontWithCairo(nativeFont, GetAdjustedSize(), mScaledFont);
|
||||
}
|
||||
|
@ -2188,16 +2188,16 @@ gfxFcFont::GetGlyphRenderingOptions()
|
||||
|
||||
switch (hint_style) {
|
||||
case CAIRO_HINT_STYLE_NONE:
|
||||
hinting = mozilla::gfx::FONT_HINTING_NONE;
|
||||
hinting = mozilla::gfx::FontHinting::NONE;
|
||||
break;
|
||||
case CAIRO_HINT_STYLE_SLIGHT:
|
||||
hinting = mozilla::gfx::FONT_HINTING_LIGHT;
|
||||
hinting = mozilla::gfx::FontHinting::LIGHT;
|
||||
break;
|
||||
case CAIRO_HINT_STYLE_FULL:
|
||||
hinting = mozilla::gfx::FONT_HINTING_FULL;
|
||||
hinting = mozilla::gfx::FontHinting::FULL;
|
||||
break;
|
||||
default:
|
||||
hinting = mozilla::gfx::FONT_HINTING_NORMAL;
|
||||
hinting = mozilla::gfx::FontHinting::NORMAL;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -865,7 +865,7 @@ TemporaryRef<ScaledFont>
|
||||
gfxPlatform::GetScaledFontForFont(DrawTarget* aTarget, gfxFont *aFont)
|
||||
{
|
||||
NativeFont nativeFont;
|
||||
nativeFont.mType = NATIVE_FONT_CAIRO_FONT_FACE;
|
||||
nativeFont.mType = NativeFontType::CAIRO_FONT_FACE;
|
||||
nativeFont.mFont = aFont->GetCairoScaledFont();
|
||||
RefPtr<ScaledFont> scaledFont =
|
||||
Factory::CreateScaledFontForNativeFont(nativeFont,
|
||||
|
@ -454,7 +454,7 @@ gfxPlatformGtk::GetScaledFontForFont(DrawTarget* aTarget, gfxFont *aFont)
|
||||
NativeFont nativeFont;
|
||||
|
||||
if (aTarget->GetType() == BackendType::CAIRO || aTarget->GetType() == BackendType::SKIA) {
|
||||
nativeFont.mType = NATIVE_FONT_CAIRO_FONT_FACE;
|
||||
nativeFont.mType = NativeFontType::CAIRO_FONT_FACE;
|
||||
nativeFont.mFont = aFont->GetCairoScaledFont();
|
||||
return Factory::CreateScaledFontForNativeFont(nativeFont, aFont->GetAdjustedSize());
|
||||
}
|
||||
|
@ -692,7 +692,7 @@ gfxWindowsPlatform::GetScaledFontForFont(DrawTarget* aTarget, gfxFont *aFont)
|
||||
gfxDWriteFont *font = static_cast<gfxDWriteFont*>(aFont);
|
||||
|
||||
NativeFont nativeFont;
|
||||
nativeFont.mType = NATIVE_FONT_DWRITE_FONT_FACE;
|
||||
nativeFont.mType = NativeFontType::DWRITE_FONT_FACE;
|
||||
nativeFont.mFont = font->GetFontFace();
|
||||
|
||||
if (aTarget->GetType() == BackendType::CAIRO) {
|
||||
@ -709,7 +709,7 @@ gfxWindowsPlatform::GetScaledFontForFont(DrawTarget* aTarget, gfxFont *aFont)
|
||||
"Fonts on windows should be GDI or DWrite!");
|
||||
|
||||
NativeFont nativeFont;
|
||||
nativeFont.mType = NATIVE_FONT_GDI_FONT_FACE;
|
||||
nativeFont.mType = NativeFontType::GDI_FONT_FACE;
|
||||
LOGFONT lf;
|
||||
GetObject(static_cast<gfxGDIFont*>(aFont)->GetHFONT(), sizeof(LOGFONT), &lf);
|
||||
nativeFont.mFont = &lf;
|
||||
|
Loading…
Reference in New Issue
Block a user