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

Unified Diff: src/pdf/SkPDFCanon.h

Issue 1046293002: SkPDF: SkPDFGraphicState Lookup hashtabled (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-04-01 (Wednesday) 16:16:21 EDT Created 5 years, 9 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/core/SkTHash.h ('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 d0bef27ed6ecb1ae99310fdaaca1f9557a564cb0..5198e7b0acb36452116e5d6ca69328fe5b62dcdf 100644
--- a/src/pdf/SkPDFCanon.h
+++ b/src/pdf/SkPDFCanon.h
@@ -7,12 +7,13 @@
#ifndef SkPDFCanon_DEFINED
#define SkPDFCanon_DEFINED
+#include "SkPDFGraphicState.h"
#include "SkPDFShader.h"
#include "SkTDArray.h"
+#include "SkTHash.h"
class SkBitmap;
class SkPDFFont;
-class SkPDFGraphicState;
class SkPDFBitmap;
class SkPaint;
@@ -56,8 +57,8 @@ public:
SkPDFImageShader* findImageShader(const SkPDFShader::State&) const;
void addImageShader(SkPDFImageShader*);
- SkPDFGraphicState* findGraphicState(const SkPaint&) const;
- void addGraphicState(SkPDFGraphicState*);
+ const SkPDFGraphicState* findGraphicState(const SkPDFGraphicState&) const;
+ void addGraphicState(const SkPDFGraphicState*);
SkPDFBitmap* findBitmap(const SkBitmap&) const;
void addBitmap(SkPDFBitmap*);
@@ -76,7 +77,20 @@ private:
SkTDArray<SkPDFImageShader*> fImageShaderRecords;
- SkTDArray<SkPDFGraphicState*> fGraphicStateRecords;
+ struct WrapGS {
+ explicit WrapGS(const SkPDFGraphicState* ptr = NULL) : fPtr(ptr) {}
+ const SkPDFGraphicState* fPtr;
+ bool operator==(const WrapGS& rhs) const {
+ SkASSERT(fPtr);
+ SkASSERT(rhs.fPtr);
+ return *fPtr == *rhs.fPtr;
+ }
+ static uint32_t Hash(const WrapGS& w) {
+ SkASSERT(w.fPtr);
+ return w.fPtr->hash();
+ }
+ };
+ SkTHashSet<WrapGS, WrapGS::Hash> fGraphicStateRecords;
SkTDArray<SkPDFBitmap*> fBitmapRecords;
};
« no previous file with comments | « src/core/SkTHash.h ('k') | src/pdf/SkPDFCanon.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698