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

Side by Side Diff: src/fonts/SkFontMgr_fontconfig.cpp

Issue 1809733002: detach -> release (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: (C) Created 4 years, 9 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/effects/gradients/SkGradientBitmapCache.cpp ('k') | src/fonts/SkFontMgr_indirect.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 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 "SkFontConfigInterface.h" 8 #include "SkFontConfigInterface.h"
9 #include "SkFontConfigTypeface.h" 9 #include "SkFontConfigTypeface.h"
10 #include "SkFontMgr.h" 10 #include "SkFontMgr.h"
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 return nullptr; // don't accept too large fonts (>= 1GB) for safety . 302 return nullptr; // don't accept too large fonts (>= 1GB) for safety .
303 } 303 }
304 304
305 // TODO should the caller give us the style or should we get it from fre etype? 305 // TODO should the caller give us the style or should we get it from fre etype?
306 SkFontStyle style; 306 SkFontStyle style;
307 bool isFixedWidth = false; 307 bool isFixedWidth = false;
308 if (!fScanner.scanFont(stream, 0, nullptr, &style, &isFixedWidth, nullpt r)) { 308 if (!fScanner.scanFont(stream, 0, nullptr, &style, &isFixedWidth, nullpt r)) {
309 return nullptr; 309 return nullptr;
310 } 310 }
311 311
312 SkTypeface* face = FontConfigTypeface::Create(style, isFixedWidth, strea m.detach()); 312 SkTypeface* face = FontConfigTypeface::Create(style, isFixedWidth, strea m.release());
313 return face; 313 return face;
314 } 314 }
315 315
316 SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override { 316 SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override {
317 SkAutoTDelete<SkStreamAsset> stream(SkStream::NewFromFile(path)); 317 SkAutoTDelete<SkStreamAsset> stream(SkStream::NewFromFile(path));
318 return stream.get() ? this->createFromStream(stream.detach(), ttcIndex) : nullptr; 318 return stream.get() ? this->createFromStream(stream.release(), ttcIndex) : nullptr;
319 } 319 }
320 320
321 SkTypeface* onLegacyCreateTypeface(const char familyName[], 321 SkTypeface* onLegacyCreateTypeface(const char familyName[],
322 unsigned styleBits) const override { 322 unsigned styleBits) const override {
323 FCLocker lock; 323 FCLocker lock;
324 return FontConfigTypeface::LegacyCreateTypeface(familyName, (SkTypeface: :Style)styleBits); 324 return FontConfigTypeface::LegacyCreateTypeface(familyName, (SkTypeface: :Style)styleBits);
325 } 325 }
326 }; 326 };
327 327
328 SkFontMgr* SkFontMgr::Factory() { 328 SkFontMgr* SkFontMgr::Factory() {
329 SkFontConfigInterface* fci = RefFCI(); 329 SkFontConfigInterface* fci = RefFCI();
330 return fci ? new SkFontMgr_fontconfig(fci) : nullptr; 330 return fci ? new SkFontMgr_fontconfig(fci) : nullptr;
331 } 331 }
OLDNEW
« no previous file with comments | « src/effects/gradients/SkGradientBitmapCache.cpp ('k') | src/fonts/SkFontMgr_indirect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698