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

Unified Diff: cc/resources/resource_provider.cc

Issue 1415583004: cc: Remove references to managed resources (and cleanup) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: protected -> private Created 5 years, 2 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/resources/resource_provider.h ('k') | cc/resources/resource_provider_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/resource_provider.cc
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc
index 15c4dee459fc207444321184f25a0809f50ae0b5..8f8490b839b4a1bc5b8843629055ef9247620222 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -399,10 +399,11 @@ ResourceId ResourceProvider::CreateResource(const gfx::Size& size,
return 0;
}
-ResourceId ResourceProvider::CreateManagedResource(const gfx::Size& size,
- GLenum target,
- TextureHint hint,
- ResourceFormat format) {
+ResourceId ResourceProvider::CreateResourceWithTextureTarget(
+ const gfx::Size& size,
+ GLenum target,
+ TextureHint hint,
+ ResourceFormat format) {
DCHECK(!size.IsEmpty());
switch (default_resource_type_) {
case RESOURCE_TYPE_GL_TEXTURE:
@@ -623,7 +624,6 @@ void ResourceProvider::CopyToResource(ResourceId id,
DCHECK(resource->origin == Resource::INTERNAL);
DCHECK_EQ(resource->exported_count, 0);
DCHECK(ReadLockFenceHasPassed(resource));
- LazyAllocate(resource);
DCHECK_EQ(image_size.width(), resource->size.width());
DCHECK_EQ(image_size.height(), resource->size.height());
@@ -640,19 +640,19 @@ void ResourceProvider::CopyToResource(ResourceId id,
SkCanvas dest(lock.sk_bitmap());
dest.writePixels(source_info, image, image_stride, 0, 0);
} else {
- DCHECK(resource->gl_id);
- DCHECK_EQ(resource->target, static_cast<GLenum>(GL_TEXTURE_2D));
+ ScopedWriteLockGL lock(this, id);
+ DCHECK(lock.texture_id());
GLES2Interface* gl = ContextGL();
DCHECK(gl);
- gl->BindTexture(GL_TEXTURE_2D, resource->gl_id);
-
+ gl->BindTexture(resource->target, lock.texture_id());
if (resource->format == ETC1) {
+ DCHECK_EQ(resource->target, static_cast<GLenum>(GL_TEXTURE_2D));
int image_bytes = ResourceUtil::CheckedSizeInBytes<int>(image_size, ETC1);
- gl->CompressedTexImage2D(GL_TEXTURE_2D, 0, GLInternalFormat(ETC1),
+ gl->CompressedTexImage2D(resource->target, 0, GLInternalFormat(ETC1),
image_size.width(), image_size.height(), 0,
image_bytes, image);
} else {
- gl->TexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, image_size.width(),
+ gl->TexSubImage2D(resource->target, 0, 0, 0, image_size.width(),
image_size.height(), GLDataFormat(resource->format),
GLDataType(resource->format), image);
}
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/resources/resource_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698