aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf/SkPDFGraphicState.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/pdf/SkPDFGraphicState.h')
-rw-r--r--src/pdf/SkPDFGraphicState.h58
1 files changed, 27 insertions, 31 deletions
diff --git a/src/pdf/SkPDFGraphicState.h b/src/pdf/SkPDFGraphicState.h
index 50b22686ac..4323252bcd 100644
--- a/src/pdf/SkPDFGraphicState.h
+++ b/src/pdf/SkPDFGraphicState.h
@@ -20,24 +20,15 @@ class SkPDFCanon;
be installed. So that a given dictionary is only output to the pdf file
once, we want to canonicalize them.
*/
-class SkPDFGraphicState final : public SkPDFObject {
-
-public:
+namespace SkPDFGraphicState {
enum SkPDFSMaskMode {
kAlpha_SMaskMode,
kLuminosity_SMaskMode
};
- // Override emitObject so that we can populate the dictionary on
- // demand.
- void emitObject(SkWStream* stream,
- const SkPDFObjNumMap& objNumMap) const override;
-
/** Get the graphic state for the passed SkPaint.
- * @param paint The SkPaint to emulate.
*/
- static sk_sp<SkPDFGraphicState> GetGraphicStateForPaint(SkPDFCanon* canon,
- const SkPaint& paint);
+ sk_sp<SkPDFDict> GetGraphicStateForPaint(SkPDFCanon*, const SkPaint&);
/** Make a graphic state that only sets the passed soft mask.
* @param sMask The form xobject to use as a soft mask.
@@ -46,29 +37,34 @@ public:
*
* These are not de-duped.
*/
- static sk_sp<SkPDFDict> GetSMaskGraphicState(sk_sp<SkPDFObject> sMask,
- bool invert,
- SkPDFSMaskMode sMaskMode,
- SkPDFCanon* canon);
-
- static sk_sp<SkPDFStream> MakeInvertFunction();
+ sk_sp<SkPDFDict> GetSMaskGraphicState(sk_sp<SkPDFObject> sMask,
+ bool invert,
+ SkPDFSMaskMode sMaskMode,
+ SkPDFCanon* canon);
- bool operator==(const SkPDFGraphicState& rhs) const {
- return 0 == memcmp(&fStrokeWidth, &rhs.fStrokeWidth, 12);
- }
- uint32_t hash() const { return SkOpts::hash(&fStrokeWidth, 12); }
+ sk_sp<SkPDFStream> MakeInvertFunction();
+}
-private:
- const SkScalar fStrokeWidth;
- const SkScalar fStrokeMiter;
- const uint8_t fAlpha;
- const uint8_t fStrokeCap; // SkPaint::Cap
- const uint8_t fStrokeJoin; // SkPaint::Join
- const uint8_t fMode; // SkBlendMode
-
- SkPDFGraphicState(const SkPaint&);
+SK_BEGIN_REQUIRE_DENSE
+struct SkPDFStrokeGraphicState {
+ SkScalar fStrokeWidth;
+ SkScalar fStrokeMiter;
+ uint8_t fStrokeCap; // SkPaint::Cap
+ uint8_t fStrokeJoin; // SkPaint::Join
+ uint8_t fAlpha;
+ uint8_t fBlendMode;
+ bool operator==(const SkPDFStrokeGraphicState& o) const { return !memcmp(this, &o, sizeof(o)); }
+ bool operator!=(const SkPDFStrokeGraphicState& o) const { return !(*this == o); }
+};
+SK_END_REQUIRE_DENSE
- typedef SkPDFDict INHERITED;
+SK_BEGIN_REQUIRE_DENSE
+struct SkPDFFillGraphicState {
+ uint8_t fAlpha;
+ uint8_t fBlendMode;
+ bool operator==(const SkPDFFillGraphicState& o) const { return !memcmp(this, &o, sizeof(o)); }
+ bool operator!=(const SkPDFFillGraphicState& o) const { return !(*this == o); }
};
+SK_END_REQUIRE_DENSE
#endif