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

Side by Side Diff: cc/trees/layer_tree_host.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 unified diff | Download patch
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <stack> 8 #include <stack>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 11 matching lines...) Expand all
22 #include "cc/debug/overdraw_metrics.h" 22 #include "cc/debug/overdraw_metrics.h"
23 #include "cc/debug/rendering_stats_instrumentation.h" 23 #include "cc/debug/rendering_stats_instrumentation.h"
24 #include "cc/input/top_controls_manager.h" 24 #include "cc/input/top_controls_manager.h"
25 #include "cc/layers/heads_up_display_layer.h" 25 #include "cc/layers/heads_up_display_layer.h"
26 #include "cc/layers/heads_up_display_layer_impl.h" 26 #include "cc/layers/heads_up_display_layer_impl.h"
27 #include "cc/layers/layer.h" 27 #include "cc/layers/layer.h"
28 #include "cc/layers/layer_iterator.h" 28 #include "cc/layers/layer_iterator.h"
29 #include "cc/layers/painted_scrollbar_layer.h" 29 #include "cc/layers/painted_scrollbar_layer.h"
30 #include "cc/layers/render_surface.h" 30 #include "cc/layers/render_surface.h"
31 #include "cc/resources/prioritized_resource_manager.h" 31 #include "cc/resources/prioritized_resource_manager.h"
32 #include "cc/resources/resource_provider.h"
32 #include "cc/resources/ui_resource_client.h" 33 #include "cc/resources/ui_resource_client.h"
33 #include "cc/trees/layer_tree_host_client.h" 34 #include "cc/trees/layer_tree_host_client.h"
34 #include "cc/trees/layer_tree_host_common.h" 35 #include "cc/trees/layer_tree_host_common.h"
35 #include "cc/trees/layer_tree_host_impl.h" 36 #include "cc/trees/layer_tree_host_impl.h"
36 #include "cc/trees/layer_tree_impl.h" 37 #include "cc/trees/layer_tree_impl.h"
37 #include "cc/trees/occlusion_tracker.h" 38 #include "cc/trees/occlusion_tracker.h"
38 #include "cc/trees/single_thread_proxy.h" 39 #include "cc/trees/single_thread_proxy.h"
39 #include "cc/trees/thread_proxy.h" 40 #include "cc/trees/thread_proxy.h"
40 #include "cc/trees/tree_synchronizer.h" 41 #include "cc/trees/tree_synchronizer.h"
41 #include "ui/gfx/size_conversions.h" 42 #include "ui/gfx/size_conversions.h"
42 43
43 namespace { 44 namespace {
44 static int s_num_layer_tree_instances; 45 static int s_num_layer_tree_instances;
45 } 46 }
46 47
47 namespace cc { 48 namespace cc {
48 49
49 RendererCapabilities::RendererCapabilities() 50 RendererCapabilities::RendererCapabilities()
50 : best_texture_format(0), 51 : best_texture_format(ResourceProvider::INVALID_FORMAT),
51 using_partial_swap(false), 52 using_partial_swap(false),
52 using_set_visibility(false), 53 using_set_visibility(false),
53 using_egl_image(false), 54 using_egl_image(false),
54 allow_partial_texture_updates(false), 55 allow_partial_texture_updates(false),
55 using_offscreen_context3d(false), 56 using_offscreen_context3d(false),
56 max_texture_size(0), 57 max_texture_size(0),
57 avoid_pow2_textures(false), 58 avoid_pow2_textures(false),
58 using_map_image(false), 59 using_map_image(false),
59 using_shared_memory_resources(false), 60 using_shared_memory_resources(false),
60 using_discard_framebuffer(false) {} 61 using_discard_framebuffer(false) {}
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 settings_.max_partial_texture_updates, 191 settings_.max_partial_texture_updates,
191 proxy_->MaxPartialTextureUpdates()); 192 proxy_->MaxPartialTextureUpdates());
192 } 193 }
193 settings_.max_partial_texture_updates = max_partial_texture_updates; 194 settings_.max_partial_texture_updates = max_partial_texture_updates;
194 195
195 if (!contents_texture_manager_ && 196 if (!contents_texture_manager_ &&
196 (!settings_.impl_side_painting || !settings_.solid_color_scrollbars)) { 197 (!settings_.impl_side_painting || !settings_.solid_color_scrollbars)) {
197 contents_texture_manager_ = 198 contents_texture_manager_ =
198 PrioritizedResourceManager::Create(proxy_.get()); 199 PrioritizedResourceManager::Create(proxy_.get());
199 surface_memory_placeholder_ = 200 surface_memory_placeholder_ =
200 contents_texture_manager_->CreateTexture(gfx::Size(), GL_RGBA); 201 contents_texture_manager_->CreateTexture(gfx::Size(),
202 ResourceProvider::RGBA_8888);
201 } 203 }
202 204
203 client_->DidInitializeOutputSurface(true); 205 client_->DidInitializeOutputSurface(true);
204 return CreateSucceeded; 206 return CreateSucceeded;
205 } 207 }
206 208
207 // Failure path. 209 // Failure path.
208 210
209 client_->DidFailToInitializeOutputSurface(); 211 client_->DidFailToInitializeOutputSurface();
210 212
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 size_t contents_texture_bytes = 0; 912 size_t contents_texture_bytes = 0;
911 913
912 // Start iteration at 1 to skip the root surface as it does not have a texture 914 // Start iteration at 1 to skip the root surface as it does not have a texture
913 // cost. 915 // cost.
914 for (size_t i = 1; i < update_list.size(); ++i) { 916 for (size_t i = 1; i < update_list.size(); ++i) {
915 Layer* render_surface_layer = update_list.at(i); 917 Layer* render_surface_layer = update_list.at(i);
916 RenderSurface* render_surface = render_surface_layer->render_surface(); 918 RenderSurface* render_surface = render_surface_layer->render_surface();
917 919
918 size_t bytes = 920 size_t bytes =
919 Resource::MemorySizeBytes(render_surface->content_rect().size(), 921 Resource::MemorySizeBytes(render_surface->content_rect().size(),
920 GL_RGBA); 922 ResourceProvider::RGBA_8888);
921 contents_texture_bytes += bytes; 923 contents_texture_bytes += bytes;
922 924
923 if (render_surface_layer->background_filters().IsEmpty()) 925 if (render_surface_layer->background_filters().IsEmpty())
924 continue; 926 continue;
925 927
926 if (bytes > max_background_texture_bytes) 928 if (bytes > max_background_texture_bytes)
927 max_background_texture_bytes = bytes; 929 max_background_texture_bytes = bytes;
928 if (!readback_bytes) { 930 if (!readback_bytes) {
929 readback_bytes = Resource::MemorySizeBytes(device_viewport_size_, 931 readback_bytes = Resource::MemorySizeBytes(device_viewport_size_,
930 GL_RGBA); 932 ResourceProvider::RGBA_8888);
931 } 933 }
932 } 934 }
933 return readback_bytes + max_background_texture_bytes + contents_texture_bytes; 935 return readback_bytes + max_background_texture_bytes + contents_texture_bytes;
934 } 936 }
935 937
936 void LayerTreeHost::PaintMasksForRenderSurface(Layer* render_surface_layer, 938 void LayerTreeHost::PaintMasksForRenderSurface(Layer* render_surface_layer,
937 ResourceUpdateQueue* queue, 939 ResourceUpdateQueue* queue,
938 bool* did_paint_content, 940 bool* did_paint_content,
939 bool* need_more_updates) { 941 bool* need_more_updates) {
940 // Note: Masks and replicas only exist for layers that own render surfaces. If 942 // Note: Masks and replicas only exist for layers that own render surfaces. If
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 UIResourceRequest request; 1186 UIResourceRequest request;
1185 request.type = UIResourceRequest::UIResourceCreate; 1187 request.type = UIResourceRequest::UIResourceCreate;
1186 request.id = uid; 1188 request.id = uid;
1187 request.bitmap = iter->second->GetBitmap(uid, resource_lost); 1189 request.bitmap = iter->second->GetBitmap(uid, resource_lost);
1188 DCHECK(request.bitmap.get()); 1190 DCHECK(request.bitmap.get());
1189 ui_resource_request_queue_.push_back(request); 1191 ui_resource_request_queue_.push_back(request);
1190 } 1192 }
1191 } 1193 }
1192 1194
1193 } // namespace cc 1195 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698