Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: src/ports/SkScalerContext_win_dw.cpp

Issue 537633002: Allow for Skia to be built without dwrite 1.1 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: And those should be ifndef not ifdef... Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/ports/SkTypeface_win_dw.h » ('j') | src/ports/SkTypeface_win_dw.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkTypes.h" 8 #include "SkTypes.h"
9 #undef GetGlyphIndices 9 #undef GetGlyphIndices
10 10
11 #include "SkDWrite.h" 11 #include "SkDWrite.h"
12 #include "SkDWriteGeometrySink.h" 12 #include "SkDWriteGeometrySink.h"
13 #include "SkEndian.h" 13 #include "SkEndian.h"
14 #include "SkGlyph.h" 14 #include "SkGlyph.h"
15 #include "SkHRESULT.h" 15 #include "SkHRESULT.h"
16 #include "SkMaskGamma.h" 16 #include "SkMaskGamma.h"
17 #include "SkMatrix22.h" 17 #include "SkMatrix22.h"
18 #include "SkOTTable_EBLC.h" 18 #include "SkOTTable_EBLC.h"
19 #include "SkOTTable_EBSC.h" 19 #include "SkOTTable_EBSC.h"
20 #include "SkOTTable_gasp.h" 20 #include "SkOTTable_gasp.h"
21 #include "SkOTTable_maxp.h" 21 #include "SkOTTable_maxp.h"
22 #include "SkPath.h" 22 #include "SkPath.h"
23 #include "SkScalerContext.h" 23 #include "SkScalerContext.h"
24 #include "SkScalerContext_win_dw.h" 24 #include "SkScalerContext_win_dw.h"
25 #include "SkTScopedComPtr.h" 25 #include "SkTScopedComPtr.h"
26 #include "SkTypeface_win_dw.h" 26 #include "SkTypeface_win_dw.h"
27 27
28 #include <dwrite.h> 28 #include <dwrite.h>
29 #ifndef SK_IGNORE_DWRITE_1_SUPPORT
29 #include <dwrite_1.h> 30 #include <dwrite_1.h>
31 #endif
30 32
31 static bool isLCD(const SkScalerContext::Rec& rec) { 33 static bool isLCD(const SkScalerContext::Rec& rec) {
32 return SkMask::kLCD16_Format == rec.fMaskFormat || 34 return SkMask::kLCD16_Format == rec.fMaskFormat ||
33 SkMask::kLCD32_Format == rec.fMaskFormat; 35 SkMask::kLCD32_Format == rec.fMaskFormat;
34 } 36 }
35 37
36 static bool is_hinted_without_gasp(DWriteFontTypeface* typeface) { 38 static bool is_hinted_without_gasp(DWriteFontTypeface* typeface) {
37 AutoTDWriteTable<SkOTTableMaximumProfile> maxp(typeface->fDWriteFontFace.get ()); 39 AutoTDWriteTable<SkOTTableMaximumProfile> maxp(typeface->fDWriteFontFace.get ());
38 if (!maxp.fExists) { 40 if (!maxp.fExists) {
39 return false; 41 return false;
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 metrics->fAscent = -fTextSizeRender * SkIntToScalar(dwfm.ascent) / upem; 519 metrics->fAscent = -fTextSizeRender * SkIntToScalar(dwfm.ascent) / upem;
518 metrics->fDescent = fTextSizeRender * SkIntToScalar(dwfm.descent) / upem; 520 metrics->fDescent = fTextSizeRender * SkIntToScalar(dwfm.descent) / upem;
519 metrics->fLeading = fTextSizeRender * SkIntToScalar(dwfm.lineGap) / upem; 521 metrics->fLeading = fTextSizeRender * SkIntToScalar(dwfm.lineGap) / upem;
520 metrics->fXHeight = fTextSizeRender * SkIntToScalar(dwfm.xHeight) / upem; 522 metrics->fXHeight = fTextSizeRender * SkIntToScalar(dwfm.xHeight) / upem;
521 metrics->fUnderlineThickness = fTextSizeRender * SkIntToScalar(dwfm.underlin eThickness) / upem; 523 metrics->fUnderlineThickness = fTextSizeRender * SkIntToScalar(dwfm.underlin eThickness) / upem;
522 metrics->fUnderlinePosition = -(fTextSizeRender * SkIntToScalar(dwfm.underli nePosition) / upem); 524 metrics->fUnderlinePosition = -(fTextSizeRender * SkIntToScalar(dwfm.underli nePosition) / upem);
523 525
524 metrics->fFlags |= SkPaint::FontMetrics::kUnderlineThinknessIsValid_Flag; 526 metrics->fFlags |= SkPaint::FontMetrics::kUnderlineThinknessIsValid_Flag;
525 metrics->fFlags |= SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag; 527 metrics->fFlags |= SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag;
526 528
529 #ifndef SK_IGNORE_DWRITE_1_SUPPORT
527 if (NULL != fTypeface->fDWriteFontFace1.get()) { 530 if (NULL != fTypeface->fDWriteFontFace1.get()) {
528 DWRITE_FONT_METRICS1 dwfm1; 531 DWRITE_FONT_METRICS1 dwfm1;
529 fTypeface->fDWriteFontFace1->GetMetrics(&dwfm1); 532 fTypeface->fDWriteFontFace1->GetMetrics(&dwfm1);
530 metrics->fTop = -fTextSizeRender * SkIntToScalar(dwfm1.glyphBoxTop) / up em; 533 metrics->fTop = -fTextSizeRender * SkIntToScalar(dwfm1.glyphBoxTop) / up em;
531 metrics->fBottom = -fTextSizeRender * SkIntToScalar(dwfm1.glyphBoxBottom ) / upem; 534 metrics->fBottom = -fTextSizeRender * SkIntToScalar(dwfm1.glyphBoxBottom ) / upem;
532 metrics->fXMin = fTextSizeRender * SkIntToScalar(dwfm1.glyphBoxLeft) / u pem; 535 metrics->fXMin = fTextSizeRender * SkIntToScalar(dwfm1.glyphBoxLeft) / u pem;
533 metrics->fXMax = fTextSizeRender * SkIntToScalar(dwfm1.glyphBoxRight) / upem; 536 metrics->fXMax = fTextSizeRender * SkIntToScalar(dwfm1.glyphBoxRight) / upem;
534 537
535 metrics->fMaxCharWidth = metrics->fXMax - metrics->fXMin; 538 metrics->fMaxCharWidth = metrics->fXMax - metrics->fXMin;
536 } else { 539 } else
540 #endif
541 {
537 AutoTDWriteTable<SkOTTableHead> head(fTypeface->fDWriteFontFace.get()); 542 AutoTDWriteTable<SkOTTableHead> head(fTypeface->fDWriteFontFace.get());
538 if (head.fExists && 543 if (head.fExists &&
539 head.fSize >= sizeof(SkOTTableHead) && 544 head.fSize >= sizeof(SkOTTableHead) &&
540 head->version == SkOTTableHead::version1) 545 head->version == SkOTTableHead::version1)
541 { 546 {
542 metrics->fTop = -fTextSizeRender * (int16_t)SkEndian_SwapBE16(head-> yMax) / upem; 547 metrics->fTop = -fTextSizeRender * (int16_t)SkEndian_SwapBE16(head-> yMax) / upem;
543 metrics->fBottom = -fTextSizeRender * (int16_t)SkEndian_SwapBE16(hea d->yMin) / upem; 548 metrics->fBottom = -fTextSizeRender * (int16_t)SkEndian_SwapBE16(hea d->yMin) / upem;
544 metrics->fXMin = fTextSizeRender * (int16_t)SkEndian_SwapBE16(head-> xMin) / upem; 549 metrics->fXMin = fTextSizeRender * (int16_t)SkEndian_SwapBE16(head-> xMin) / upem;
545 metrics->fXMax = fTextSizeRender * (int16_t)SkEndian_SwapBE16(head-> xMax) / upem; 550 metrics->fXMax = fTextSizeRender * (int16_t)SkEndian_SwapBE16(head-> xMax) / upem;
546 551
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 NULL, //advances 771 NULL, //advances
767 NULL, //offsets 772 NULL, //offsets
768 1, //num glyphs 773 1, //num glyphs
769 FALSE, //sideways 774 FALSE, //sideways
770 FALSE, //rtl 775 FALSE, //rtl
771 geometryToPath.get()), 776 geometryToPath.get()),
772 "Could not create glyph outline."); 777 "Could not create glyph outline.");
773 778
774 path->transform(fSkXform); 779 path->transform(fSkXform);
775 } 780 }
OLDNEW
« no previous file with comments | « no previous file | src/ports/SkTypeface_win_dw.h » ('j') | src/ports/SkTypeface_win_dw.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698