Index: cc/trees/layer_tree_host.cc |
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc |
index 9956f4c7359887d8c3fa44f720f6c7177abf780d..b600d0ec8592417f396188a61f4770c07f3a6988 100644 |
--- a/cc/trees/layer_tree_host.cc |
+++ b/cc/trees/layer_tree_host.cc |
@@ -38,6 +38,7 @@ |
#include "cc/trees/single_thread_proxy.h" |
#include "cc/trees/thread_proxy.h" |
#include "cc/trees/tree_synchronizer.h" |
+#include "ui/base/resource/resource_bundle.h" |
#include "ui/gfx/size_conversions.h" |
namespace { |
@@ -196,6 +197,29 @@ LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted(bool success) { |
contents_texture_manager_->CreateTexture(gfx::Size(), GL_RGBA); |
} |
+ // Okay, this should be done in a more principled way... |
+ if (1) { |
+ // So this is supposed to come from a header file (but only on platforms |
+ // that have an overhang...). |
+ int IDR_IDR_OVERHANG_PATTERN = 4740; |
+ // And this can't be called in unit tests... |
+ const gfx::Image& overhang_image = |
+ ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
+ IDR_IDR_OVERHANG_PATTERN); |
+ overhang_bitmap_ = UIResourceBitmap::Create( |
+ new uint8_t[overhang_image.Size().width() * |
+ overhang_image.Size().height() * 4], |
+ UIResourceBitmap::RGBA8, |
+ UIResourceBitmap::Repeat, |
+ overhang_image.Size()); |
+ overhang_image.CopySkBitmap()->copyPixelsTo( |
+ overhang_bitmap_->GetPixels(), |
+ overhang_image.Size().width() * overhang_image.Size().height() * 4, |
+ overhang_image.Size().width() * 4, |
+ false); |
+ overhang_ui_resource_ = ScopedUIResource::Create(this, overhang_bitmap_); |
+ } |
+ |
client_->DidInitializeOutputSurface(true); |
return CreateSucceeded; |
} |
@@ -369,6 +393,10 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) { |
if (!settings_.impl_side_painting) |
sync_tree->ProcessUIResourceRequestQueue(); |
} |
+ if (overhang_ui_resource_ && overhang_bitmap_) { |
+ host_impl->SetOverhangUIResource( |
+ overhang_ui_resource_->id(), overhang_bitmap_->GetSize()); |
+ } |
DCHECK(!sync_tree->ViewportSizeInvalid()); |