| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2010 The Android Open Source Project | 3 * Copyright 2010 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SkPDFGraphicState_DEFINED | 10 #ifndef SkPDFGraphicState_DEFINED |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // demand. | 40 // demand. |
| 41 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog); | 41 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog); |
| 42 | 42 |
| 43 /** Get the graphic state for the passed SkPaint. The reference count of | 43 /** Get the graphic state for the passed SkPaint. The reference count of |
| 44 * the object is incremented and it is the caller's responsibility to | 44 * the object is incremented and it is the caller's responsibility to |
| 45 * unreference it when done. This is needed to accommodate the weak | 45 * unreference it when done. This is needed to accommodate the weak |
| 46 * reference pattern used when the returned object is new and has no | 46 * reference pattern used when the returned object is new and has no |
| 47 * other references. | 47 * other references. |
| 48 * @param paint The SkPaint to emulate. | 48 * @param paint The SkPaint to emulate. |
| 49 */ | 49 */ |
| 50 static SkPDFGraphicState* GetGraphicStateForPaint(const SkPaint& paint); | 50 static SkPDFGraphicState* GetGraphicStateForPaint(SkPDFCanon* canon, |
| 51 const SkPaint& paint); |
| 51 | 52 |
| 52 /** Make a graphic state that only sets the passed soft mask. The | 53 /** Make a graphic state that only sets the passed soft mask. The |
| 53 * reference count of the object is incremented and it is the caller's | 54 * reference count of the object is incremented and it is the caller's |
| 54 * responsibility to unreference it when done. | 55 * responsibility to unreference it when done. |
| 55 * @param sMask The form xobject to use as a soft mask. | 56 * @param sMask The form xobject to use as a soft mask. |
| 56 * @param invert Indicates if the alpha of the sMask should be inverted. | 57 * @param invert Indicates if the alpha of the sMask should be inverted. |
| 57 * @param sMaskMode Whether to use alpha or luminosity for the sMask. | 58 * @param sMaskMode Whether to use alpha or luminosity for the sMask. |
| 58 */ | 59 */ |
| 59 static SkPDFGraphicState* GetSMaskGraphicState(SkPDFFormXObject* sMask, | 60 static SkPDFGraphicState* GetSMaskGraphicState(SkPDFFormXObject* sMask, |
| 60 bool invert, | 61 bool invert, |
| 61 SkPDFSMaskMode sMaskMode); | 62 SkPDFSMaskMode sMaskMode); |
| 62 | 63 |
| 63 /** Get a graphic state that only unsets the soft mask. The reference | 64 /** Get a graphic state that only unsets the soft mask. The reference |
| 64 * count of the object is incremented and it is the caller's responsibility | 65 * count of the object is incremented and it is the caller's responsibility |
| 65 * to unreference it when done. This is needed to accommodate the weak | 66 * to unreference it when done. This is needed to accommodate the weak |
| 66 * reference pattern used when the returned object is new and has no | 67 * reference pattern used when the returned object is new and has no |
| 67 * other references. | 68 * other references. |
| 68 */ | 69 */ |
| 69 static SkPDFGraphicState* GetNoSMaskGraphicState(); | 70 static SkPDFGraphicState* GetNoSMaskGraphicState(); |
| 70 | 71 |
| 71 bool equals(const SkPaint&) const; | 72 bool equals(const SkPaint&) const; |
| 72 | 73 |
| 73 // Only public for SK_DECLARE_STATIC_LAZY_PTR | 74 // Only public for SK_DECLARE_STATIC_LAZY_PTR |
| 74 static SkPDFGraphicState* CreateNoSMaskGraphicState(); | 75 static SkPDFGraphicState* CreateNoSMaskGraphicState(); |
| 75 | 76 |
| 76 private: | 77 private: |
| 78 SkPDFCanon* const fCanon; |
| 77 const SkPaint fPaint; | 79 const SkPaint fPaint; |
| 78 bool fPopulated; | 80 bool fPopulated; |
| 79 bool fSMask; | |
| 80 | 81 |
| 81 SkPDFGraphicState(); | 82 SkPDFGraphicState(); |
| 82 explicit SkPDFGraphicState(const SkPaint& paint); | 83 SkPDFGraphicState(SkPDFCanon* canon, const SkPaint& paint); |
| 83 | 84 |
| 84 void populateDict(); | 85 void populateDict(); |
| 85 | 86 |
| 86 typedef SkPDFDict INHERITED; | 87 typedef SkPDFDict INHERITED; |
| 87 }; | 88 }; |
| 88 | 89 |
| 89 #endif | 90 #endif |
| OLD | NEW |