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

Side by Side Diff: src/core/SkTypeface.cpp

Issue 943333004: Remove SkFontHost includes and friends. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix comments. Created 5 years, 10 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 | « include/ports/SkFontConfigInterface.h ('k') | src/ports/SkFontConfigTypeface.h » ('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 * Copyright 2011 The Android Open Source Project 2 * Copyright 2011 The Android Open Source Project
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 "SkAdvancedTypefaceMetrics.h" 8 #include "SkAdvancedTypefaceMetrics.h"
9 #include "SkEndian.h" 9 #include "SkEndian.h"
10 #include "SkFontDescriptor.h" 10 #include "SkFontDescriptor.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 return 0; 62 return 0;
63 } 63 }
64 }; 64 };
65 65
66 namespace { 66 namespace {
67 67
68 SK_DECLARE_STATIC_MUTEX(gCreateDefaultMutex); 68 SK_DECLARE_STATIC_MUTEX(gCreateDefaultMutex);
69 69
70 // As a template arguments, these must have external linkage. 70 // As a template arguments, these must have external linkage.
71 SkTypeface* sk_create_default_typeface(int style) { 71 SkTypeface* sk_create_default_typeface(int style) {
72 // If backed by fontconfig, it's not safe to call SkFontHost::CreateTypeface concurrently. 72 // It is not safe to call FontConfigTypeface::LegacyCreateTypeface concurren tly.
73 // To be safe, we serialize here with a mutex so only one call to 73 // To be safe, we serialize here with a mutex so only one call to
74 // CreateTypeface is happening at any given time. 74 // CreateTypeface is happening at any given time.
75 // TODO(bungeman, mtklein): This is sad. Make our fontconfig code safe? 75 // TODO(bungeman, mtklein): This is sad. Make our fontconfig code safe?
76 SkAutoMutexAcquire lock(&gCreateDefaultMutex); 76 SkAutoMutexAcquire lock(&gCreateDefaultMutex);
77 77
78 SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault()); 78 SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
79 SkTypeface* t = fm->legacyCreateTypeface(NULL, style);; 79 SkTypeface* t = fm->legacyCreateTypeface(NULL, style);;
80 return t ? t : SkEmptyTypeface::Create(); 80 return t ? t : SkEmptyTypeface::Create();
81 } 81 }
82 82
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 if (ctx.get()) { 343 if (ctx.get()) {
344 SkPaint::FontMetrics fm; 344 SkPaint::FontMetrics fm;
345 ctx->getFontMetrics(&fm); 345 ctx->getFontMetrics(&fm);
346 bounds->set(fm.fXMin * invTextSize, fm.fTop * invTextSize, 346 bounds->set(fm.fXMin * invTextSize, fm.fTop * invTextSize,
347 fm.fXMax * invTextSize, fm.fBottom * invTextSize); 347 fm.fXMax * invTextSize, fm.fBottom * invTextSize);
348 return true; 348 return true;
349 } 349 }
350 return false; 350 return false;
351 } 351 }
352 352
OLDNEW
« no previous file with comments | « include/ports/SkFontConfigInterface.h ('k') | src/ports/SkFontConfigTypeface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698