| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 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 #ifndef SkLayerDrawLooper_DEFINED | 8 #ifndef SkLayerDrawLooper_DEFINED |
| 9 #define SkLayerDrawLooper_DEFINED | 9 #define SkLayerDrawLooper_DEFINED |
| 10 | 10 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 /** | 92 /** |
| 93 * This layer will draw with the original paint, at the specified offset | 93 * This layer will draw with the original paint, at the specified offset |
| 94 */ | 94 */ |
| 95 void addLayer(SkScalar dx, SkScalar dy); | 95 void addLayer(SkScalar dx, SkScalar dy); |
| 96 | 96 |
| 97 /** | 97 /** |
| 98 * This layer will with the original paint and no offset. | 98 * This layer will with the original paint and no offset. |
| 99 */ | 99 */ |
| 100 void addLayer() { this->addLayer(0, 0); } | 100 void addLayer() { this->addLayer(0, 0); } |
| 101 | 101 |
| 102 /// Similar to addLayer, but adds a layer to the top. |
| 103 SkPaint* addLayerOnTop(const LayerInfo&); |
| 104 |
| 102 // overrides from SkDrawLooper | 105 // overrides from SkDrawLooper |
| 103 virtual void init(SkCanvas*); | 106 virtual void init(SkCanvas*); |
| 104 virtual bool next(SkCanvas*, SkPaint* paint); | 107 virtual bool next(SkCanvas*, SkPaint* paint); |
| 105 | 108 |
| 106 SK_DEVELOPER_TO_STRING() | 109 SK_DEVELOPER_TO_STRING() |
| 107 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLayerDrawLooper) | 110 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLayerDrawLooper) |
| 108 | 111 |
| 109 protected: | 112 protected: |
| 110 SkLayerDrawLooper(SkFlattenableReadBuffer&); | 113 SkLayerDrawLooper(SkFlattenableReadBuffer&); |
| 111 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; | 114 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; |
| 112 | 115 |
| 113 private: | 116 private: |
| 114 struct Rec { | 117 struct Rec { |
| 115 Rec* fNext; | 118 Rec* fNext; |
| 116 SkPaint fPaint; | 119 SkPaint fPaint; |
| 117 LayerInfo fInfo; | 120 LayerInfo fInfo; |
| 118 | |
| 119 static Rec* Reverse(Rec*); | |
| 120 }; | 121 }; |
| 121 Rec* fRecs; | 122 Rec* fRecs; |
| 123 Rec* fTopRec; |
| 122 int fCount; | 124 int fCount; |
| 123 | 125 |
| 124 // state-machine during the init/next cycle | 126 // state-machine during the init/next cycle |
| 125 Rec* fCurrRec; | 127 Rec* fCurrRec; |
| 126 | 128 |
| 127 static void ApplyInfo(SkPaint* dst, const SkPaint& src, const LayerInfo&); | 129 static void ApplyInfo(SkPaint* dst, const SkPaint& src, const LayerInfo&); |
| 128 | 130 |
| 129 class MyRegistrar : public SkFlattenable::Registrar { | 131 class MyRegistrar : public SkFlattenable::Registrar { |
| 130 public: | 132 public: |
| 131 MyRegistrar(); | 133 MyRegistrar(); |
| 132 }; | 134 }; |
| 133 | 135 |
| 134 typedef SkDrawLooper INHERITED; | 136 typedef SkDrawLooper INHERITED; |
| 135 }; | 137 }; |
| 136 | 138 |
| 137 #endif | 139 #endif |
| OLD | NEW |