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

Unified Diff: src/pdf/SkPDFFont.cpp

Issue 2112943002: SkPDF: Glyph Useage Map improvements (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 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/SkPDFFont.h ('k') | src/utils/SkBitSet.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFFont.cpp
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp
index bdde6d62af1c722717eaad3a304c4c5a76ef141d..99b633508ffa6b61966be80699d211aebbac2d8a 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -652,41 +652,17 @@ bool SkPDFGlyphSet::has(uint16_t glyphID) const {
return fBitSet.isBitSet(glyphID);
}
-void SkPDFGlyphSet::merge(const SkPDFGlyphSet& usage) {
- fBitSet.orBits(usage.fBitSet);
-}
-
void SkPDFGlyphSet::exportTo(SkTDArray<unsigned int>* glyphIDs) const {
fBitSet.exportTo(glyphIDs);
}
-
+
///////////////////////////////////////////////////////////////////////////////
// class SkPDFGlyphSetMap
///////////////////////////////////////////////////////////////////////////////
-SkPDFGlyphSetMap::FontGlyphSetPair::FontGlyphSetPair(SkPDFFont* font,
- SkPDFGlyphSet* glyphSet)
- : fFont(font),
- fGlyphSet(glyphSet) {
-}
-SkPDFGlyphSetMap::SkPDFGlyphSetMap() {
-}
+SkPDFGlyphSetMap::SkPDFGlyphSetMap() {}
SkPDFGlyphSetMap::~SkPDFGlyphSetMap() {
- reset();
-}
-
-void SkPDFGlyphSetMap::merge(const SkPDFGlyphSetMap& usage) {
- for (int i = 0; i < usage.fMap.count(); ++i) {
- SkPDFGlyphSet* myUsage = getGlyphSetForFont(usage.fMap[i].fFont);
- myUsage->merge(*(usage.fMap[i].fGlyphSet));
- }
-}
-
-void SkPDFGlyphSetMap::reset() {
- for (int i = 0; i < fMap.count(); ++i) {
- delete fMap[i].fGlyphSet; // Should not be nullptr.
- }
fMap.reset();
}
@@ -702,14 +678,12 @@ SkPDFGlyphSet* SkPDFGlyphSetMap::getGlyphSetForFont(SkPDFFont* font) {
int index = fMap.count();
for (int i = 0; i < index; ++i) {
if (fMap[i].fFont == font) {
- return fMap[i].fGlyphSet;
+ return &fMap[i].fGlyphSet;
}
}
- fMap.append();
- index = fMap.count() - 1;
- fMap[index].fFont = font;
- fMap[index].fGlyphSet = new SkPDFGlyphSet();
- return fMap[index].fGlyphSet;
+ FontGlyphSetPair& pair = fMap.push_back();
+ pair.fFont = font;
+ return &pair.fGlyphSet;
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/pdf/SkPDFFont.h ('k') | src/utils/SkBitSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698