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

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

Issue 1151753009: Add Sky framework support for drawing images (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Run git cl format once more 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
« no previous file with comments | « sky/engine/core/painting/CanvasImage.h ('k') | sky/engine/core/painting/Image.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #include "sky/engine/config.h"
6 #include "sky/engine/core/painting/CanvasImage.h"
7
8 namespace blink {
9
10 CanvasImage::CanvasImage() : imageLoader_(adoptPtr(new NewImageLoader(this))) {
11 }
12
13 CanvasImage::~CanvasImage() {
14 }
15
16 int CanvasImage::width() const {
17 return bitmap_.width();
18 }
19
20 int CanvasImage::height() const {
21 return bitmap_.height();
22 }
23
24 void CanvasImage::setSrc(const String& url) {
25 // TODO(jackson): Figure out how to determine the proper base URL here
26 KURL newSrcURL = KURL(KURL(), url);
27 if (srcURL_ != newSrcURL) {
28 srcURL_ = newSrcURL;
29 imageLoader_->Load(srcURL_);
30 }
31 }
32
33 void CanvasImage::OnLoadFinished(const SkBitmap& result) {
34 // TODO(jackson): We'll eventually need a notification pathway for
35 // when the image load is complete so that we know to repaint, etc.
36 bitmap_ = result;
37 }
38
39 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/painting/CanvasImage.h ('k') | sky/engine/core/painting/Image.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698