Index: cc/trees/layer_tree_host.cc |
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc |
index 27659e054bea869e8bcc1940036e2f5d82fead9b..3d193f7560ce5bc8e242cb3555871bc6c2b1a321 100644 |
--- a/cc/trees/layer_tree_host.cc |
+++ b/cc/trees/layer_tree_host.cc |
@@ -142,6 +142,9 @@ bool LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) { |
LayerTreeHost::~LayerTreeHost() { |
TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); |
+ |
+ overhang_ui_resource_.reset(); |
+ |
if (root_layer_.get()) |
root_layer_->SetLayerTreeHost(NULL); |
@@ -369,6 +372,11 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) { |
if (!settings_.impl_side_painting) |
sync_tree->ProcessUIResourceRequestQueue(); |
} |
+ if (overhang_ui_resource_) { |
+ host_impl->SetOverhangUIResource( |
+ overhang_ui_resource_->id(), |
+ overhang_ui_resource_->GetSize()); |
+ } |
DCHECK(!sync_tree->ViewportSizeInvalid()); |
@@ -623,6 +631,21 @@ void LayerTreeHost::SetPageScaleFactorAndLimits(float page_scale_factor, |
SetNeedsCommit(); |
} |
+void LayerTreeHost::SetOverhangBitmap(const SkBitmap& bitmap) { |
+ DCHECK(bitmap.width() && bitmap.height()); |
+ DCHECK_EQ(bitmap.bytesPerPixel(), 4); |
+ |
+ scoped_refptr<UIResourceBitmap> overhang_ui_bitmap(UIResourceBitmap::Create( |
+ new uint8_t[bitmap.width() * bitmap.height() * bitmap.bytesPerPixel()], |
+ UIResourceBitmap::RGBA8, |
+ gfx::Size(bitmap.width(), bitmap.height()))); |
+ bitmap.copyPixelsTo( |
+ overhang_ui_bitmap->GetPixels(), |
+ bitmap.width() * bitmap.height() * bitmap.bytesPerPixel(), |
+ bitmap.width() * bitmap.bytesPerPixel()); |
+ overhang_ui_resource_ = ScopedUIResource::Create(this, overhang_ui_bitmap); |
+} |
+ |
void LayerTreeHost::SetVisible(bool visible) { |
if (visible_ == visible) |
return; |