OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkAdvancedTypefaceMetrics.h" | 9 #include "SkAdvancedTypefaceMetrics.h" |
10 #include "SkBase64.h" | 10 #include "SkBase64.h" |
(...skipping 2135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2146 SelectObject(fHdc, fSavefont); | 2146 SelectObject(fHdc, fSavefont); |
2147 DeleteObject(fFont); | 2147 DeleteObject(fFont); |
2148 DeleteDC(fHdc); | 2148 DeleteDC(fHdc); |
2149 } | 2149 } |
2150 operator HDC() { return fHdc; } | 2150 operator HDC() { return fHdc; } |
2151 private: | 2151 private: |
2152 HDC fHdc; | 2152 HDC fHdc; |
2153 HFONT fFont; | 2153 HFONT fFont; |
2154 HFONT fSavefont; | 2154 HFONT fSavefont; |
2155 }; | 2155 }; |
| 2156 #define SkAutoHDC(...) SK_REQUIRE_LOCAL_VAR(SkAutoHDC) |
2156 | 2157 |
2157 int LogFontTypeface::onCharsToGlyphs(const void* chars, Encoding encoding, | 2158 int LogFontTypeface::onCharsToGlyphs(const void* chars, Encoding encoding, |
2158 uint16_t userGlyphs[], int glyphCount) cons
t | 2159 uint16_t userGlyphs[], int glyphCount) cons
t |
2159 { | 2160 { |
2160 SkAutoHDC hdc(fLogFont); | 2161 SkAutoHDC hdc(fLogFont); |
2161 | 2162 |
2162 TEXTMETRIC tm; | 2163 TEXTMETRIC tm; |
2163 if (0 == GetTextMetrics(hdc, &tm)) { | 2164 if (0 == GetTextMetrics(hdc, &tm)) { |
2164 call_ensure_accessible(fLogFont); | 2165 call_ensure_accessible(fLogFont); |
2165 if (0 == GetTextMetrics(hdc, &tm)) { | 2166 if (0 == GetTextMetrics(hdc, &tm)) { |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2608 | 2609 |
2609 private: | 2610 private: |
2610 SkTDArray<ENUMLOGFONTEX> fLogFontArray; | 2611 SkTDArray<ENUMLOGFONTEX> fLogFontArray; |
2611 }; | 2612 }; |
2612 | 2613 |
2613 /////////////////////////////////////////////////////////////////////////////// | 2614 /////////////////////////////////////////////////////////////////////////////// |
2614 | 2615 |
2615 SkFontMgr* SkFontMgr_New_GDI() { | 2616 SkFontMgr* SkFontMgr_New_GDI() { |
2616 return SkNEW(SkFontMgrGDI); | 2617 return SkNEW(SkFontMgrGDI); |
2617 } | 2618 } |
OLD | NEW |