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/browser/in_process_view_renderer.h" | 5 #include "android_webview/browser/in_process_view_renderer.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include "android_webview/browser/aw_gl_surface.h" | 9 #include "android_webview/browser/aw_gl_surface.h" |
10 #include "android_webview/browser/scoped_app_gl_state_restore.h" | 10 #include "android_webview/browser/scoped_app_gl_state_restore.h" |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 transform.Translate(scroll_at_start_of_frame_.x(), | 380 transform.Translate(scroll_at_start_of_frame_.x(), |
381 scroll_at_start_of_frame_.y()); | 381 scroll_at_start_of_frame_.y()); |
382 gfx::Rect clip_rect(draw_info->clip_left, | 382 gfx::Rect clip_rect(draw_info->clip_left, |
383 draw_info->clip_top, | 383 draw_info->clip_top, |
384 draw_info->clip_right - draw_info->clip_left, | 384 draw_info->clip_right - draw_info->clip_left, |
385 draw_info->clip_bottom - draw_info->clip_top); | 385 draw_info->clip_bottom - draw_info->clip_top); |
386 | 386 |
387 // Assume we always draw the full visible rect if we are drawing into a layer. | 387 // Assume we always draw the full visible rect if we are drawing into a layer. |
388 bool drew_full_visible_rect = true; | 388 bool drew_full_visible_rect = true; |
389 | 389 |
| 390 gfx::Rect viewport_rect; |
390 if (!draw_info->is_layer) { | 391 if (!draw_info->is_layer) { |
391 clip_rect.Intersect(cached_global_visible_rect_); | 392 viewport_rect = cached_global_visible_rect_; |
392 drew_full_visible_rect = clip_rect.Contains(cached_global_visible_rect_); | 393 clip_rect.Intersect(viewport_rect); |
| 394 drew_full_visible_rect = clip_rect.Contains(viewport_rect); |
| 395 } else { |
| 396 viewport_rect = clip_rect; |
393 } | 397 } |
394 | 398 |
395 block_invalidates_ = true; | 399 block_invalidates_ = true; |
396 // TODO(joth): Check return value. | 400 // TODO(joth): Check return value. |
397 compositor_->DemandDrawHw(gfx::Size(draw_info->width, draw_info->height), | 401 compositor_->DemandDrawHw(gfx::Size(draw_info->width, draw_info->height), |
398 transform, | 402 transform, |
| 403 viewport_rect, |
399 clip_rect, | 404 clip_rect, |
400 state_restore.stencil_enabled()); | 405 state_restore.stencil_enabled()); |
401 block_invalidates_ = false; | 406 block_invalidates_ = false; |
402 gl_surface_->ResetBackingFrameBufferObject(); | 407 gl_surface_->ResetBackingFrameBufferObject(); |
403 | 408 |
404 EnsureContinuousInvalidation(draw_info, !drew_full_visible_rect); | 409 EnsureContinuousInvalidation(draw_info, !drew_full_visible_rect); |
405 } | 410 } |
406 | 411 |
407 void InProcessViewRenderer::SetGlobalVisibleRect( | 412 void InProcessViewRenderer::SetGlobalVisibleRect( |
408 const gfx::Rect& visible_rect) { | 413 const gfx::Rect& visible_rect) { |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 base::StringAppendF(&str, | 857 base::StringAppendF(&str, |
853 "surface width height: [%d %d] ", | 858 "surface width height: [%d %d] ", |
854 draw_info->width, | 859 draw_info->width, |
855 draw_info->height); | 860 draw_info->height); |
856 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); | 861 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); |
857 } | 862 } |
858 return str; | 863 return str; |
859 } | 864 } |
860 | 865 |
861 } // namespace android_webview | 866 } // namespace android_webview |
OLD | NEW |