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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 22529002: [cc] Allow resources and ui resources to specify wrap mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo and add asserts 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
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 eac6068e6be16379a0ec90e8ddda504d9488ac6a..b8801d82c4374b85f26f3ae0ef22ce0f232f9c91 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -50,6 +50,7 @@
#include "cc/trees/quad_culler.h"
#include "cc/trees/single_thread_proxy.h"
#include "cc/trees/tree_synchronizer.h"
+#include "gpu/GLES2/gl2extchromium.h"
#include "ui/gfx/size_conversions.h"
#include "ui/gfx/vector2d_conversions.h"
@@ -2472,14 +2473,29 @@ void LayerTreeHostImpl::CreateUIResource(
DCHECK_GT(uid, 0);
DCHECK_EQ(bitmap->GetFormat(), UIResourceBitmap::RGBA8);
+ GLint wrap_mode = 0;
+ switch (bitmap->GetWrapMode()) {
+ case UIResourceBitmap::ClampToEdge:
+ wrap_mode = GL_CLAMP_TO_EDGE;
+ break;
+ case UIResourceBitmap::Repeat:
+ wrap_mode = GL_REPEAT;
+ break;
+ default:
+ NOTREACHED();
+ break;
+ }
+
// Allow for multiple creation requests with the same UIResourceId. The
// previous resource is simply deleted.
ResourceProvider::ResourceId id = ResourceIdForUIResource(uid);
if (id)
DeleteUIResource(uid);
- id = resource_provider_->CreateResource(
- bitmap->GetSize(), GL_RGBA, ResourceProvider::TextureUsageAny);
-
+ id = resource_provider_->CreateGLTexture(bitmap->GetSize(),
+ GL_RGBA,
+ GL_TEXTURE_POOL_UNMANAGED_CHROMIUM,
+ wrap_mode,
+ ResourceProvider::TextureUsageAny);
ui_resource_map_[uid] = id;
resource_provider_->SetPixels(id,
reinterpret_cast<uint8_t*>(bitmap->GetPixels()),

Powered by Google App Engine
This is Rietveld 408576698