Index: cc/trees/layer_tree_host_impl.cc |
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc |
index b8801d82c4374b85f26f3ae0ef22ce0f232f9c91..7c8135d0304d5c31fabb52c69711d7c719d3a508 100644 |
--- a/cc/trees/layer_tree_host_impl.cc |
+++ b/cc/trees/layer_tree_host_impl.cc |
@@ -37,6 +37,7 @@ |
#include "cc/quads/render_pass_draw_quad.h" |
#include "cc/quads/shared_quad_state.h" |
#include "cc/quads/solid_color_draw_quad.h" |
+#include "cc/quads/texture_draw_quad.h" |
#include "cc/resources/memory_history.h" |
#include "cc/resources/picture_layer_tiling.h" |
#include "cc/resources/prioritized_resource_manager.h" |
@@ -197,6 +198,8 @@ LayerTreeHostImpl::LayerTreeHostImpl( |
zero_budget_(false), |
device_scale_factor_(1.f), |
overdraw_bottom_height_(0.f), |
+ overhang_ui_resource_id_(0), |
+ overhang_image_size_(0, 0), |
external_stencil_test_enabled_(false), |
animation_registrar_(AnimationRegistrar::Create()), |
rendering_stats_instrumentation_(rendering_stats_instrumentation), |
@@ -503,7 +506,9 @@ static void AppendQuadsToFillScreen( |
RenderPass* target_render_pass, |
LayerImpl* root_layer, |
SkColor screen_background_color, |
- const OcclusionTrackerImpl& occlusion_tracker) { |
+ const OcclusionTrackerImpl& occlusion_tracker, |
+ ResourceProvider::ResourceId overhang_resource_id, |
+ gfx::Size overhang_image_size) { |
if (!root_layer || !SkColorGetA(screen_background_color)) |
return; |
@@ -550,9 +555,35 @@ static void AppendQuadsToFillScreen( |
MathUtil::MapClippedRect(transform_to_layer_space, fill_rects.rect()); |
// Skip the quad culler and just append the quads directly to avoid |
// occlusion checks. |
- scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); |
- quad->SetNew(shared_quad_state, layer_rect, screen_background_color, false); |
- quad_culler.Append(quad.PassAs<DrawQuad>(), &append_quads_data); |
+ if (overhang_resource_id) { |
+ scoped_ptr<TextureDrawQuad> tex_quad = TextureDrawQuad::Create(); |
+ const float vertex_opacity[4] = {1.f, 1.f, 1.f, 1.f}; |
+ tex_quad->SetNew( |
+ shared_quad_state, |
+ layer_rect, |
+ layer_rect, |
+ overhang_resource_id, |
+ false, |
+ gfx::PointF( |
+ layer_rect.x() / |
+ static_cast<float>(overhang_image_size.width()), |
+ layer_rect.y() / |
+ static_cast<float>(overhang_image_size.height())), |
+ gfx::PointF( |
+ (layer_rect.x() + layer_rect.width()) / |
+ static_cast<float>(overhang_image_size.width()), |
+ (layer_rect.y() + layer_rect.height()) / |
+ static_cast<float>(overhang_image_size.height())), |
+ screen_background_color, |
+ vertex_opacity, |
+ false); |
+ quad_culler.Append(tex_quad.PassAs<DrawQuad>(), &append_quads_data); |
+ } else { |
+ scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); |
+ quad->SetNew( |
+ shared_quad_state, layer_rect, screen_background_color, false); |
+ quad_culler.Append(quad.PassAs<DrawQuad>(), &append_quads_data); |
+ } |
} |
} |
@@ -767,7 +798,9 @@ bool LayerTreeHostImpl::CalculateRenderPasses(FrameData* frame) { |
AppendQuadsToFillScreen(frame->render_passes.back(), |
active_tree_->root_layer(), |
active_tree_->background_color(), |
- occlusion_tracker); |
+ occlusion_tracker, |
+ ResourceIdForUIResource(overhang_ui_resource_id_), |
+ overhang_image_size_); |
} |
if (draw_frame) |
@@ -1738,6 +1771,12 @@ void LayerTreeHostImpl::SetOverdrawBottomHeight(float overdraw_bottom_height) { |
SetFullRootLayerDamage(); |
} |
+void LayerTreeHostImpl::SetOverhangUIResource( |
+ UIResourceId overhang_ui_resource_id, gfx::Size overhang_image_size) { |
+ overhang_ui_resource_id_ = overhang_ui_resource_id; |
+ overhang_image_size_ = overhang_image_size; |
+} |
+ |
void LayerTreeHostImpl::SetDeviceScaleFactor(float device_scale_factor) { |
if (device_scale_factor == device_scale_factor_) |
return; |