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

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

Issue 944643002: PDF: Now threadsafe! (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: TODO=DONE Created 5 years, 10 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
« no previous file with comments | « src/doc/SkDocument_PDF.cpp ('k') | src/pdf/SkPDFBitmap.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
14
13 /** 15 /**
14 * SkPDFBitmap wraps a SkBitmap and serializes it as an image Xobject. 16 * SkPDFBitmap wraps a SkBitmap and serializes it as an image Xobject.
15 * 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
16 * 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.
17 * 19 *
18 * As of now, it only supports 8888 bitmaps (the most common case). 20 * As of now, it only supports 8888 bitmaps (the most common case).
19 * 21 *
20 * The SkPDFBitmap::Create function will check the canon for duplicates. 22 * The SkPDFBitmap::Create function will check the canon for duplicates.
21 */ 23 */
22 class SkPDFBitmap : public SkPDFObject { 24 class SkPDFBitmap : public SkPDFObject {
23 public: 25 public:
24 // Returns NULL on unsupported bitmap; 26 // Returns NULL on unsupported bitmap;
25 // TODO(halcanary): support other bitmap colortypes and replace 27 // TODO(halcanary): support other bitmap colortypes and replace
26 // SkPDFImage. 28 // SkPDFImage.
27 static SkPDFBitmap* Create(const SkBitmap&, const SkIRect& subset); 29 static SkPDFBitmap* Create(SkPDFCanon*,
30 const SkBitmap&,
31 const SkIRect& subset);
28 ~SkPDFBitmap(); 32 ~SkPDFBitmap();
29 void emitObject(SkWStream*, SkPDFCatalog*) SK_OVERRIDE; 33 void emitObject(SkWStream*, SkPDFCatalog*) SK_OVERRIDE;
30 void addResources(SkTSet<SkPDFObject*>* resourceSet, 34 void addResources(SkTSet<SkPDFObject*>* resourceSet,
31 SkPDFCatalog* catalog) const SK_OVERRIDE; 35 SkPDFCatalog* catalog) const SK_OVERRIDE;
32 bool equals(const SkBitmap& other) const { 36 bool equals(const SkBitmap& other) const {
33 return fBitmap.getGenerationID() == other.getGenerationID() && 37 return fBitmap.getGenerationID() == other.getGenerationID() &&
34 fBitmap.pixelRefOrigin() == other.pixelRefOrigin() && 38 fBitmap.pixelRefOrigin() == other.pixelRefOrigin() &&
35 fBitmap.dimensions() == other.dimensions(); 39 fBitmap.dimensions() == other.dimensions();
36 } 40 }
37 41
38 private: 42 private:
43 SkPDFCanon* const fCanon;
39 const SkBitmap fBitmap; 44 const SkBitmap fBitmap;
40 const SkAutoTUnref<SkPDFObject> fSMask; 45 const SkAutoTUnref<SkPDFObject> fSMask;
41 SkPDFBitmap(const SkBitmap&, SkPDFObject*); 46 SkPDFBitmap(SkPDFCanon*, const SkBitmap&, SkPDFObject*);
42 void emitDict(SkWStream*, SkPDFCatalog*, size_t, bool) const; 47 void emitDict(SkWStream*, SkPDFCatalog*, size_t, bool) const;
43 }; 48 };
44 49
45 #endif // SkPDFBitmap_DEFINED 50 #endif // SkPDFBitmap_DEFINED
OLDNEW
« no previous file with comments | « src/doc/SkDocument_PDF.cpp ('k') | src/pdf/SkPDFBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698