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

Unified Diff: src/pdf/SkPDFCanon.h

Issue 1372783003: SkPDF: Implement drawImage*() properly (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-09-30 (Wednesday) 21:22:24 EDT Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pdf/SkPDFBitmap.cpp ('k') | src/pdf/SkPDFCanon.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFCanon.h
diff --git a/src/pdf/SkPDFCanon.h b/src/pdf/SkPDFCanon.h
index 2ad5a229aaa7923adf508f4f035bb295ffac4ca7..a55024d611e7aa4ae69102360e4f6d2a6feac8c6 100644
--- a/src/pdf/SkPDFCanon.h
+++ b/src/pdf/SkPDFCanon.h
@@ -7,15 +7,29 @@
#ifndef SkPDFCanon_DEFINED
#define SkPDFCanon_DEFINED
+#include "SkBitmap.h"
#include "SkPDFGraphicState.h"
#include "SkPDFShader.h"
#include "SkTDArray.h"
#include "SkTHash.h"
-class SkBitmap;
class SkPDFFont;
-class SkPDFBitmap;
class SkPaint;
+class SkImage;
+
+class SkBitmapKey {
+public:
+ SkBitmapKey() : fSubset(SkIRect::MakeEmpty()), fGenID(0) {}
+ explicit SkBitmapKey(const SkBitmap& bm)
+ : fSubset(bm.getSubset()), fGenID(bm.getGenerationID()) {}
+ bool operator==(const SkBitmapKey& rhs) const {
+ return fGenID == rhs.fGenID && fSubset == rhs.fSubset;
+ }
+
+private:
+ SkIRect fSubset;
+ uint32_t fGenID;
+};
/**
* The SkPDFCanon canonicalizes objects across PDF pages(SkPDFDevices).
@@ -60,8 +74,9 @@ public:
const SkPDFGraphicState* findGraphicState(const SkPDFGraphicState&) const;
void addGraphicState(const SkPDFGraphicState*);
- SkPDFBitmap* findBitmap(const SkBitmap&) const;
- void addBitmap(SkPDFBitmap*);
+ SkPDFObject* findPDFBitmap(const SkImage* image) const;
+ void addPDFBitmap(uint32_t imageUniqueID, SkPDFObject*);
+ const SkImage* bitmapToImage(const SkBitmap&);
private:
struct FontRec {
@@ -92,6 +107,7 @@ private:
};
SkTHashSet<WrapGS, WrapGS::Hash> fGraphicStateRecords;
- SkTDArray<SkPDFBitmap*> fBitmapRecords;
+ SkTHashMap<SkBitmapKey, const SkImage*> fBitmapToImageMap;
+ SkTHashMap<uint32_t /*ImageUniqueID*/, SkPDFObject*> fPDFBitmapMap;
};
#endif // SkPDFCanon_DEFINED
« no previous file with comments | « src/pdf/SkPDFBitmap.cpp ('k') | src/pdf/SkPDFCanon.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698