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

Side by Side Diff: src/pdf/SkPDFFont.cpp

Issue 1933393002: Move SkTypeface to sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments. Created 4 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 <ctype.h> 8 #include <ctype.h>
9 9
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 SkTypeface* typeface, 1322 SkTypeface* typeface,
1323 uint16_t glyphID) 1323 uint16_t glyphID)
1324 : SkPDFFont(info, typeface, nullptr) { 1324 : SkPDFFont(info, typeface, nullptr) {
1325 this->populate(glyphID); 1325 this->populate(glyphID);
1326 } 1326 }
1327 1327
1328 SkPDFType3Font::~SkPDFType3Font() {} 1328 SkPDFType3Font::~SkPDFType3Font() {}
1329 1329
1330 bool SkPDFType3Font::populate(uint16_t glyphID) { 1330 bool SkPDFType3Font::populate(uint16_t glyphID) {
1331 SkPaint paint; 1331 SkPaint paint;
1332 paint.setTypeface(typeface()); 1332 paint.setTypeface(sk_ref_sp(this->typeface()));
1333 paint.setTextSize(1000); 1333 paint.setTextSize(1000);
1334 const SkSurfaceProps props(0, kUnknown_SkPixelGeometry); 1334 const SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
1335 SkAutoGlyphCache autoCache(paint, &props, nullptr); 1335 SkAutoGlyphCache autoCache(paint, &props, nullptr);
1336 SkGlyphCache* cache = autoCache.getCache(); 1336 SkGlyphCache* cache = autoCache.getCache();
1337 // If fLastGlyphID isn't set (because there is not fFontInfo), look it up. 1337 // If fLastGlyphID isn't set (because there is not fFontInfo), look it up.
1338 if (lastGlyphID() == 0) { 1338 if (lastGlyphID() == 0) {
1339 setLastGlyphID(cache->getGlyphCount() - 1); 1339 setLastGlyphID(cache->getGlyphCount() - 1);
1340 } 1340 }
1341 1341
1342 adjustGlyphRangeForSingleByteEncoding(glyphID); 1342 adjustGlyphRangeForSingleByteEncoding(glyphID);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1438 } 1438 }
1439 return *canon->fCanEmbedTypeface.set(id, canEmbed); 1439 return *canon->fCanEmbedTypeface.set(id, canEmbed);
1440 } 1440 }
1441 1441
1442 void SkPDFFont::drop() { 1442 void SkPDFFont::drop() {
1443 fTypeface = nullptr; 1443 fTypeface = nullptr;
1444 fFontInfo = nullptr; 1444 fFontInfo = nullptr;
1445 fDescriptor = nullptr; 1445 fDescriptor = nullptr;
1446 this->SkPDFDict::drop(); 1446 this->SkPDFDict::drop();
1447 } 1447 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698