OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/output/gl_renderer.h" | 5 #include "cc/output/gl_renderer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1732 DrawQuadGeometry(frame, | 1732 DrawQuadGeometry(frame, |
1733 quad->quadTransform(), | 1733 quad->quadTransform(), |
1734 quad->rect, | 1734 quad->rect, |
1735 program->vertex_shader().matrix_location()); | 1735 program->vertex_shader().matrix_location()); |
1736 } | 1736 } |
1737 | 1737 |
1738 void GLRenderer::DrawPictureQuad(const DrawingFrame* frame, | 1738 void GLRenderer::DrawPictureQuad(const DrawingFrame* frame, |
1739 const PictureDrawQuad* quad) { | 1739 const PictureDrawQuad* quad) { |
1740 if (on_demand_tile_raster_bitmap_.width() != quad->texture_size.width() || | 1740 if (on_demand_tile_raster_bitmap_.width() != quad->texture_size.width() || |
1741 on_demand_tile_raster_bitmap_.height() != quad->texture_size.height()) { | 1741 on_demand_tile_raster_bitmap_.height() != quad->texture_size.height()) { |
1742 on_demand_tile_raster_bitmap_.setConfig(SkBitmap::kARGB_8888_Config, | 1742 on_demand_tile_raster_bitmap_.allocN32Pixels(quad->texture_size.width(), |
1743 quad->texture_size.width(), | 1743 quad->texture_size.height()); |
1744 quad->texture_size.height()); | |
1745 on_demand_tile_raster_bitmap_.allocPixels(); | |
1746 | 1744 |
1747 if (on_demand_tile_raster_resource_id_) | 1745 if (on_demand_tile_raster_resource_id_) |
1748 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_); | 1746 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_); |
1749 | 1747 |
1750 on_demand_tile_raster_resource_id_ = | 1748 on_demand_tile_raster_resource_id_ = |
1751 resource_provider_->CreateGLTexture(quad->texture_size, | 1749 resource_provider_->CreateGLTexture(quad->texture_size, |
1752 GL_TEXTURE_2D, | 1750 GL_TEXTURE_2D, |
1753 GL_TEXTURE_POOL_UNMANAGED_CHROMIUM, | 1751 GL_TEXTURE_POOL_UNMANAGED_CHROMIUM, |
1754 GL_CLAMP_TO_EDGE, | 1752 GL_CLAMP_TO_EDGE, |
1755 ResourceProvider::TextureUsageAny, | 1753 ResourceProvider::TextureUsageAny, |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2291 } | 2289 } |
2292 | 2290 |
2293 request->SendTextureResult( | 2291 request->SendTextureResult( |
2294 window_rect.size(), texture_mailbox, release_callback.Pass()); | 2292 window_rect.size(), texture_mailbox, release_callback.Pass()); |
2295 return; | 2293 return; |
2296 } | 2294 } |
2297 | 2295 |
2298 DCHECK(request->force_bitmap_result()); | 2296 DCHECK(request->force_bitmap_result()); |
2299 | 2297 |
2300 scoped_ptr<SkBitmap> bitmap(new SkBitmap); | 2298 scoped_ptr<SkBitmap> bitmap(new SkBitmap); |
2301 bitmap->setConfig( | 2299 bitmap->allocN32Pixels(window_rect.width(), window_rect.height()); |
2302 SkBitmap::kARGB_8888_Config, window_rect.width(), window_rect.height()); | |
2303 bitmap->allocPixels(); | |
2304 | 2300 |
2305 scoped_ptr<SkAutoLockPixels> lock(new SkAutoLockPixels(*bitmap)); | 2301 scoped_ptr<SkAutoLockPixels> lock(new SkAutoLockPixels(*bitmap)); |
2306 | 2302 |
2307 // Save a pointer to the pixels, the bitmap is owned by the cleanup_callback. | 2303 // Save a pointer to the pixels, the bitmap is owned by the cleanup_callback. |
2308 uint8* pixels = static_cast<uint8*>(bitmap->getPixels()); | 2304 uint8* pixels = static_cast<uint8*>(bitmap->getPixels()); |
2309 | 2305 |
2310 AsyncGetFramebufferPixelsCleanupCallback cleanup_callback = | 2306 AsyncGetFramebufferPixelsCleanupCallback cleanup_callback = |
2311 base::Bind(&GLRenderer::PassOnSkBitmap, | 2307 base::Bind(&GLRenderer::PassOnSkBitmap, |
2312 base::Unretained(this), | 2308 base::Unretained(this), |
2313 base::Passed(&bitmap), | 2309 base::Passed(&bitmap), |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3041 is_scissor_enabled_ = false; | 3037 is_scissor_enabled_ = false; |
3042 GLC(gl_, gl_->Disable(GL_SCISSOR_TEST)); | 3038 GLC(gl_, gl_->Disable(GL_SCISSOR_TEST)); |
3043 scissor_rect_needs_reset_ = true; | 3039 scissor_rect_needs_reset_ = true; |
3044 } | 3040 } |
3045 | 3041 |
3046 bool GLRenderer::IsContextLost() { | 3042 bool GLRenderer::IsContextLost() { |
3047 return output_surface_->context_provider()->IsContextLost(); | 3043 return output_surface_->context_provider()->IsContextLost(); |
3048 } | 3044 } |
3049 | 3045 |
3050 } // namespace cc | 3046 } // namespace cc |
OLD | NEW |