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

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: Restore deleted Android code. 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
« no previous file with comments | « src/fonts/SkRandomScalerContext.cpp ('k') | src/ports/SkFontMgr_android.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 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 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 SkTypeface* typeface, 1320 SkTypeface* typeface,
1321 uint16_t glyphID) 1321 uint16_t glyphID)
1322 : SkPDFFont(info, typeface, nullptr) { 1322 : SkPDFFont(info, typeface, nullptr) {
1323 this->populate(glyphID); 1323 this->populate(glyphID);
1324 } 1324 }
1325 1325
1326 SkPDFType3Font::~SkPDFType3Font() {} 1326 SkPDFType3Font::~SkPDFType3Font() {}
1327 1327
1328 bool SkPDFType3Font::populate(uint16_t glyphID) { 1328 bool SkPDFType3Font::populate(uint16_t glyphID) {
1329 SkPaint paint; 1329 SkPaint paint;
1330 paint.setTypeface(typeface()); 1330 paint.setTypeface(sk_ref_sp(this->typeface()));
1331 paint.setTextSize(1000); 1331 paint.setTextSize(1000);
1332 const SkSurfaceProps props(0, kUnknown_SkPixelGeometry); 1332 const SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
1333 SkAutoGlyphCache autoCache(paint, &props, nullptr); 1333 SkAutoGlyphCache autoCache(paint, &props, nullptr);
1334 SkGlyphCache* cache = autoCache.getCache(); 1334 SkGlyphCache* cache = autoCache.getCache();
1335 // If fLastGlyphID isn't set (because there is not fFontInfo), look it up. 1335 // If fLastGlyphID isn't set (because there is not fFontInfo), look it up.
1336 if (lastGlyphID() == 0) { 1336 if (lastGlyphID() == 0) {
1337 setLastGlyphID(cache->getGlyphCount() - 1); 1337 setLastGlyphID(cache->getGlyphCount() - 1);
1338 } 1338 }
1339 1339
1340 adjustGlyphRangeForSingleByteEncoding(glyphID); 1340 adjustGlyphRangeForSingleByteEncoding(glyphID);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 } 1436 }
1437 return *canon->fCanEmbedTypeface.set(id, canEmbed); 1437 return *canon->fCanEmbedTypeface.set(id, canEmbed);
1438 } 1438 }
1439 1439
1440 void SkPDFFont::drop() { 1440 void SkPDFFont::drop() {
1441 fTypeface = nullptr; 1441 fTypeface = nullptr;
1442 fFontInfo = nullptr; 1442 fFontInfo = nullptr;
1443 fDescriptor = nullptr; 1443 fDescriptor = nullptr;
1444 this->SkPDFDict::drop(); 1444 this->SkPDFDict::drop();
1445 } 1445 }
OLDNEW
« no previous file with comments | « src/fonts/SkRandomScalerContext.cpp ('k') | src/ports/SkFontMgr_android.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698