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 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
892 | 892 |
893 int top, right, bottom, left; | 893 int top, right, bottom, left; |
894 quad->background_filters.GetOutsets(&top, &right, &bottom, &left); | 894 quad->background_filters.GetOutsets(&top, &right, &bottom, &left); |
895 window_rect.Inset(-left, -top, -right, -bottom); | 895 window_rect.Inset(-left, -top, -right, -bottom); |
896 | 896 |
897 window_rect.Intersect( | 897 window_rect.Intersect( |
898 MoveFromDrawToWindowSpace(frame->current_render_pass->output_rect)); | 898 MoveFromDrawToWindowSpace(frame->current_render_pass->output_rect)); |
899 | 899 |
900 scoped_ptr<ScopedResource> device_background_texture = | 900 scoped_ptr<ScopedResource> device_background_texture = |
901 ScopedResource::Create(resource_provider_); | 901 ScopedResource::Create(resource_provider_); |
902 // The TextureUsageFramebuffer hint makes ResourceProvider avoid immutable | 902 // CopyTexImage2D fails when called on a texture having immutable storage. |
903 // storage allocation (texStorage2DEXT) for this texture. copyTexImage2D fails | |
904 // when called on a texture having immutable storage. | |
905 device_background_texture->Allocate( | 903 device_background_texture->Allocate( |
906 window_rect.size(), ResourceProvider::TextureUsageFramebuffer, RGBA_8888); | 904 window_rect.size(), ResourceProvider::TextureHintDefault, RGBA_8888); |
dshwang
2014/08/18 19:28:08
Here is only one logic change. Other changes are j
danakj
2014/08/20 14:46:17
Why not just use TextureUsageAny here, why do we n
dshwang
2014/08/20 15:08:35
That's good question.
Currently, This line wants t
| |
907 { | 905 { |
908 ResourceProvider::ScopedWriteLockGL lock(resource_provider_, | 906 ResourceProvider::ScopedWriteLockGL lock(resource_provider_, |
909 device_background_texture->id()); | 907 device_background_texture->id()); |
910 GetFramebufferTexture( | 908 GetFramebufferTexture( |
911 lock.texture_id(), device_background_texture->format(), window_rect); | 909 lock.texture_id(), device_background_texture->format(), window_rect); |
912 } | 910 } |
913 | 911 |
914 skia::RefPtr<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter( | 912 skia::RefPtr<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter( |
915 quad->background_filters, device_background_texture->size()); | 913 quad->background_filters, device_background_texture->size()); |
916 | 914 |
(...skipping 17 matching lines...) Expand all Loading... | |
934 filtered_device_background_texture_id = texture->getTextureHandle(); | 932 filtered_device_background_texture_id = texture->getTextureHandle(); |
935 } else { | 933 } else { |
936 lock.reset(new ResourceProvider::ScopedReadLockGL( | 934 lock.reset(new ResourceProvider::ScopedReadLockGL( |
937 resource_provider_, device_background_texture->id())); | 935 resource_provider_, device_background_texture->id())); |
938 filtered_device_background_texture_id = lock->texture_id(); | 936 filtered_device_background_texture_id = lock->texture_id(); |
939 } | 937 } |
940 | 938 |
941 scoped_ptr<ScopedResource> background_texture = | 939 scoped_ptr<ScopedResource> background_texture = |
942 ScopedResource::Create(resource_provider_); | 940 ScopedResource::Create(resource_provider_); |
943 background_texture->Allocate( | 941 background_texture->Allocate( |
944 quad->rect.size(), ResourceProvider::TextureUsageFramebuffer, RGBA_8888); | 942 quad->rect.size(), ResourceProvider::TextureHintFramebuffer, RGBA_8888); |
945 | 943 |
946 const RenderPass* target_render_pass = frame->current_render_pass; | 944 const RenderPass* target_render_pass = frame->current_render_pass; |
947 bool using_background_texture = | 945 bool using_background_texture = |
948 UseScopedTexture(frame, background_texture.get(), quad->rect); | 946 UseScopedTexture(frame, background_texture.get(), quad->rect); |
949 | 947 |
950 if (using_background_texture) { | 948 if (using_background_texture) { |
951 // Copy the readback pixels from device to the background texture for the | 949 // Copy the readback pixels from device to the background texture for the |
952 // surface. | 950 // surface. |
953 gfx::Transform device_to_framebuffer_transform; | 951 gfx::Transform device_to_framebuffer_transform; |
954 QuadRectTransform( | 952 QuadRectTransform( |
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1922 void GLRenderer::DrawPictureQuad(const DrawingFrame* frame, | 1920 void GLRenderer::DrawPictureQuad(const DrawingFrame* frame, |
1923 const PictureDrawQuad* quad) { | 1921 const PictureDrawQuad* quad) { |
1924 if (on_demand_tile_raster_bitmap_.width() != quad->texture_size.width() || | 1922 if (on_demand_tile_raster_bitmap_.width() != quad->texture_size.width() || |
1925 on_demand_tile_raster_bitmap_.height() != quad->texture_size.height()) { | 1923 on_demand_tile_raster_bitmap_.height() != quad->texture_size.height()) { |
1926 on_demand_tile_raster_bitmap_.allocN32Pixels(quad->texture_size.width(), | 1924 on_demand_tile_raster_bitmap_.allocN32Pixels(quad->texture_size.width(), |
1927 quad->texture_size.height()); | 1925 quad->texture_size.height()); |
1928 | 1926 |
1929 if (on_demand_tile_raster_resource_id_) | 1927 if (on_demand_tile_raster_resource_id_) |
1930 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_); | 1928 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_); |
1931 | 1929 |
1932 on_demand_tile_raster_resource_id_ = | 1930 on_demand_tile_raster_resource_id_ = resource_provider_->CreateGLTexture( |
1933 resource_provider_->CreateGLTexture(quad->texture_size, | 1931 quad->texture_size, |
1934 GL_TEXTURE_2D, | 1932 GL_TEXTURE_2D, |
1935 GL_TEXTURE_POOL_UNMANAGED_CHROMIUM, | 1933 GL_TEXTURE_POOL_UNMANAGED_CHROMIUM, |
1936 GL_CLAMP_TO_EDGE, | 1934 GL_CLAMP_TO_EDGE, |
1937 ResourceProvider::TextureUsageAny, | 1935 ResourceProvider::TextureHintImmutable, |
1938 quad->texture_format); | 1936 quad->texture_format); |
1939 } | 1937 } |
1940 | 1938 |
1941 // Create and run on-demand raster task for tile. | 1939 // Create and run on-demand raster task for tile. |
1942 scoped_refptr<Task> on_demand_raster_task( | 1940 scoped_refptr<Task> on_demand_raster_task( |
1943 new OnDemandRasterTaskImpl(quad->picture_pile, | 1941 new OnDemandRasterTaskImpl(quad->picture_pile, |
1944 &on_demand_tile_raster_bitmap_, | 1942 &on_demand_tile_raster_bitmap_, |
1945 quad->content_rect, | 1943 quad->content_rect, |
1946 quad->contents_scale)); | 1944 quad->contents_scale)); |
1947 client_->RunOnDemandRasterTask(on_demand_raster_task.get()); | 1945 client_->RunOnDemandRasterTask(on_demand_raster_task.get()); |
1948 | 1946 |
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3217 context_support_->ScheduleOverlayPlane( | 3215 context_support_->ScheduleOverlayPlane( |
3218 overlay.plane_z_order, | 3216 overlay.plane_z_order, |
3219 overlay.transform, | 3217 overlay.transform, |
3220 pending_overlay_resources_.back()->texture_id(), | 3218 pending_overlay_resources_.back()->texture_id(), |
3221 overlay.display_rect, | 3219 overlay.display_rect, |
3222 overlay.uv_rect); | 3220 overlay.uv_rect); |
3223 } | 3221 } |
3224 } | 3222 } |
3225 | 3223 |
3226 } // namespace cc | 3224 } // namespace cc |
OLD | NEW |