aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf/SkPDFFont.h
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2016-06-30 11:55:07 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-30 11:55:07 -0700
commit3c35fb3310c22eb0141c8f39c5423f7bcd42adff (patch)
treef7238cbcc539606975a0e11dc361c66ba1c23cea /src/pdf/SkPDFFont.h
parentd46cdc4c99c0f400b9f7357eb2b877c35707e9c7 (diff)
SkPDF: Glyph Useage Map improvements
Instead of having a fFontGlyphUsage on each device and one on each document, just have the one on the document, and never merge. Make fGlyphUsage accesible on SkPDFDocument. Remove SkPDFGlyphSetMap::merge, ::reset, and SkPDFGlyphSet::merge. SkPDFGlyphSetMap has an TArray of SkPDFGlyphSet, not TDArray of SkPDFGlyphSet pointers. SkPDFGlyphSet and SkPDFBitset get move constructors. All tests produce exactly identical output PDFs. BUG=skia:5434 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2112943002 Review-Url: https://codereview.chromium.org/2112943002
Diffstat (limited to 'src/pdf/SkPDFFont.h')
-rw-r--r--src/pdf/SkPDFFont.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/pdf/SkPDFFont.h b/src/pdf/SkPDFFont.h
index 79a05a8c37..0d73745984 100644
--- a/src/pdf/SkPDFFont.h
+++ b/src/pdf/SkPDFFont.h
@@ -21,10 +21,10 @@ class SkPDFFont;
class SkPDFGlyphSet : SkNoncopyable {
public:
SkPDFGlyphSet();
+ SkPDFGlyphSet(SkPDFGlyphSet&& o) : fBitSet(std::move(o.fBitSet)) {}
void set(const uint16_t* glyphIDs, int numGlyphs);
bool has(uint16_t glyphID) const;
- void merge(const SkPDFGlyphSet& usage);
void exportTo(SkTDArray<uint32_t>* glyphIDs) const;
private:
@@ -33,11 +33,15 @@ private:
class SkPDFGlyphSetMap : SkNoncopyable {
public:
- struct FontGlyphSetPair {
- FontGlyphSetPair(SkPDFFont* font, SkPDFGlyphSet* glyphSet);
-
+ struct FontGlyphSetPair : SkNoncopyable {
+ FontGlyphSetPair() : fFont(nullptr) {}
+ FontGlyphSetPair(FontGlyphSetPair&& o)
+ : fFont(o.fFont)
+ , fGlyphSet(std::move(o.fGlyphSet)) {
+ o.fFont = nullptr;
+ }
SkPDFFont* fFont;
- SkPDFGlyphSet* fGlyphSet;
+ SkPDFGlyphSet fGlyphSet;
};
SkPDFGlyphSetMap();
@@ -46,16 +50,13 @@ public:
const FontGlyphSetPair* begin() const { return fMap.begin(); }
const FontGlyphSetPair* end() const { return fMap.end(); }
- void merge(const SkPDFGlyphSetMap& usage);
- void reset();
-
void noteGlyphUsage(SkPDFFont* font, const uint16_t* glyphIDs,
int numGlyphs);
private:
SkPDFGlyphSet* getGlyphSetForFont(SkPDFFont* font);
- SkTDArray<FontGlyphSetPair> fMap;
+ SkTArray<FontGlyphSetPair> fMap;
};