Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: sky/engine/core/painting/CanvasImage.h

Issue 1156003007: Refactor image handling in Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: CR feedback from abarth Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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_CANVASIMAGE_H_ 5 #ifndef SKY_ENGINE_CORE_PAINTING_CANVASIMAGE_H_
6 #define SKY_ENGINE_CORE_PAINTING_CANVASIMAGE_H_ 6 #define SKY_ENGINE_CORE_PAINTING_CANVASIMAGE_H_
7 7
8 #include "sky/engine/core/loader/NewImageLoader.h"
9 #include "sky/engine/platform/weborigin/KURL.h" 8 #include "sky/engine/platform/weborigin/KURL.h"
10 #include "sky/engine/tonic/dart_wrappable.h" 9 #include "sky/engine/tonic/dart_wrappable.h"
11 #include "sky/engine/wtf/PassRefPtr.h" 10 #include "sky/engine/wtf/PassRefPtr.h"
12 #include "sky/engine/wtf/text/AtomicString.h" 11 #include "sky/engine/wtf/text/AtomicString.h"
13 #include "third_party/skia/include/core/SkBitmap.h" 12 #include "third_party/skia/include/core/SkBitmap.h"
14 13
15 namespace blink { 14 namespace blink {
16 15
17 class CanvasImage final : public RefCounted<CanvasImage>, 16 class CanvasImage final : public RefCounted<CanvasImage>,
18 public DartWrappable, 17 public DartWrappable {
19 public NewImageLoaderClient {
20 DEFINE_WRAPPERTYPEINFO(); 18 DEFINE_WRAPPERTYPEINFO();
21 public: 19 public:
22 ~CanvasImage() override; 20 ~CanvasImage() override;
23 static PassRefPtr<CanvasImage> create() { return adoptRef(new CanvasImage); } 21 static PassRefPtr<CanvasImage> create() { return adoptRef(new CanvasImage); }
24 22
25 int width() const; 23 int width() const;
26 int height() const; 24 int height() const;
27 25
28 KURL src() const { return srcURL_; }
29 void setSrc(const String&);
30
31 const SkBitmap& bitmap() const { return bitmap_; } 26 const SkBitmap& bitmap() const { return bitmap_; }
32 void setBitmap(const SkBitmap& bitmap) { bitmap_ = bitmap; } 27 void setBitmap(const SkBitmap& bitmap) { bitmap_ = bitmap; }
33 28
34 private: 29 private:
35 CanvasImage(); 30 CanvasImage();
36 31
37 // NewImageLoaderClient
38 void OnLoadFinished(const SkBitmap& result) override;
39
40 KURL srcURL_;
41 SkBitmap bitmap_; 32 SkBitmap bitmap_;
42 OwnPtr<NewImageLoader> imageLoader_;
43 }; 33 };
44 34
45 } // namespace blink 35 } // namespace blink
46 36
47 #endif // SKY_ENGINE_CORE_PAINTING_CANVASIMAGE_H_ 37 #endif // SKY_ENGINE_CORE_PAINTING_CANVASIMAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698