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 "android_webview/browser/browser_view_renderer_client.h" | 7 #include "android_webview/browser/browser_view_renderer_client.h" |
8 #include "android_webview/browser/shared_renderer_state.h" | 8 #include "android_webview/browser/shared_renderer_state.h" |
9 #include "android_webview/common/aw_switches.h" | 9 #include "android_webview/common/aw_switches.h" |
10 #include "android_webview/public/browser/draw_gl.h" | 10 #include "android_webview/public/browser/draw_gl.h" |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 base::Bind(&BrowserViewRenderer::CompositeSW, | 321 base::Bind(&BrowserViewRenderer::CompositeSW, |
322 base::Unretained(this))); | 322 base::Unretained(this))); |
323 } | 323 } |
324 | 324 |
325 skia::RefPtr<SkPicture> BrowserViewRenderer::CapturePicture(int width, | 325 skia::RefPtr<SkPicture> BrowserViewRenderer::CapturePicture(int width, |
326 int height) { | 326 int height) { |
327 TRACE_EVENT0("android_webview", "BrowserViewRenderer::CapturePicture"); | 327 TRACE_EVENT0("android_webview", "BrowserViewRenderer::CapturePicture"); |
328 | 328 |
329 // Return empty Picture objects for empty SkPictures. | 329 // Return empty Picture objects for empty SkPictures. |
330 if (width <= 0 || height <= 0) { | 330 if (width <= 0 || height <= 0) { |
331 return skia::AdoptRef(new SkPicture); | 331 SkPictureRecorder emptyRecorder; |
| 332 emptyRecorder.beginRecording(0, 0); |
| 333 return skia::AdoptRef(emptyRecorder.endRecording()); |
332 } | 334 } |
333 | 335 |
334 // Reset scroll back to the origin, will go back to the old | 336 // Reset scroll back to the origin, will go back to the old |
335 // value when scroll_reset is out of scope. | 337 // value when scroll_reset is out of scope. |
336 base::AutoReset<gfx::Vector2dF> scroll_reset(&scroll_offset_dip_, | 338 base::AutoReset<gfx::Vector2dF> scroll_reset(&scroll_offset_dip_, |
337 gfx::Vector2dF()); | 339 gfx::Vector2dF()); |
338 | 340 |
339 SkPictureRecorder recorder; | 341 SkPictureRecorder recorder; |
340 SkCanvas* rec_canvas = recorder.beginRecording(width, height, NULL, 0); | 342 SkCanvas* rec_canvas = recorder.beginRecording(width, height, NULL, 0); |
341 if (compositor_) | 343 if (compositor_) |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 base::StringAppendF(&str, | 759 base::StringAppendF(&str, |
758 "surface width height: [%d %d] ", | 760 "surface width height: [%d %d] ", |
759 draw_info->width, | 761 draw_info->width, |
760 draw_info->height); | 762 draw_info->height); |
761 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); | 763 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); |
762 } | 764 } |
763 return str; | 765 return str; |
764 } | 766 } |
765 | 767 |
766 } // namespace android_webview | 768 } // namespace android_webview |
OLD | NEW |