OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SKY_ENGINE_CORE_PAINTING_CANVASIMAGE_H_ |
| 6 #define SKY_ENGINE_CORE_PAINTING_CANVASIMAGE_H_ |
| 7 |
| 8 #include "sky/engine/core/loader/NewImageLoader.h" |
| 9 #include "sky/engine/platform/weborigin/KURL.h" |
| 10 #include "sky/engine/tonic/dart_wrappable.h" |
| 11 #include "sky/engine/wtf/PassRefPtr.h" |
| 12 #include "sky/engine/wtf/text/AtomicString.h" |
| 13 #include "third_party/skia/include/core/SkBitmap.h" |
| 14 |
| 15 namespace blink { |
| 16 |
| 17 class CanvasImage final : public RefCounted<CanvasImage>, |
| 18 public DartWrappable, |
| 19 public NewImageLoaderClient { |
| 20 DEFINE_WRAPPERTYPEINFO(); |
| 21 public: |
| 22 ~CanvasImage() override; |
| 23 static PassRefPtr<CanvasImage> create() { return adoptRef(new CanvasImage); } |
| 24 |
| 25 int width() const; |
| 26 int height() const; |
| 27 |
| 28 KURL src() const { return srcURL_; } |
| 29 void setSrc(const String&); |
| 30 |
| 31 const SkBitmap& bitmap() const { return bitmap_; } |
| 32 void setBitmap(const SkBitmap& bitmap) { bitmap_ = bitmap; } |
| 33 |
| 34 private: |
| 35 CanvasImage(); |
| 36 |
| 37 // NewImageLoaderClient |
| 38 void OnLoadFinished(const SkBitmap& result) override; |
| 39 |
| 40 KURL srcURL_; |
| 41 SkBitmap bitmap_; |
| 42 OwnPtr<NewImageLoader> imageLoader_; |
| 43 }; |
| 44 |
| 45 } // namespace blink |
| 46 |
| 47 #endif // SKY_ENGINE_CORE_PAINTING_CANVASIMAGE_H_ |
OLD | NEW |