Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/browser/browser_view_renderer_impl.h" | 5 #include "android_webview/browser/browser_view_renderer_impl.h" |
| 6 | 6 |
| 7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
| 8 | 8 |
| 9 #include "android_webview/browser/in_process_renderer/in_process_view_renderer.h " | 9 #include "android_webview/browser/in_process_renderer/in_process_view_renderer.h " |
| 10 #include "android_webview/common/aw_switches.h" | 10 #include "android_webview/common/aw_switches.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 335 if (clip.IsEmpty()) | 335 if (clip.IsEmpty()) |
| 336 return true; | 336 return true; |
| 337 | 337 |
| 338 AwPixelInfo* pixels; | 338 AwPixelInfo* pixels; |
| 339 JNIEnv* env = AttachCurrentThread(); | 339 JNIEnv* env = AttachCurrentThread(); |
| 340 | 340 |
| 341 // Render into an auxiliary bitmap if pixel info is not available. | 341 // Render into an auxiliary bitmap if pixel info is not available. |
| 342 if (!g_sw_draw_functions || | 342 if (!g_sw_draw_functions || |
| 343 (pixels = g_sw_draw_functions->access_pixels(env, java_canvas)) == NULL) { | 343 (pixels = g_sw_draw_functions->access_pixels(env, java_canvas)) == NULL) { |
| 344 ScopedJavaLocalRef<jobject> jbitmap(java_helper_->CreateBitmap( | 344 ScopedJavaLocalRef<jobject> jbitmap(java_helper_->CreateBitmap( |
| 345 env, clip.width(), clip.height())); | 345 env, clip.width(), clip.height(), true)); |
| 346 if (!jbitmap.obj()) | 346 if (!jbitmap.obj()) |
| 347 return false; | 347 return false; |
| 348 | 348 |
| 349 if (!RasterizeIntoBitmap(env, jbitmap, clip.x(), clip.y(), | 349 if (!RasterizeIntoBitmap(env, jbitmap, clip.x(), clip.y(), |
| 350 base::Bind(&BrowserViewRendererImpl::RenderSW, | 350 base::Bind(&BrowserViewRendererImpl::RenderSW, |
| 351 base::Unretained(this)))) { | 351 base::Unretained(this)))) { |
| 352 return false; | 352 return false; |
| 353 } | 353 } |
| 354 | 354 |
| 355 ScopedJavaLocalRef<jobject> jcanvas(env, java_canvas); | 355 ScopedJavaLocalRef<jobject> jcanvas(env, java_canvas); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 413 if (g_is_skia_version_compatible) { | 413 if (g_is_skia_version_compatible) { |
| 414 // Add a reference that the create_picture() will take ownership of. | 414 // Add a reference that the create_picture() will take ownership of. |
| 415 picture->ref(); | 415 picture->ref(); |
| 416 return ScopedJavaLocalRef<jobject>(env, | 416 return ScopedJavaLocalRef<jobject>(env, |
| 417 g_sw_draw_functions->create_picture(env, picture.get())); | 417 g_sw_draw_functions->create_picture(env, picture.get())); |
| 418 } | 418 } |
| 419 | 419 |
| 420 // If Skia versions are not compatible, workaround it by rasterizing the | 420 // If Skia versions are not compatible, workaround it by rasterizing the |
| 421 // picture into a bitmap and drawing it into a new Java picture. | 421 // picture into a bitmap and drawing it into a new Java picture. |
| 422 ScopedJavaLocalRef<jobject> jbitmap(java_helper_->CreateBitmap( | 422 ScopedJavaLocalRef<jobject> jbitmap(java_helper_->CreateBitmap( |
| 423 env, picture->width(), picture->height())); | 423 env, picture->width(), picture->height(), false)); |
|
kaanb
2013/05/23 16:56:11
Any reason we don't want to support it for Capture
joth
2013/05/23 20:23:14
(this whole file is being deleted soon, but for th
| |
| 424 if (!jbitmap.obj()) | 424 if (!jbitmap.obj()) |
| 425 return ScopedJavaLocalRef<jobject>(); | 425 return ScopedJavaLocalRef<jobject>(); |
| 426 | 426 |
| 427 if (!RasterizeIntoBitmap(env, jbitmap, 0, 0, | 427 if (!RasterizeIntoBitmap(env, jbitmap, 0, 0, |
| 428 base::Bind(&RenderPictureToCanvas, | 428 base::Bind(&RenderPictureToCanvas, |
| 429 base::Unretained(picture.get())))) { | 429 base::Unretained(picture.get())))) { |
| 430 return ScopedJavaLocalRef<jobject>(); | 430 return ScopedJavaLocalRef<jobject>(); |
| 431 } | 431 } |
| 432 | 432 |
| 433 return java_helper_->RecordBitmapIntoPicture(env, jbitmap); | 433 return java_helper_->RecordBitmapIntoPicture(env, jbitmap); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 561 | 561 |
| 562 void BrowserViewRendererImpl::OnFrameInfoUpdated( | 562 void BrowserViewRendererImpl::OnFrameInfoUpdated( |
| 563 const gfx::SizeF& content_size, | 563 const gfx::SizeF& content_size, |
| 564 const gfx::Vector2dF& scroll_offset, | 564 const gfx::Vector2dF& scroll_offset, |
| 565 float page_scale_factor) { | 565 float page_scale_factor) { |
| 566 page_scale_ = page_scale_factor; | 566 page_scale_ = page_scale_factor; |
| 567 content_size_css_ = content_size; | 567 content_size_css_ = content_size; |
| 568 } | 568 } |
| 569 | 569 |
| 570 } // namespace android_webview | 570 } // namespace android_webview |
| OLD | NEW |