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

Side by Side Diff: src/pdf/SkPDFCanon.h

Issue 1505763003: SkDocument::setDCTEncoder() for old versions of webkit (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove compile flag; unit test Created 5 years 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
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 #ifndef SkPDFCanon_DEFINED 7 #ifndef SkPDFCanon_DEFINED
8 #define SkPDFCanon_DEFINED 8 #define SkPDFCanon_DEFINED
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 * SkPDFCanon. 42 * SkPDFCanon.
43 * 43 *
44 * The addFoo() methods will ref the Foo; the canon's destructor will 44 * The addFoo() methods will ref the Foo; the canon's destructor will
45 * call foo->unref() on all of these objects. 45 * call foo->unref() on all of these objects.
46 * 46 *
47 * The findFoo() methods do not change the ref count of the Foo 47 * The findFoo() methods do not change the ref count of the Foo
48 * objects. 48 * objects.
49 */ 49 */
50 class SkPDFCanon : SkNoncopyable { 50 class SkPDFCanon : SkNoncopyable {
51 public: 51 public:
52 SkPDFCanon() : fEncoder(nullptr) {}
52 ~SkPDFCanon() { this->reset(); } 53 ~SkPDFCanon() { this->reset(); }
53 54
54 // reset to original setting, unrefs all objects. 55 // reset to original setting, unrefs all objects.
55 void reset(); 56 void reset();
56 57
57 // Returns exact match if there is one. If not, it returns nullptr. 58 // Returns exact match if there is one. If not, it returns nullptr.
58 // If there is no exact match, but there is a related font, we 59 // If there is no exact match, but there is a related font, we
59 // still return nullptr, but also set *relatedFont. 60 // still return nullptr, but also set *relatedFont.
60 SkPDFFont* findFont(uint32_t fontID, 61 SkPDFFont* findFont(uint32_t fontID,
61 uint16_t glyphID, 62 uint16_t glyphID,
(...skipping 11 matching lines...) Expand all
73 74
74 const SkPDFGraphicState* findGraphicState(const SkPDFGraphicState&) const; 75 const SkPDFGraphicState* findGraphicState(const SkPDFGraphicState&) const;
75 void addGraphicState(const SkPDFGraphicState*); 76 void addGraphicState(const SkPDFGraphicState*);
76 77
77 SkPDFObject* findPDFBitmap(const SkImage* image) const; 78 SkPDFObject* findPDFBitmap(const SkImage* image) const;
78 void addPDFBitmap(uint32_t imageUniqueID, SkPDFObject*); 79 void addPDFBitmap(uint32_t imageUniqueID, SkPDFObject*);
79 const SkImage* bitmapToImage(const SkBitmap&); 80 const SkImage* bitmapToImage(const SkBitmap&);
80 81
81 SkTHashMap<uint32_t, bool> fCanEmbedTypeface; 82 SkTHashMap<uint32_t, bool> fCanEmbedTypeface;
82 83
84 SkData* (*fEncoder)(const SkPixmap&);
85
83 private: 86 private:
84 struct FontRec { 87 struct FontRec {
85 SkPDFFont* fFont; 88 SkPDFFont* fFont;
86 uint32_t fFontID; 89 uint32_t fFontID;
87 uint16_t fGlyphID; 90 uint16_t fGlyphID;
88 }; 91 };
89 SkTDArray<FontRec> fFontRecords; 92 SkTDArray<FontRec> fFontRecords;
90 93
91 SkTDArray<SkPDFFunctionShader*> fFunctionShaderRecords; 94 SkTDArray<SkPDFFunctionShader*> fFunctionShaderRecords;
92 95
(...skipping 15 matching lines...) Expand all
108 return w.fPtr->hash(); 111 return w.fPtr->hash();
109 } 112 }
110 }; 113 };
111 }; 114 };
112 SkTHashSet<WrapGS, WrapGS::Hash> fGraphicStateRecords; 115 SkTHashSet<WrapGS, WrapGS::Hash> fGraphicStateRecords;
113 116
114 SkTHashMap<SkBitmapKey, const SkImage*> fBitmapToImageMap; 117 SkTHashMap<SkBitmapKey, const SkImage*> fBitmapToImageMap;
115 SkTHashMap<uint32_t /*ImageUniqueID*/, SkPDFObject*> fPDFBitmapMap; 118 SkTHashMap<uint32_t /*ImageUniqueID*/, SkPDFObject*> fPDFBitmapMap;
116 }; 119 };
117 #endif // SkPDFCanon_DEFINED 120 #endif // SkPDFCanon_DEFINED
OLDNEW
« no previous file with comments | « src/pdf/SkPDFBitmap.cpp ('k') | src/pdf/SkPDFDevice.cpp » ('j') | tests/PDFDocumentTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698