Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2633)

Unified Diff: cc/trees/layer_tree_host.cc

Issue 22313011: (not for review) Add overhang resource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add_wrap_mode
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698