| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SKY_ENGINE_CORE_PAINTING_DRAWLOOPERLAYERINFO_H_ | 5 #ifndef SKY_ENGINE_CORE_PAINTING_DRAWLOOPERLAYERINFO_H_ |
| 6 #define SKY_ENGINE_CORE_PAINTING_DRAWLOOPERLAYERINFO_H_ | 6 #define SKY_ENGINE_CORE_PAINTING_DRAWLOOPERLAYERINFO_H_ |
| 7 | 7 |
| 8 #include "dart/runtime/include/dart_api.h" | 8 #include "dart/runtime/include/dart_api.h" |
| 9 #include "sky/engine/core/painting/Point.h" |
| 10 #include "sky/engine/core/painting/TransferMode.h" |
| 9 #include "sky/engine/tonic/dart_wrappable.h" | 11 #include "sky/engine/tonic/dart_wrappable.h" |
| 10 #include "third_party/skia/include/effects/SkLayerDrawLooper.h" | 12 #include "third_party/skia/include/effects/SkLayerDrawLooper.h" |
| 11 | 13 |
| 12 namespace blink { | 14 namespace blink { |
| 13 | 15 |
| 14 class DrawLooperLayerInfo : public RefCounted<DrawLooperLayerInfo>, | 16 class DrawLooperLayerInfo : public RefCounted<DrawLooperLayerInfo>, |
| 15 public DartWrappable { | 17 public DartWrappable { |
| 16 DEFINE_WRAPPERTYPEINFO(); | 18 DEFINE_WRAPPERTYPEINFO(); |
| 17 public: | 19 public: |
| 18 static PassRefPtr<DrawLooperLayerInfo> create() | 20 static PassRefPtr<DrawLooperLayerInfo> create() |
| 19 { | 21 { |
| 20 return adoptRef(new DrawLooperLayerInfo); | 22 return adoptRef(new DrawLooperLayerInfo); |
| 21 } | 23 } |
| 22 ~DrawLooperLayerInfo() override; | 24 ~DrawLooperLayerInfo() override; |
| 23 | 25 |
| 24 void setPaintBits(unsigned bits) { layer_info_.fPaintBits = bits; } | 26 void setPaintBits(unsigned bits) { layer_info_.fPaintBits = bits; } |
| 25 void setColorMode(unsigned mode) { | 27 void setColorMode(TransferMode m) { layer_info_.fColorMode = m.sk_mode; } |
| 26 layer_info_.fColorMode = static_cast<SkXfermode::Mode>(mode); | 28 void setOffset(Point offset) { layer_info_.fOffset = offset.sk_point; } |
| 27 } | |
| 28 void setOffset(float x, float y) { layer_info_.fOffset.set(x, y); } | |
| 29 void setPostTranslate(bool val) { layer_info_.fPostTranslate = val; } | 29 void setPostTranslate(bool val) { layer_info_.fPostTranslate = val; } |
| 30 | 30 |
| 31 const SkLayerDrawLooper::LayerInfo& layer_info() const { return layer_info_; } | 31 const SkLayerDrawLooper::LayerInfo& layer_info() const { return layer_info_; } |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 DrawLooperLayerInfo(); | 34 DrawLooperLayerInfo(); |
| 35 | 35 |
| 36 SkLayerDrawLooper::LayerInfo layer_info_; | 36 SkLayerDrawLooper::LayerInfo layer_info_; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 } // namespace blink | 39 } // namespace blink |
| 40 | 40 |
| 41 #endif // SKY_ENGINE_CORE_PAINTING_DRAWLOOPERLAYERINFO_H_ | 41 #endif // SKY_ENGINE_CORE_PAINTING_DRAWLOOPERLAYERINFO_H_ |
| OLD | NEW |