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

Unified Diff: src/pdf/SkPDFCanon.h

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 | « no previous file | src/pdf/SkPDFCanon.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFCanon.h
diff --git a/src/pdf/SkPDFCanon.h b/src/pdf/SkPDFCanon.h
index 2da9e52f70fb3ef15649fbe4129a3c6e8207e070..a0241e308f469d43e679f8440e7d6bb33d273fd8 100644
--- a/src/pdf/SkPDFCanon.h
+++ b/src/pdf/SkPDFCanon.h
@@ -14,7 +14,6 @@
#include "SkTHash.h"
#include "SkBitmapKey.h"
-class SkAdvancedTypefaceMetrics;
class SkPDFFont;
/**
@@ -36,10 +35,18 @@
*/
class SkPDFCanon : SkNoncopyable {
public:
- ~SkPDFCanon();
+ ~SkPDFCanon() { this->reset(); }
// reset to original setting, unrefs all objects.
void reset();
+
+ // Returns exact match if there is one. If not, it returns nullptr.
+ // If there is no exact match, but there is a related font, we
+ // still return nullptr, but also set *relatedFont.
+ SkPDFFont* findFont(uint32_t fontID,
+ uint16_t glyphID,
+ SkPDFFont** relatedFont) const;
+ void addFont(SkPDFFont* font, uint32_t fontID, uint16_t fGlyphID);
sk_sp<SkPDFObject> findFunctionShader(const SkPDFShader::State&) const;
void addFunctionShader(sk_sp<SkPDFObject>, SkPDFShader::State);
@@ -56,9 +63,7 @@
sk_sp<SkPDFObject> findPDFBitmap(SkBitmapKey key) const;
void addPDFBitmap(SkBitmapKey key, sk_sp<SkPDFObject>);
- SkTHashMap<uint32_t, SkAdvancedTypefaceMetrics*> fTypefaceMetrics;
- SkTHashMap<uint32_t, SkPDFDict*> fFontDescriptors;
- SkTHashMap<uint64_t, SkPDFFont*> fFontMap;
+ SkTHashMap<uint32_t, bool> fCanEmbedTypeface;
SkPixelSerializer* getPixelSerializer() const { return fPixelSerializer.get(); }
void setPixelSerializer(sk_sp<SkPixelSerializer> ps) {
@@ -70,6 +75,13 @@
sk_sp<SkPDFArray> makeRangeObject();
private:
+ struct FontRec {
+ SkPDFFont* fFont;
+ uint32_t fFontID;
+ uint16_t fGlyphID;
+ };
+ SkTDArray<FontRec> fFontRecords;
+
struct ShaderRec {
SkPDFShader::State fShaderState;
sk_sp<SkPDFObject> fShaderObject;
« no previous file with comments | « no previous file | src/pdf/SkPDFCanon.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698