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

Unified Diff: sky/engine/core/painting/CanvasImage.h

Issue 1151753009: Add Sky framework support for drawing images (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: More style fixes, ran git cl format Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: sky/engine/core/painting/CanvasImage.h
diff --git a/sky/engine/core/painting/CanvasImage.h b/sky/engine/core/painting/CanvasImage.h
new file mode 100644
index 0000000000000000000000000000000000000000..84f04b1642b313ddc714c392269b5dd31a495db5
--- /dev/null
+++ b/sky/engine/core/painting/CanvasImage.h
@@ -0,0 +1,48 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SKY_ENGINE_CORE_PAINTING_CANVASIMAGE_H_
+#define SKY_ENGINE_CORE_PAINTING_CANVASIMAGE_H_
+
+#include "sky/engine/core/loader/NewImageLoader.h"
+#include "sky/engine/platform/weborigin/KURL.h"
+#include "sky/engine/tonic/dart_wrappable.h"
+#include "sky/engine/wtf/PassRefPtr.h"
+#include "sky/engine/wtf/text/AtomicString.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+
+namespace blink {
+
+class CanvasImage final : public RefCounted<CanvasImage>,
+ public DartWrappable,
+ public NewImageLoaderClient {
+ DEFINE_WRAPPERTYPEINFO();
+
abarth-chromium 2015/05/29 23:04:11 We usually omit this blank line.
jackson 2015/05/29 23:35:44 Acknowledged.
+ public:
+ ~CanvasImage() override {}
abarth-chromium 2015/05/29 23:04:11 Please move implementations of virtual function ou
jackson 2015/05/29 23:35:44 Acknowledged.
+ static PassRefPtr<CanvasImage> create() { return adoptRef(new CanvasImage); }
+
+ int width() const;
+ int height() const;
+
+ KURL src() const { return srcURL_; }
+ void setSrc(const String&);
+
+ SkBitmap bitmap() const { return bitmap_; }
abarth-chromium 2015/05/29 23:04:11 const SkBitmap&
jackson 2015/05/29 23:35:44 Acknowledged.
+ void setBitmap(const SkBitmap& bitmap) { bitmap_ = bitmap; }
+
+ private:
+ CanvasImage() : imageLoader_(NewImageLoader::create(this)) {}
abarth-chromium 2015/05/29 23:04:11 I'd move this out-of-line as well.
jackson 2015/05/29 23:35:44 Acknowledged.
+
+ // NewImageLoaderClient
+ void notifyLoadFinished(const SkBitmap& result);
abarth-chromium 2015/05/29 23:04:11 override.
jackson 2015/05/29 23:35:44 Acknowledged.
+
+ KURL srcURL_;
+ SkBitmap bitmap_;
+ OwnPtr<NewImageLoader> imageLoader_;
+};
+
+} // namespace blink
+
+#endif // SKY_ENGINE_CORE_PAINTING_CANVASIMAGE_H_

Powered by Google App Engine
This is Rietveld 408576698