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

Unified Diff: cc/output/gl_renderer.cc

Issue 21159007: cc: Adding support for RGBA_4444 tile textures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: deprecate GLenum format throughout cc Created 7 years, 3 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/output/gl_renderer.cc
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index 3d6607c18fa19c8573752f1b58f0317c3884ce01..d2d01e0366cbd3e55b318196fef420301fdbe8c7 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -662,8 +662,8 @@ scoped_ptr<ScopedResource> GLRenderer::DrawBackgroundFilters(
scoped_ptr<ScopedResource> device_background_texture =
ScopedResource::create(resource_provider_);
if (!device_background_texture->Allocate(window_rect.size(),
- GL_RGB,
- ResourceProvider::TextureUsageAny)) {
+ ResourceProvider::TextureUsageAny,
+ ResourceProvider::RGBA_8888)) {
return scoped_ptr<ScopedResource>();
} else {
ResourceProvider::ScopedWriteLockGL lock(resource_provider_,
@@ -688,8 +688,8 @@ scoped_ptr<ScopedResource> GLRenderer::DrawBackgroundFilters(
scoped_ptr<ScopedResource> background_texture =
ScopedResource::create(resource_provider_);
if (!background_texture->Allocate(quad->rect.size(),
- GL_RGBA,
- ResourceProvider::TextureUsageFramebuffer))
+ ResourceProvider::TextureUsageFramebuffer,
+ ResourceProvider::RGBA_8888))
return scoped_ptr<ScopedResource>();
const RenderPass* target_render_pass = frame->current_render_pass;
@@ -1711,10 +1711,11 @@ void GLRenderer::DrawPictureQuad(const DrawingFrame* frame,
on_demand_tile_raster_resource_id_ = resource_provider_->CreateGLTexture(
quad->texture_size,
- GL_RGBA,
GL_TEXTURE_POOL_UNMANAGED_CHROMIUM,
GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny);
+ ResourceProvider::TextureUsageAny,
+ settings_->use_rgba_4444_textures
+ ? ResourceProvider::RGBA_4444 : ResourceProvider::RGBA_8888);
}
SkBitmapDevice device(on_demand_tile_raster_bitmap_);
@@ -1723,9 +1724,22 @@ void GLRenderer::DrawPictureQuad(const DrawingFrame* frame,
quad->picture_pile->RasterToBitmap(&canvas, quad->content_rect,
quad->contents_scale, NULL);
+ const uint8_t* bitmap_pixels = NULL;
+ if (settings_->use_rgba_4444_textures) {
+ on_demand_tile_raster_bitmap_.copyTo(
+ &on_demand_tile_raster_bitmap_4444_, SkBitmap::kARGB_4444_Config);
+ bitmap_pixels = reinterpret_cast<uint8_t*>(
+ on_demand_tile_raster_bitmap_4444_.getPixels());
+ } else {
+ bitmap_pixels = reinterpret_cast<uint8_t*>(
+ on_demand_tile_raster_bitmap_.getPixels());
+ }
+
+ LOG(ERROR) << "KAANB: on demand raster!!!!!!!!!!!!!!!!!!!!";
+
resource_provider_->SetPixels(
on_demand_tile_raster_resource_id_,
- reinterpret_cast<uint8_t*>(on_demand_tile_raster_bitmap_.getPixels()),
+ bitmap_pixels,
gfx::Rect(quad->texture_size),
gfx::Rect(quad->texture_size),
gfx::Vector2d());
@@ -2214,7 +2228,7 @@ void GLRenderer::GetFramebufferPixelsAsync(
GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
GLC(context_, context_->texParameteri(
GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
- GetFramebufferTexture(texture_id, GL_RGBA, window_rect);
+ GetFramebufferTexture(texture_id, ResourceProvider::RGBA_8888, window_rect);
gpu::Mailbox mailbox;
unsigned sync_point = 0;
@@ -2306,7 +2320,7 @@ void GLRenderer::DoGetFramebufferPixels(
// Copy the contents of the current (IOSurface-backed) framebuffer into a
// temporary texture.
GetFramebufferTexture(temporary_texture,
- GL_RGBA,
+ ResourceProvider::RGBA_8888,
gfx::Rect(current_surface_size_));
temporary_fbo = context_->createFramebuffer();
// Attach this texture to an FBO, and perform the readback from that FBO.
@@ -2456,9 +2470,10 @@ void GLRenderer::PassOnSkBitmap(
request->SendBitmapResult(bitmap.Pass());
}
-void GLRenderer::GetFramebufferTexture(unsigned texture_id,
- unsigned texture_format,
- gfx::Rect window_rect) {
+void GLRenderer::GetFramebufferTexture(
+ unsigned texture_id,
+ ResourceProvider::TextureFormat texture_format,
+ gfx::Rect window_rect) {
DCHECK(texture_id);
DCHECK_GE(window_rect.x(), 0);
DCHECK_GE(window_rect.y(), 0);
@@ -2467,14 +2482,15 @@ void GLRenderer::GetFramebufferTexture(unsigned texture_id,
GLC(context_, context_->bindTexture(GL_TEXTURE_2D, texture_id));
GLC(context_,
- context_->copyTexImage2D(GL_TEXTURE_2D,
- 0,
- texture_format,
- window_rect.x(),
- window_rect.y(),
- window_rect.width(),
- window_rect.height(),
- 0));
+ context_->copyTexImage2D(
+ GL_TEXTURE_2D,
+ 0,
+ ResourceProvider::GetGLDataFormat(texture_format),
+ window_rect.x(),
+ window_rect.y(),
+ window_rect.width(),
+ window_rect.height(),
+ 0));
GLC(context_, context_->bindTexture(GL_TEXTURE_2D, 0));
}

Powered by Google App Engine
This is Rietveld 408576698