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

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

Issue 918813002: PDF: Add (low-memory) SkPDFBitmap class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-02-11 (Wednesday) 18:49:13 EST 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
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698