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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 } | 322 } |
| 323 | 323 |
| 324 skia::RefPtr<SkPicture> BrowserViewRenderer::CapturePicture(int width, | 324 skia::RefPtr<SkPicture> BrowserViewRenderer::CapturePicture(int width, |
| 325 int height) { | 325 int height) { |
| 326 TRACE_EVENT0("android_webview", "BrowserViewRenderer::CapturePicture"); | 326 TRACE_EVENT0("android_webview", "BrowserViewRenderer::CapturePicture"); |
| 327 | 327 |
| 328 // Return empty Picture objects for empty SkPictures. | 328 // Return empty Picture objects for empty SkPictures. |
| 329 if (width <= 0 || height <= 0) { | 329 if (width <= 0 || height <= 0) { |
| 330 SkPictureRecorder emptyRecorder; | 330 SkPictureRecorder emptyRecorder; |
| 331 emptyRecorder.beginRecording(0, 0); | 331 emptyRecorder.beginRecording(0, 0); |
| 332 return skia::AdoptRef(emptyRecorder.endRecording()); | 332 return skia::AdoptRef(emptyRecorder.finishRecordingAsPicture()); |
|
Stephen White
2016/03/24 19:05:57
Out of curiosity, are there plans to place skia::R
f(malita)
2016/03/24 19:17:10
Now that we have sk_sp I think it makes perfect se
Stephen White
2016/03/24 19:42:54
In that case, should this function be returning an
f(malita)
2016/03/24 20:22:41
It should, but I would rather not pull on this par
| |
| 333 } | 333 } |
| 334 | 334 |
| 335 SkPictureRecorder recorder; | 335 SkPictureRecorder recorder; |
| 336 SkCanvas* rec_canvas = recorder.beginRecording(width, height, NULL, 0); | 336 SkCanvas* rec_canvas = recorder.beginRecording(width, height, NULL, 0); |
| 337 if (compositor_) { | 337 if (compositor_) { |
| 338 { | 338 { |
| 339 // Reset scroll back to the origin, will go back to the old | 339 // Reset scroll back to the origin, will go back to the old |
| 340 // value when scroll_reset is out of scope. | 340 // value when scroll_reset is out of scope. |
| 341 compositor_->DidChangeRootLayerScrollOffset(gfx::ScrollOffset()); | 341 compositor_->DidChangeRootLayerScrollOffset(gfx::ScrollOffset()); |
| 342 CompositeSW(rec_canvas); | 342 CompositeSW(rec_canvas); |
| 343 } | 343 } |
| 344 compositor_->DidChangeRootLayerScrollOffset( | 344 compositor_->DidChangeRootLayerScrollOffset( |
| 345 gfx::ScrollOffset(scroll_offset_dip_)); | 345 gfx::ScrollOffset(scroll_offset_dip_)); |
| 346 } | 346 } |
| 347 return skia::AdoptRef(recorder.endRecording()); | 347 return skia::AdoptRef(recorder.finishRecordingAsPicture()); |
| 348 } | 348 } |
| 349 | 349 |
| 350 void BrowserViewRenderer::EnableOnNewPicture(bool enabled) { | 350 void BrowserViewRenderer::EnableOnNewPicture(bool enabled) { |
| 351 on_new_picture_enable_ = enabled; | 351 on_new_picture_enable_ = enabled; |
| 352 } | 352 } |
| 353 | 353 |
| 354 void BrowserViewRenderer::ClearView() { | 354 void BrowserViewRenderer::ClearView() { |
| 355 TRACE_EVENT_INSTANT0("android_webview", | 355 TRACE_EVENT_INSTANT0("android_webview", |
| 356 "BrowserViewRenderer::ClearView", | 356 "BrowserViewRenderer::ClearView", |
| 357 TRACE_EVENT_SCOPE_THREAD); | 357 TRACE_EVENT_SCOPE_THREAD); |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 726 base::StringAppendF(&str, | 726 base::StringAppendF(&str, |
| 727 "overscroll_rounding_error_: %s ", | 727 "overscroll_rounding_error_: %s ", |
| 728 overscroll_rounding_error_.ToString().c_str()); | 728 overscroll_rounding_error_.ToString().c_str()); |
| 729 base::StringAppendF( | 729 base::StringAppendF( |
| 730 &str, "on_new_picture_enable: %d ", on_new_picture_enable_); | 730 &str, "on_new_picture_enable: %d ", on_new_picture_enable_); |
| 731 base::StringAppendF(&str, "clear_view: %d ", clear_view_); | 731 base::StringAppendF(&str, "clear_view: %d ", clear_view_); |
| 732 return str; | 732 return str; |
| 733 } | 733 } |
| 734 | 734 |
| 735 } // namespace android_webview | 735 } // namespace android_webview |
| OLD | NEW |