OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright 2015 Google Inc. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license that can be | |
5 * found in the LICENSE file. | |
6 */ | |
7 #ifndef SkPDFBitmap_DEFINED | |
8 #define SkPDFBitmap_DEFINED | |
9 | |
10 #include "SkPDFTypes.h" | |
11 #include "SkBitmap.h" | |
12 | |
13 /** | |
14 * This is a replacement for SkPDFImage. As of now, it only supports | |
mtklein
2015/02/12 00:21:46
Let's write this comment first as if SkPDFImage di
hal.canary
2015/02/12 21:28:03
Done.
| |
15 * 8888 bitmaps (the most common case). This onbect takes very little | |
mtklein
2015/02/12 00:21:46
object
| |
16 * extra memory (aside from refing the bitmap's pixels), and its | |
17 * emitObject() does not cache any data. | |
18 * | |
19 * The SkPDFBitmap::Create function will check the canon for duplicates. | |
20 */ | |
21 class SkPDFBitmap : public SkPDFObject { | |
22 public: | |
23 // Returns NULL on unsupported bitmap; | |
24 // TODO(halcanary): support other bitmap colortypes and replace | |
25 // SkPDFImage. | |
26 static SkPDFBitmap* Create(const SkBitmap&, | |
27 const SkIRect& subset); | |
mtklein
2015/02/12 00:21:46
Does passing a subset here have any different effe
hal.canary
2015/02/12 21:28:03
It's only here to match the calling site.
| |
28 ~SkPDFBitmap(); | |
29 void emitObject(SkWStream*, SkPDFCatalog*) SK_OVERRIDE; | |
30 void addResources(SkTSet<SkPDFObject*>* resourceSet, | |
31 SkPDFCatalog* catalog) const SK_OVERRIDE; | |
32 bool equals(const SkBitmap& other) const { | |
33 return fBitmap.getGenerationID() == other.getGenerationID() && | |
34 fBitmap.pixelRefOrigin() == other.pixelRefOrigin() && | |
35 fBitmap.dimensions() == other.dimensions() && !fIsAlpha; | |
mtklein
2015/02/12 00:21:46
What's the deal with && !fIsAlpha? That deserves
hal.canary
2015/02/12 21:28:03
When IsAlpha is true, the SkPDFBitmap represents t
| |
36 } | |
37 | |
38 private: | |
39 SkBitmap fBitmap; | |
40 SkAutoTUnref<SkPDFBitmap> fSMask; | |
41 bool fIsAlpha; | |
42 SkPDFBitmap(const SkBitmap&, bool isAlpha, SkPDFBitmap* smask); | |
43 }; | |
44 | |
45 #endif // SkPDFBitmap_DEFINED | |
OLD | NEW |