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

Side by Side Diff: src/utils/win/SkDWrite.h

Issue 314193002: Split SkFontHost_win_dw. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove unneeded includes. Created 6 years, 6 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 | « src/ports/SkTypeface_win_dw.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 #ifndef SkDWrite_DEFINED
9 #define SkDWrite_DEFINED
10
8 #include "SkTemplates.h" 11 #include "SkTemplates.h"
9 12
10 #include <dwrite.h> 13 #include <dwrite.h>
11 14
12 class SkString; 15 class SkString;
13 16
14 //////////////////////////////////////////////////////////////////////////////// 17 ////////////////////////////////////////////////////////////////////////////////
15 // Factory 18 // Factory
16 19
17 IDWriteFactory* sk_get_dwrite_factory(); 20 IDWriteFactory* sk_get_dwrite_factory();
(...skipping 11 matching lines...) Expand all
29 HRESULT sk_wchar_to_skstring(WCHAR* name, SkString* skname); 32 HRESULT sk_wchar_to_skstring(WCHAR* name, SkString* skname);
30 33
31 //////////////////////////////////////////////////////////////////////////////// 34 ////////////////////////////////////////////////////////////////////////////////
32 // Locale 35 // Locale
33 36
34 void sk_get_locale_string(IDWriteLocalizedStrings* names, const WCHAR* preferedL ocale, 37 void sk_get_locale_string(IDWriteLocalizedStrings* names, const WCHAR* preferedL ocale,
35 SkString* skname); 38 SkString* skname);
36 39
37 typedef decltype(GetUserDefaultLocaleName)* SkGetUserDefaultLocaleNameProc; 40 typedef decltype(GetUserDefaultLocaleName)* SkGetUserDefaultLocaleNameProc;
38 HRESULT SkGetGetUserDefaultLocaleNameProc(SkGetUserDefaultLocaleNameProc* proc); 41 HRESULT SkGetGetUserDefaultLocaleNameProc(SkGetUserDefaultLocaleNameProc* proc);
42
43 ////////////////////////////////////////////////////////////////////////////////
44 // Table handling
45
46 class AutoDWriteTable {
47 public:
48 AutoDWriteTable(IDWriteFontFace* fontFace, UINT32 beTag) : fFontFace(fontFac e), fExists(FALSE) {
49 // Any errors are ignored, user must check fExists anyway.
50 fontFace->TryGetFontTable(beTag,
51 reinterpret_cast<const void **>(&fData), &fSize, &fLock, &fExists);
52 }
53 ~AutoDWriteTable() {
54 if (fExists) {
55 fFontFace->ReleaseFontTable(fLock);
56 }
57 }
58
59 const uint8_t* fData;
60 UINT32 fSize;
61 BOOL fExists;
62 private:
63 // Borrowed reference, the user must ensure the fontFace stays alive.
64 IDWriteFontFace* fFontFace;
65 void* fLock;
66 };
67 template<typename T> class AutoTDWriteTable : public AutoDWriteTable {
68 public:
69 static const UINT32 tag = DWRITE_MAKE_OPENTYPE_TAG(T::TAG0, T::TAG1, T::TAG2 , T::TAG3);
70 AutoTDWriteTable(IDWriteFontFace* fontFace) : AutoDWriteTable(fontFace, tag) { }
71
72 const T* get() const { return reinterpret_cast<const T*>(fData); }
73 const T* operator->() const { return reinterpret_cast<const T*>(fData); }
74 };
75
76 #endif
OLDNEW
« no previous file with comments | « src/ports/SkTypeface_win_dw.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698