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

Side by Side Diff: cc/texture_layer.cc

Issue 12670009: cc: Chromify TextureLayerClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
« no previous file with comments | « no previous file | cc/texture_layer_client.h » ('j') | cc/texture_layer_client.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/texture_layer.h" 5 #include "cc/texture_layer.h"
6 6
7 #include "cc/layer_tree_host.h" 7 #include "cc/layer_tree_host.h"
8 #include "cc/texture_layer_client.h" 8 #include "cc/texture_layer_client.h"
9 #include "cc/texture_layer_impl.h" 9 #include "cc/texture_layer_impl.h"
10 #include "cc/thread.h" 10 #include "cc/thread.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 vertex_opacity_[1] = 1.0f; 51 vertex_opacity_[1] = 1.0f;
52 vertex_opacity_[2] = 1.0f; 52 vertex_opacity_[2] = 1.0f;
53 vertex_opacity_[3] = 1.0f; 53 vertex_opacity_[3] = 1.0f;
54 } 54 }
55 55
56 TextureLayer::~TextureLayer() { 56 TextureLayer::~TextureLayer() {
57 if (layer_tree_host()) { 57 if (layer_tree_host()) {
58 if (texture_id_) 58 if (texture_id_)
59 layer_tree_host()->AcquireLayerTextures(); 59 layer_tree_host()->AcquireLayerTextures();
60 if (rate_limit_context_ && client_) 60 if (rate_limit_context_ && client_)
61 layer_tree_host()->StopRateLimiter(client_->context()); 61 layer_tree_host()->StopRateLimiter(client_->Context());
62 } 62 }
63 if (own_mailbox_) 63 if (own_mailbox_)
64 texture_mailbox_.RunReleaseCallback(texture_mailbox_.sync_point()); 64 texture_mailbox_.RunReleaseCallback(texture_mailbox_.sync_point());
65 } 65 }
66 66
67 scoped_ptr<LayerImpl> TextureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { 67 scoped_ptr<LayerImpl> TextureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) {
68 return TextureLayerImpl::Create(tree_impl, id(), uses_mailbox_). 68 return TextureLayerImpl::Create(tree_impl, id(), uses_mailbox_).
69 PassAs<LayerImpl>(); 69 PassAs<LayerImpl>();
70 } 70 }
71 71
(...skipping 23 matching lines...) Expand all
95 SetNeedsCommit(); 95 SetNeedsCommit();
96 } 96 }
97 97
98 void TextureLayer::SetPremultipliedAlpha(bool premultiplied_alpha) { 98 void TextureLayer::SetPremultipliedAlpha(bool premultiplied_alpha) {
99 premultiplied_alpha_ = premultiplied_alpha; 99 premultiplied_alpha_ = premultiplied_alpha;
100 SetNeedsCommit(); 100 SetNeedsCommit();
101 } 101 }
102 102
103 void TextureLayer::SetRateLimitContext(bool rate_limit) { 103 void TextureLayer::SetRateLimitContext(bool rate_limit) {
104 if (!rate_limit && rate_limit_context_ && client_ && layer_tree_host()) 104 if (!rate_limit && rate_limit_context_ && client_ && layer_tree_host())
105 layer_tree_host()->StopRateLimiter(client_->context()); 105 layer_tree_host()->StopRateLimiter(client_->Context());
106 106
107 rate_limit_context_ = rate_limit; 107 rate_limit_context_ = rate_limit;
108 } 108 }
109 109
110 void TextureLayer::SetTextureId(unsigned id) { 110 void TextureLayer::SetTextureId(unsigned id) {
111 DCHECK(!uses_mailbox_); 111 DCHECK(!uses_mailbox_);
112 if (texture_id_ == id) 112 if (texture_id_ == id)
113 return; 113 return;
114 if (texture_id_ && layer_tree_host()) 114 if (texture_id_ && layer_tree_host())
115 layer_tree_host()->AcquireLayerTextures(); 115 layer_tree_host()->AcquireLayerTextures();
(...skipping 17 matching lines...) Expand all
133 if (layer_tree_host() && (DrawsContent() || content_committed_)) { 133 if (layer_tree_host() && (DrawsContent() || content_committed_)) {
134 layer_tree_host()->AcquireLayerTextures(); 134 layer_tree_host()->AcquireLayerTextures();
135 content_committed_ = false; 135 content_committed_ = false;
136 } 136 }
137 } 137 }
138 138
139 void TextureLayer::SetNeedsDisplayRect(const gfx::RectF& dirty_rect) { 139 void TextureLayer::SetNeedsDisplayRect(const gfx::RectF& dirty_rect) {
140 Layer::SetNeedsDisplayRect(dirty_rect); 140 Layer::SetNeedsDisplayRect(dirty_rect);
141 141
142 if (rate_limit_context_ && client_ && layer_tree_host() && DrawsContent()) 142 if (rate_limit_context_ && client_ && layer_tree_host() && DrawsContent())
143 layer_tree_host()->StartRateLimiter(client_->context()); 143 layer_tree_host()->StartRateLimiter(client_->Context());
144 } 144 }
145 145
146 void TextureLayer::SetLayerTreeHost(LayerTreeHost* host) { 146 void TextureLayer::SetLayerTreeHost(LayerTreeHost* host) {
147 if (texture_id_ && layer_tree_host() && host != layer_tree_host()) 147 if (texture_id_ && layer_tree_host() && host != layer_tree_host())
148 layer_tree_host()->AcquireLayerTextures(); 148 layer_tree_host()->AcquireLayerTextures();
149 Layer::SetLayerTreeHost(host); 149 Layer::SetLayerTreeHost(host);
150 } 150 }
151 151
152 bool TextureLayer::DrawsContent() const { 152 bool TextureLayer::DrawsContent() const {
153 return (client_ || texture_id_ || !texture_mailbox_.IsEmpty()) && 153 return (client_ || texture_id_ || !texture_mailbox_.IsEmpty()) &&
154 !context_lost_ && Layer::DrawsContent(); 154 !context_lost_ && Layer::DrawsContent();
155 } 155 }
156 156
157 void TextureLayer::Update(ResourceUpdateQueue* queue, 157 void TextureLayer::Update(ResourceUpdateQueue* queue,
158 const OcclusionTracker* occlusion, 158 const OcclusionTracker* occlusion,
159 RenderingStats* stats) { 159 RenderingStats* stats) {
160 if (client_) { 160 if (client_) {
161 texture_id_ = client_->prepareTexture(*queue); 161 texture_id_ = client_->PrepareTexture(queue);
162 context_lost_ = 162 context_lost_ =
163 client_->context()->getGraphicsResetStatusARB() != GL_NO_ERROR; 163 client_->Context()->getGraphicsResetStatusARB() != GL_NO_ERROR;
164 } 164 }
165 165
166 needs_display_ = false; 166 needs_display_ = false;
167 } 167 }
168 168
169 void TextureLayer::PushPropertiesTo(LayerImpl* layer) { 169 void TextureLayer::PushPropertiesTo(LayerImpl* layer) {
170 Layer::PushPropertiesTo(layer); 170 Layer::PushPropertiesTo(layer);
171 171
172 TextureLayerImpl* texture_layer = static_cast<TextureLayerImpl*>(layer); 172 TextureLayerImpl* texture_layer = static_cast<TextureLayerImpl*>(layer);
173 texture_layer->setFlipped(flipped_); 173 texture_layer->setFlipped(flipped_);
(...skipping 21 matching lines...) Expand all
195 // triple-buffered. Single-buffered layers already prevent draws, so 195 // triple-buffered. Single-buffered layers already prevent draws, so
196 // can block too for simplicity. 196 // can block too for simplicity.
197 return DrawsContent(); 197 return DrawsContent();
198 } 198 }
199 199
200 bool TextureLayer::CanClipSelf() const { 200 bool TextureLayer::CanClipSelf() const {
201 return true; 201 return true;
202 } 202 }
203 203
204 } // namespace cc 204 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/texture_layer_client.h » ('j') | cc/texture_layer_client.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698