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

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

Issue 72603005: Guard against most unintentionally ephemeral SkAutoFoo instantiations. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: undo autoasciitolc Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkString.cpp ('k') | src/utils/mac/SkCreateCGImageRef.cpp » ('j') | 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 /* 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
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
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 }
OLDNEW
« no previous file with comments | « src/core/SkString.cpp ('k') | src/utils/mac/SkCreateCGImageRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698