Chromium Code Reviews| Index: cc/output/gl_renderer.cc |
| diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc |
| index 3d6607c18fa19c8573752f1b58f0317c3884ce01..eb30d4e6eea652f06fd04469f168ae5cacc1f205 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, |
| + 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, |
| + RGBA_8888)) |
| return scoped_ptr<ScopedResource>(); |
| const RenderPass* target_render_pass = frame->current_render_pass; |
| @@ -1711,10 +1711,10 @@ 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 ? RGBA_4444 : RGBA_8888); |
|
reveman
2013/09/14 00:58:39
I think this should be using resource_provider->be
kaanb
2013/09/16 07:22:25
Yes, since previously GL_RGBA was hardcoded, raste
|
| } |
| SkBitmapDevice device(on_demand_tile_raster_bitmap_); |
| @@ -1723,9 +1723,20 @@ 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) { |
|
reveman
2013/09/14 00:58:39
I think this code should be similar to PBRWP code
kaanb
2013/09/16 07:22:25
Done.
|
| + 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()); |
|
reveman
2013/09/14 00:58:39
does caching on_demand_tile_raster_bitmap_4444_ re
kaanb
2013/09/16 07:22:25
Done.
|
| + } else { |
| + bitmap_pixels = reinterpret_cast<uint8_t*>( |
| + on_demand_tile_raster_bitmap_.getPixels()); |
| + } |
| + |
| 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 +2225,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, RGBA_8888, window_rect); |
| gpu::Mailbox mailbox; |
| unsigned sync_point = 0; |
| @@ -2306,7 +2317,7 @@ void GLRenderer::DoGetFramebufferPixels( |
| // Copy the contents of the current (IOSurface-backed) framebuffer into a |
| // temporary texture. |
| GetFramebufferTexture(temporary_texture, |
| - GL_RGBA, |
| + 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 +2467,8 @@ 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, ResourceFormat texture_format, gfx::Rect window_rect) { |
| DCHECK(texture_id); |
| DCHECK_GE(window_rect.x(), 0); |
| DCHECK_GE(window_rect.y(), 0); |
| @@ -2467,14 +2477,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)); |
| } |