| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 The Android Open Source Project | 2 * Copyright 2010 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 | 8 |
| 9 #ifndef SkPDFGraphicState_DEFINED | 9 #ifndef SkPDFGraphicState_DEFINED |
| 10 #define SkPDFGraphicState_DEFINED | 10 #define SkPDFGraphicState_DEFINED |
| 11 | 11 |
| 12 #include "SkPDFTypes.h" | 12 #include "SkPDFTypes.h" |
| 13 #include "SkChecksum.h" | 13 #include "SkOpts.h" |
| 14 | 14 |
| 15 class SkPaint; | 15 class SkPaint; |
| 16 class SkPDFCanon; | 16 class SkPDFCanon; |
| 17 | 17 |
| 18 /** \class SkPDFGraphicState | 18 /** \class SkPDFGraphicState |
| 19 SkPaint objects roughly correspond to graphic state dictionaries that can | 19 SkPaint objects roughly correspond to graphic state dictionaries that can |
| 20 be installed. So that a given dictionary is only output to the pdf file | 20 be installed. So that a given dictionary is only output to the pdf file |
| 21 once, we want to canonicalize them. | 21 once, we want to canonicalize them. |
| 22 */ | 22 */ |
| 23 class SkPDFGraphicState final : public SkPDFObject { | 23 class SkPDFGraphicState final : public SkPDFObject { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 SkPDFSMaskMode sMaskMode, | 56 SkPDFSMaskMode sMaskMode, |
| 57 SkPDFCanon* canon); | 57 SkPDFCanon* canon); |
| 58 | 58 |
| 59 /** Make a graphic state that only unsets the soft mask. */ | 59 /** Make a graphic state that only unsets the soft mask. */ |
| 60 static sk_sp<SkPDFDict> MakeNoSmaskGraphicState(); | 60 static sk_sp<SkPDFDict> MakeNoSmaskGraphicState(); |
| 61 static sk_sp<SkPDFStream> MakeInvertFunction(); | 61 static sk_sp<SkPDFStream> MakeInvertFunction(); |
| 62 | 62 |
| 63 bool operator==(const SkPDFGraphicState& rhs) const { | 63 bool operator==(const SkPDFGraphicState& rhs) const { |
| 64 return 0 == memcmp(&fStrokeWidth, &rhs.fStrokeWidth, 12); | 64 return 0 == memcmp(&fStrokeWidth, &rhs.fStrokeWidth, 12); |
| 65 } | 65 } |
| 66 uint32_t hash() const { return SkChecksum::Murmur3(&fStrokeWidth, 12); } | 66 uint32_t hash() const { return SkOpts::hash(&fStrokeWidth, 12); } |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 const SkScalar fStrokeWidth; | 69 const SkScalar fStrokeWidth; |
| 70 const SkScalar fStrokeMiter; | 70 const SkScalar fStrokeMiter; |
| 71 const uint8_t fAlpha; | 71 const uint8_t fAlpha; |
| 72 const uint8_t fStrokeCap; // SkPaint::Cap | 72 const uint8_t fStrokeCap; // SkPaint::Cap |
| 73 const uint8_t fStrokeJoin; // SkPaint::Join | 73 const uint8_t fStrokeJoin; // SkPaint::Join |
| 74 const uint8_t fMode; // SkXfermode::Mode | 74 const uint8_t fMode; // SkXfermode::Mode |
| 75 | 75 |
| 76 SkPDFGraphicState(const SkPaint&); | 76 SkPDFGraphicState(const SkPaint&); |
| 77 | 77 |
| 78 typedef SkPDFDict INHERITED; | 78 typedef SkPDFDict INHERITED; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 #endif | 81 #endif |
| OLD | NEW |