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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 is_backbuffer_discarded_(false), | 155 is_backbuffer_discarded_(false), |
156 discard_backbuffer_when_not_visible_(false), | 156 discard_backbuffer_when_not_visible_(false), |
157 is_using_bind_uniform_(false), | 157 is_using_bind_uniform_(false), |
158 visible_(true), | 158 visible_(true), |
159 is_scissor_enabled_(false), | 159 is_scissor_enabled_(false), |
160 stencil_shadow_(false), | 160 stencil_shadow_(false), |
161 blend_shadow_(false), | 161 blend_shadow_(false), |
162 highp_threshold_min_(highp_threshold_min), | 162 highp_threshold_min_(highp_threshold_min), |
163 highp_threshold_cache_(0), | 163 highp_threshold_cache_(0), |
164 offscreen_context_labelled_(false), | 164 offscreen_context_labelled_(false), |
165 on_demand_tile_raster_resource_id_(0) { | 165 on_demand_tile_raster_resource_id_(0), |
166 use_16_bit_resources_(resource_provider->use_16bit_textures()) { | |
166 DCHECK(context_); | 167 DCHECK(context_); |
167 } | 168 } |
168 | 169 |
169 bool GLRenderer::Initialize() { | 170 bool GLRenderer::Initialize() { |
170 if (!context_->makeContextCurrent()) | 171 if (!context_->makeContextCurrent()) |
171 return false; | 172 return false; |
172 | 173 |
173 std::string unique_context_name = base::StringPrintf( | 174 std::string unique_context_name = base::StringPrintf( |
174 "%s-%p", | 175 "%s-%p", |
175 Settings().compositor_name.c_str(), | 176 Settings().compositor_name.c_str(), |
(...skipping 1521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1697 GL_TEXTURE_POOL_UNMANAGED_CHROMIUM, | 1698 GL_TEXTURE_POOL_UNMANAGED_CHROMIUM, |
1698 ResourceProvider::TextureUsageAny); | 1699 ResourceProvider::TextureUsageAny); |
1699 } | 1700 } |
1700 | 1701 |
1701 SkBitmapDevice device(on_demand_tile_raster_bitmap_); | 1702 SkBitmapDevice device(on_demand_tile_raster_bitmap_); |
1702 SkCanvas canvas(&device); | 1703 SkCanvas canvas(&device); |
1703 | 1704 |
1704 quad->picture_pile->RasterToBitmap(&canvas, quad->content_rect, | 1705 quad->picture_pile->RasterToBitmap(&canvas, quad->content_rect, |
1705 quad->contents_scale, NULL); | 1706 quad->contents_scale, NULL); |
1706 | 1707 |
1708 uint8_t* bitmap_pixels = NULL; | |
Sami
2013/09/05 14:13:26
Nit: const uint8_t*
kaanb
2013/09/06 02:05:54
Done.
| |
1709 if (use_16_bit_resources_) { | |
1710 SkBitmap bitmap_16; | |
enne (OOO)
2013/09/05 02:01:19
This should probably be a member along with on_dem
Sami
2013/09/05 14:13:26
Furthermore, since bitmap_16 is on the stack, bitm
kaanb
2013/09/06 02:05:54
Done.
kaanb
2013/09/06 02:05:54
Great point. The overscroll glow is fixed now.
| |
1711 on_demand_tile_raster_bitmap_.copyTo( | |
1712 &bitmap_16, SkBitmap::kARGB_4444_Config); | |
1713 bitmap_pixels = reinterpret_cast<uint8_t*>(bitmap_16.getPixels()); | |
1714 } else { | |
1715 bitmap_pixels = reinterpret_cast<uint8_t*>( | |
1716 on_demand_tile_raster_bitmap_.getPixels()); | |
1717 } | |
1718 | |
1707 resource_provider_->SetPixels( | 1719 resource_provider_->SetPixels( |
1708 on_demand_tile_raster_resource_id_, | 1720 on_demand_tile_raster_resource_id_, |
1709 reinterpret_cast<uint8_t*>(on_demand_tile_raster_bitmap_.getPixels()), | 1721 bitmap_pixels, |
1710 gfx::Rect(quad->texture_size), | 1722 gfx::Rect(quad->texture_size), |
1711 gfx::Rect(quad->texture_size), | 1723 gfx::Rect(quad->texture_size), |
1712 gfx::Vector2d()); | 1724 gfx::Vector2d()); |
1713 | 1725 |
1714 DrawContentQuad(frame, quad, on_demand_tile_raster_resource_id_); | 1726 DrawContentQuad(frame, quad, on_demand_tile_raster_resource_id_); |
1715 } | 1727 } |
1716 | 1728 |
1717 struct TextureProgramBinding { | 1729 struct TextureProgramBinding { |
1718 template <class Program> | 1730 template <class Program> |
1719 void Set(Program* program, WebKit::WebGraphicsContext3D* context) { | 1731 void Set(Program* program, WebKit::WebGraphicsContext3D* context) { |
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3150 std::string unique_context_name = base::StringPrintf( | 3162 std::string unique_context_name = base::StringPrintf( |
3151 "%s-Offscreen-%p", | 3163 "%s-Offscreen-%p", |
3152 Settings().compositor_name.c_str(), | 3164 Settings().compositor_name.c_str(), |
3153 context_); | 3165 context_); |
3154 offscreen_context_provider->Context3d()->pushGroupMarkerEXT( | 3166 offscreen_context_provider->Context3d()->pushGroupMarkerEXT( |
3155 unique_context_name.c_str()); | 3167 unique_context_name.c_str()); |
3156 } | 3168 } |
3157 | 3169 |
3158 | 3170 |
3159 } // namespace cc | 3171 } // namespace cc |
OLD | NEW |