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

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

Issue 1049753002: SkPDF: Factor SkPDFCatalog into SkPDFObjNumMap and SkPDFSubstituteMap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: full Created 5 years, 8 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 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 SkPDFBitmap_DEFINED 7 #ifndef SkPDFBitmap_DEFINED
8 #define SkPDFBitmap_DEFINED 8 #define SkPDFBitmap_DEFINED
9 9
10 #include "SkPDFTypes.h" 10 #include "SkPDFTypes.h"
11 #include "SkBitmap.h" 11 #include "SkBitmap.h"
12 12
13 class SkPDFCanon; 13 class SkPDFCanon;
14 14
15 /** 15 /**
16 * SkPDFBitmap wraps a SkBitmap and serializes it as an image Xobject. 16 * SkPDFBitmap wraps a SkBitmap and serializes it as an image Xobject.
17 * It is designed to use a minimal amout of memory, aside from refing 17 * It is designed to use a minimal amout of memory, aside from refing
18 * the bitmap's pixels, and its emitObject() does not cache any data. 18 * the bitmap's pixels, and its emitObject() does not cache any data.
19 * 19 *
20 * If !bitmap.isImmutable(), then a copy of the bitmap must be made; 20 * If !bitmap.isImmutable(), then a copy of the bitmap must be made;
21 * there is no way around this. 21 * there is no way around this.
22 * 22 *
23 * The SkPDFBitmap::Create function will check the canon for duplicates. 23 * The SkPDFBitmap::Create function will check the canon for duplicates.
24 */ 24 */
25 class SkPDFBitmap : public SkPDFObject { 25 class SkPDFBitmap : public SkPDFObject {
26 public: 26 public:
27 // Returns NULL on unsupported bitmap; 27 // Returns NULL on unsupported bitmap;
28 static SkPDFBitmap* Create(SkPDFCanon*, const SkBitmap&); 28 static SkPDFBitmap* Create(SkPDFCanon*, const SkBitmap&);
29 ~SkPDFBitmap(); 29 ~SkPDFBitmap();
30 void emitObject(SkWStream*, SkPDFCatalog*) override; 30 void emitObject(SkWStream*,
31 void addResources(SkPDFCatalog*) const override; 31 const SkPDFObjNumMap& objNumMap,
32 const SkPDFSubstituteMap& substitutes) override;
33 void addResources(SkPDFObjNumMap*,
34 const SkPDFSubstituteMap&) const override;
32 bool equals(const SkBitmap& other) const { 35 bool equals(const SkBitmap& other) const {
33 return fBitmap.getGenerationID() == other.getGenerationID() && 36 return fBitmap.getGenerationID() == other.getGenerationID() &&
34 fBitmap.pixelRefOrigin() == other.pixelRefOrigin() && 37 fBitmap.pixelRefOrigin() == other.pixelRefOrigin() &&
35 fBitmap.dimensions() == other.dimensions(); 38 fBitmap.dimensions() == other.dimensions();
36 } 39 }
37 40
38 private: 41 private:
39 const SkBitmap fBitmap; 42 const SkBitmap fBitmap;
40 const SkAutoTUnref<SkPDFObject> fSMask; 43 const SkAutoTUnref<SkPDFObject> fSMask;
41 SkPDFBitmap(const SkBitmap&, SkPDFObject*); 44 SkPDFBitmap(const SkBitmap&, SkPDFObject*);
42 void emitDict(SkWStream*, SkPDFCatalog*, size_t) const;
43 }; 45 };
44 46
45 #endif // SkPDFBitmap_DEFINED 47 #endif // SkPDFBitmap_DEFINED
OLDNEW
« no previous file with comments | « src/doc/SkDocument_PDF.cpp ('k') | src/pdf/SkPDFBitmap.cpp » ('j') | src/pdf/SkPDFStream.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698