зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1053652 - Cannot open include file: 'dwrite_1.h'. r=gw280
Imports/Transplants upstream https://codereview.chromium.org/552383002/
This commit is contained in:
Родитель
1faea8e362
Коммит
1a05d7aaf8
|
@ -26,7 +26,9 @@
|
||||||
#include "SkTypeface_win_dw.h"
|
#include "SkTypeface_win_dw.h"
|
||||||
|
|
||||||
#include <dwrite.h>
|
#include <dwrite.h>
|
||||||
|
#if SK_HAS_DWRITE_1_H
|
||||||
# include <dwrite_1.h>
|
# include <dwrite_1.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool isLCD(const SkScalerContext::Rec& rec) {
|
static bool isLCD(const SkScalerContext::Rec& rec) {
|
||||||
return SkMask::kLCD16_Format == rec.fMaskFormat ||
|
return SkMask::kLCD16_Format == rec.fMaskFormat ||
|
||||||
|
@ -479,6 +481,7 @@ void SkScalerContext_DW::generateFontMetrics(SkPaint::FontMetrics* metrics) {
|
||||||
metrics->fFlags |= SkPaint::FontMetrics::kUnderlineThinknessIsValid_Flag;
|
metrics->fFlags |= SkPaint::FontMetrics::kUnderlineThinknessIsValid_Flag;
|
||||||
metrics->fFlags |= SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag;
|
metrics->fFlags |= SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag;
|
||||||
|
|
||||||
|
#if SK_HAS_DWRITE_1_H
|
||||||
if (NULL != fTypeface->fDWriteFontFace1.get()) {
|
if (NULL != fTypeface->fDWriteFontFace1.get()) {
|
||||||
DWRITE_FONT_METRICS1 dwfm1;
|
DWRITE_FONT_METRICS1 dwfm1;
|
||||||
fTypeface->fDWriteFontFace1->GetMetrics(&dwfm1);
|
fTypeface->fDWriteFontFace1->GetMetrics(&dwfm1);
|
||||||
|
@ -488,7 +491,12 @@ void SkScalerContext_DW::generateFontMetrics(SkPaint::FontMetrics* metrics) {
|
||||||
metrics->fXMax = fTextSizeRender * SkIntToScalar(dwfm1.glyphBoxRight) / upem;
|
metrics->fXMax = fTextSizeRender * SkIntToScalar(dwfm1.glyphBoxRight) / upem;
|
||||||
|
|
||||||
metrics->fMaxCharWidth = metrics->fXMax - metrics->fXMin;
|
metrics->fMaxCharWidth = metrics->fXMax - metrics->fXMin;
|
||||||
} else {
|
return;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
# pragma message("No dwrite_1.h is available, font metrics may be affected.")
|
||||||
|
#endif
|
||||||
|
|
||||||
AutoTDWriteTable<SkOTTableHead> head(fTypeface->fDWriteFontFace.get());
|
AutoTDWriteTable<SkOTTableHead> head(fTypeface->fDWriteFontFace.get());
|
||||||
if (head.fExists &&
|
if (head.fExists &&
|
||||||
head.fSize >= sizeof(SkOTTableHead) &&
|
head.fSize >= sizeof(SkOTTableHead) &&
|
||||||
|
@ -500,12 +508,12 @@ void SkScalerContext_DW::generateFontMetrics(SkPaint::FontMetrics* metrics) {
|
||||||
metrics->fXMax = fTextSizeRender * (int16_t)SkEndian_SwapBE16(head->xMax) / upem;
|
metrics->fXMax = fTextSizeRender * (int16_t)SkEndian_SwapBE16(head->xMax) / upem;
|
||||||
|
|
||||||
metrics->fMaxCharWidth = metrics->fXMax - metrics->fXMin;
|
metrics->fMaxCharWidth = metrics->fXMax - metrics->fXMin;
|
||||||
} else {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
metrics->fTop = metrics->fAscent;
|
metrics->fTop = metrics->fAscent;
|
||||||
metrics->fBottom = metrics->fDescent;
|
metrics->fBottom = metrics->fDescent;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,9 @@
|
||||||
#include "SkTypes.h"
|
#include "SkTypes.h"
|
||||||
|
|
||||||
#include <dwrite.h>
|
#include <dwrite.h>
|
||||||
|
#if SK_HAS_DWRITE_1_H
|
||||||
# include <dwrite_1.h>
|
# include <dwrite_1.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
class SkFontDescriptor;
|
class SkFontDescriptor;
|
||||||
struct SkScalerContextRec;
|
struct SkScalerContextRec;
|
||||||
|
@ -52,11 +54,13 @@ private:
|
||||||
, fDWriteFont(SkRefComPtr(font))
|
, fDWriteFont(SkRefComPtr(font))
|
||||||
, fDWriteFontFace(SkRefComPtr(fontFace))
|
, fDWriteFontFace(SkRefComPtr(fontFace))
|
||||||
{
|
{
|
||||||
|
#if SK_HAS_DWRITE_1_H
|
||||||
if (!SUCCEEDED(fDWriteFontFace->QueryInterface(&fDWriteFontFace1))) {
|
if (!SUCCEEDED(fDWriteFontFace->QueryInterface(&fDWriteFontFace1))) {
|
||||||
// IUnknown::QueryInterface states that if it fails, punk will be set to NULL.
|
// IUnknown::QueryInterface states that if it fails, punk will be set to NULL.
|
||||||
// http://blogs.msdn.com/b/oldnewthing/archive/2004/03/26/96777.aspx
|
// http://blogs.msdn.com/b/oldnewthing/archive/2004/03/26/96777.aspx
|
||||||
SK_ALWAYSBREAK(NULL == fDWriteFontFace1.get());
|
SK_ALWAYSBREAK(NULL == fDWriteFontFace1.get());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -66,7 +70,9 @@ public:
|
||||||
SkTScopedComPtr<IDWriteFontFamily> fDWriteFontFamily;
|
SkTScopedComPtr<IDWriteFontFamily> fDWriteFontFamily;
|
||||||
SkTScopedComPtr<IDWriteFont> fDWriteFont;
|
SkTScopedComPtr<IDWriteFont> fDWriteFont;
|
||||||
SkTScopedComPtr<IDWriteFontFace> fDWriteFontFace;
|
SkTScopedComPtr<IDWriteFontFace> fDWriteFontFace;
|
||||||
|
#if SK_HAS_DWRITE_1_H
|
||||||
SkTScopedComPtr<IDWriteFontFace1> fDWriteFontFace1;
|
SkTScopedComPtr<IDWriteFontFace1> fDWriteFontFace1;
|
||||||
|
#endif
|
||||||
|
|
||||||
static DWriteFontTypeface* Create(IDWriteFactory* factory,
|
static DWriteFontTypeface* Create(IDWriteFactory* factory,
|
||||||
IDWriteFontFace* fontFace,
|
IDWriteFontFace* fontFace,
|
||||||
|
|
|
@ -11,12 +11,17 @@
|
||||||
#include "SkTemplates.h"
|
#include "SkTemplates.h"
|
||||||
|
|
||||||
#include <dwrite.h>
|
#include <dwrite.h>
|
||||||
|
#include <winsdkver.h>
|
||||||
|
|
||||||
class SkString;
|
class SkString;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Factory
|
// Factory
|
||||||
|
|
||||||
|
#ifndef SK_HAS_DWRITE_1_H
|
||||||
|
#define SK_HAS_DWRITE_1_H (WINVER_MAXVER >= 0x0602)
|
||||||
|
#endif
|
||||||
|
|
||||||
IDWriteFactory* sk_get_dwrite_factory();
|
IDWriteFactory* sk_get_dwrite_factory();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Загрузка…
Ссылка в новой задаче