OLD | NEW |
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 #include "android_webview/native/aw_picture.h" | 5 #include "android_webview/native/aw_picture.h" |
6 | 6 |
7 #include "android_webview/native/java_browser_view_renderer_helper.h" | 7 #include "android_webview/native/java_browser_view_renderer_helper.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "jni/AwPicture_jni.h" | 9 #include "jni/AwPicture_jni.h" |
10 #include "third_party/skia/include/core/SkPicture.h" | 10 #include "third_party/skia/include/core/SkPicture.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 } | 27 } |
28 | 28 |
29 jint AwPicture::GetHeight(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 29 jint AwPicture::GetHeight(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
30 return picture_->cullRect().roundOut().height(); | 30 return picture_->cullRect().roundOut().height(); |
31 } | 31 } |
32 | 32 |
33 void AwPicture::Draw(JNIEnv* env, | 33 void AwPicture::Draw(JNIEnv* env, |
34 const JavaParamRef<jobject>& obj, | 34 const JavaParamRef<jobject>& obj, |
35 const JavaParamRef<jobject>& canvas) { | 35 const JavaParamRef<jobject>& canvas) { |
36 const SkIRect bounds = picture_->cullRect().roundOut(); | 36 const SkIRect bounds = picture_->cullRect().roundOut(); |
37 scoped_ptr<SoftwareCanvasHolder> canvas_holder = SoftwareCanvasHolder::Create( | 37 std::unique_ptr<SoftwareCanvasHolder> canvas_holder = |
38 canvas, gfx::Vector2d(), gfx::Size(bounds.width(), bounds.height()), | 38 SoftwareCanvasHolder::Create(canvas, gfx::Vector2d(), |
39 false); | 39 gfx::Size(bounds.width(), bounds.height()), |
| 40 false); |
40 if (!canvas_holder || !canvas_holder->GetCanvas()) { | 41 if (!canvas_holder || !canvas_holder->GetCanvas()) { |
41 LOG(ERROR) << "Couldn't draw picture"; | 42 LOG(ERROR) << "Couldn't draw picture"; |
42 return; | 43 return; |
43 } | 44 } |
44 picture_->playback(canvas_holder->GetCanvas()); | 45 picture_->playback(canvas_holder->GetCanvas()); |
45 } | 46 } |
46 | 47 |
47 bool RegisterAwPicture(JNIEnv* env) { | 48 bool RegisterAwPicture(JNIEnv* env) { |
48 return RegisterNativesImpl(env); | 49 return RegisterNativesImpl(env); |
49 } | 50 } |
50 | 51 |
51 } // namespace android_webview | 52 } // namespace android_webview |
OLD | NEW |