Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/browser_view_renderer.h" | 5 #include "android_webview/browser/browser_view_renderer.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "android_webview/browser/browser_view_renderer_client.h" | 9 #include "android_webview/browser/browser_view_renderer_client.h" |
| 10 #include "android_webview/browser/child_frame.h" | 10 #include "android_webview/browser/child_frame.h" |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 302 compositor->ReturnResources(iterator->second.output_surface_id, | 302 compositor->ReturnResources(iterator->second.output_surface_id, |
| 303 frame_ack); | 303 frame_ack); |
| 304 } | 304 } |
| 305 } | 305 } |
| 306 } | 306 } |
| 307 | 307 |
| 308 bool BrowserViewRenderer::OnDrawSoftware(SkCanvas* canvas) { | 308 bool BrowserViewRenderer::OnDrawSoftware(SkCanvas* canvas) { |
| 309 return CanOnDraw() && CompositeSW(canvas); | 309 return CanOnDraw() && CompositeSW(canvas); |
| 310 } | 310 } |
| 311 | 311 |
| 312 skia::RefPtr<SkPicture> BrowserViewRenderer::CapturePicture(int width, | 312 sk_sp<SkPicture> BrowserViewRenderer::CapturePicture(int width, |
| 313 int height) { | 313 int height) { |
| 314 TRACE_EVENT0("android_webview", "BrowserViewRenderer::CapturePicture"); | 314 TRACE_EVENT0("android_webview", "BrowserViewRenderer::CapturePicture"); |
| 315 | 315 |
| 316 // Return empty Picture objects for empty SkPictures. | 316 // Return empty Picture objects for empty SkPictures. |
| 317 if (width <= 0 || height <= 0) { | 317 if (width <= 0 || height <= 0) { |
| 318 SkPictureRecorder emptyRecorder; | 318 SkPictureRecorder emptyRecorder; |
| 319 emptyRecorder.beginRecording(0, 0); | 319 emptyRecorder.beginRecording(0, 0); |
| 320 return skia::AdoptRef(emptyRecorder.finishRecordingAsPicture()); | 320 return sk_sp<SkPicture>(emptyRecorder.finishRecordingAsPicture()); |
|
f(malita)
2016/05/02 16:51:41
finishRecordingAsPicture() returns an sk_sp<SkPict
| |
| 321 } | 321 } |
| 322 | 322 |
| 323 SkPictureRecorder recorder; | 323 SkPictureRecorder recorder; |
| 324 SkCanvas* rec_canvas = recorder.beginRecording(width, height, NULL, 0); | 324 SkCanvas* rec_canvas = recorder.beginRecording(width, height, NULL, 0); |
| 325 if (compositor_) { | 325 if (compositor_) { |
| 326 { | 326 { |
| 327 // Reset scroll back to the origin, will go back to the old | 327 // Reset scroll back to the origin, will go back to the old |
| 328 // value when scroll_reset is out of scope. | 328 // value when scroll_reset is out of scope. |
| 329 compositor_->DidChangeRootLayerScrollOffset(gfx::ScrollOffset()); | 329 compositor_->DidChangeRootLayerScrollOffset(gfx::ScrollOffset()); |
| 330 CompositeSW(rec_canvas); | 330 CompositeSW(rec_canvas); |
| 331 } | 331 } |
| 332 compositor_->DidChangeRootLayerScrollOffset( | 332 compositor_->DidChangeRootLayerScrollOffset( |
| 333 gfx::ScrollOffset(scroll_offset_dip_)); | 333 gfx::ScrollOffset(scroll_offset_dip_)); |
| 334 } | 334 } |
| 335 return skia::AdoptRef(recorder.finishRecordingAsPicture()); | 335 return sk_sp<SkPicture>(recorder.finishRecordingAsPicture()); |
|
f(malita)
2016/05/02 16:51:41
Ditto.
| |
| 336 } | 336 } |
| 337 | 337 |
| 338 void BrowserViewRenderer::EnableOnNewPicture(bool enabled) { | 338 void BrowserViewRenderer::EnableOnNewPicture(bool enabled) { |
| 339 on_new_picture_enable_ = enabled; | 339 on_new_picture_enable_ = enabled; |
| 340 } | 340 } |
| 341 | 341 |
| 342 void BrowserViewRenderer::ClearView() { | 342 void BrowserViewRenderer::ClearView() { |
| 343 TRACE_EVENT_INSTANT0("android_webview", | 343 TRACE_EVENT_INSTANT0("android_webview", |
| 344 "BrowserViewRenderer::ClearView", | 344 "BrowserViewRenderer::ClearView", |
| 345 TRACE_EVENT_SCOPE_THREAD); | 345 TRACE_EVENT_SCOPE_THREAD); |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 718 base::StringAppendF(&str, | 718 base::StringAppendF(&str, |
| 719 "overscroll_rounding_error_: %s ", | 719 "overscroll_rounding_error_: %s ", |
| 720 overscroll_rounding_error_.ToString().c_str()); | 720 overscroll_rounding_error_.ToString().c_str()); |
| 721 base::StringAppendF( | 721 base::StringAppendF( |
| 722 &str, "on_new_picture_enable: %d ", on_new_picture_enable_); | 722 &str, "on_new_picture_enable: %d ", on_new_picture_enable_); |
| 723 base::StringAppendF(&str, "clear_view: %d ", clear_view_); | 723 base::StringAppendF(&str, "clear_view: %d ", clear_view_); |
| 724 return str; | 724 return str; |
| 725 } | 725 } |
| 726 | 726 |
| 727 } // namespace android_webview | 727 } // namespace android_webview |
| OLD | NEW |