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

Side by Side Diff: cc/layers/heads_up_display_layer_impl.cc

Issue 16211002: Skip drawing unsupported layers in forced software mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase on r203584 Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/layers/heads_up_display_layer_impl.h" 5 #include "cc/layers/heads_up_display_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 fps_graph_(60.0, 80.0), 74 fps_graph_(60.0, 80.0),
75 paint_time_graph_(16.0, 48.0) {} 75 paint_time_graph_(16.0, 48.0) {}
76 76
77 HeadsUpDisplayLayerImpl::~HeadsUpDisplayLayerImpl() {} 77 HeadsUpDisplayLayerImpl::~HeadsUpDisplayLayerImpl() {}
78 78
79 scoped_ptr<LayerImpl> HeadsUpDisplayLayerImpl::CreateLayerImpl( 79 scoped_ptr<LayerImpl> HeadsUpDisplayLayerImpl::CreateLayerImpl(
80 LayerTreeImpl* tree_impl) { 80 LayerTreeImpl* tree_impl) {
81 return HeadsUpDisplayLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); 81 return HeadsUpDisplayLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>();
82 } 82 }
83 83
84 void HeadsUpDisplayLayerImpl::WillDraw(ResourceProvider* resource_provider) { 84 bool HeadsUpDisplayLayerImpl::WillDraw(DrawMode draw_mode,
85 LayerImpl::WillDraw(resource_provider); 85 ResourceProvider* resource_provider) {
86 if (draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE)
87 return false;
86 88
87 if (!hud_resource_) 89 if (!hud_resource_)
88 hud_resource_ = ScopedResource::create(resource_provider); 90 hud_resource_ = ScopedResource::create(resource_provider);
89 91
90 // TODO(danakj): Scale the HUD by device scale to make it more friendly under 92 // TODO(danakj): Scale the HUD by device scale to make it more friendly under
91 // high DPI. 93 // high DPI.
92 94
93 // TODO(danakj): The HUD could swap between two textures instead of creating a 95 // TODO(danakj): The HUD could swap between two textures instead of creating a
94 // texture every frame in ubercompositor. 96 // texture every frame in ubercompositor.
95 if (hud_resource_->size() != bounds() || 97 if (hud_resource_->size() != bounds() ||
96 resource_provider->InUseByConsumer(hud_resource_->id())) 98 resource_provider->InUseByConsumer(hud_resource_->id()))
97 hud_resource_->Free(); 99 hud_resource_->Free();
98 100
99 if (!hud_resource_->id()) { 101 if (!hud_resource_->id()) {
100 hud_resource_->Allocate( 102 hud_resource_->Allocate(
101 bounds(), GL_RGBA, ResourceProvider::TextureUsageAny); 103 bounds(), GL_RGBA, ResourceProvider::TextureUsageAny);
102 } 104 }
105
106 return LayerImpl::WillDraw(draw_mode, resource_provider);
103 } 107 }
104 108
105 void HeadsUpDisplayLayerImpl::AppendQuads(QuadSink* quad_sink, 109 void HeadsUpDisplayLayerImpl::AppendQuads(QuadSink* quad_sink,
106 AppendQuadsData* append_quads_data) { 110 AppendQuadsData* append_quads_data) {
107 if (!hud_resource_->id()) 111 if (!hud_resource_->id())
108 return; 112 return;
109 113
110 SharedQuadState* shared_quad_state = 114 SharedQuadState* shared_quad_state =
111 quad_sink->UseSharedQuadState(CreateSharedQuadState()); 115 quad_sink->UseSharedQuadState(CreateSharedQuadState());
112 116
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 } 677 }
674 678
675 canvas->restore(); 679 canvas->restore();
676 } 680 }
677 681
678 const char* HeadsUpDisplayLayerImpl::LayerTypeAsString() const { 682 const char* HeadsUpDisplayLayerImpl::LayerTypeAsString() const {
679 return "cc::HeadsUpDisplayLayerImpl"; 683 return "cc::HeadsUpDisplayLayerImpl";
680 } 684 }
681 685
682 } // namespace cc 686 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698