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

Unified Diff: src/pdf/SkPDFDocument.cpp

Issue 2251813006: Revert of SkPDF: cache metrics once. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pdf/SkPDFCanon.cpp ('k') | src/pdf/SkPDFFont.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFDocument.cpp
diff --git a/src/pdf/SkPDFDocument.cpp b/src/pdf/SkPDFDocument.cpp
index 4f044c87717c90c8c77aced56f2d9f79bd94ba29..4a577fcff34ac1632541c72fca7d1734f1a2dcd1 100644
--- a/src/pdf/SkPDFDocument.cpp
+++ b/src/pdf/SkPDFDocument.cpp
@@ -167,6 +167,46 @@
} while (curNodes.count() > 1);
return std::move(curNodes[0]);
}
+
+#if 0
+// TODO(halcanary): expose notEmbeddableCount in SkDocument
+void GetCountOfFontTypes(
+ const SkTDArray<SkPDFDevice*>& pageDevices,
+ int counts[SkAdvancedTypefaceMetrics::kOther_Font + 1],
+ int* notSubsettableCount,
+ int* notEmbeddableCount) {
+ sk_bzero(counts, sizeof(int) *
+ (SkAdvancedTypefaceMetrics::kOther_Font + 1));
+ SkTDArray<SkFontID> seenFonts;
+ int notSubsettable = 0;
+ int notEmbeddable = 0;
+
+ for (int pageNumber = 0; pageNumber < pageDevices.count(); pageNumber++) {
+ const SkTDArray<SkPDFFont*>& fontResources =
+ pageDevices[pageNumber]->getFontResources();
+ for (int font = 0; font < fontResources.count(); font++) {
+ SkFontID fontID = fontResources[font]->typeface()->uniqueID();
+ if (seenFonts.find(fontID) == -1) {
+ counts[fontResources[font]->getType()]++;
+ seenFonts.push(fontID);
+ if (!fontResources[font]->canSubset()) {
+ notSubsettable++;
+ }
+ if (!fontResources[font]->canEmbed()) {
+ notEmbeddable++;
+ }
+ }
+ }
+ }
+ if (notSubsettableCount) {
+ *notSubsettableCount = notSubsettable;
+
+ }
+ if (notEmbeddableCount) {
+ *notEmbeddableCount = notEmbeddable;
+ }
+}
+#endif
template <typename T> static T* clone(const T* o) { return o ? new T(*o) : nullptr; }
////////////////////////////////////////////////////////////////////////////////
@@ -444,7 +484,7 @@
// Build font subsetting info before calling addObjectRecursively().
for (const auto& entry : fGlyphUsage) {
sk_sp<SkPDFObject> subsetFont =
- entry.fFont->getFontSubset(&fCanon, &entry.fGlyphSet);
+ entry.fFont->getFontSubset(&entry.fGlyphSet);
if (subsetFont) {
fObjectSerializer.fSubstituteMap.setSubstitute(
entry.fFont, subsetFont.get());
« no previous file with comments | « src/pdf/SkPDFCanon.cpp ('k') | src/pdf/SkPDFFont.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698