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

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

Issue 18432002: Blend TextureLayer background-color at draw time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: resolved conflicts with TOT Created 7 years, 5 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 | « cc/layers/texture_layer.h ('k') | cc/layers/texture_layer_impl.h » ('j') | no next file with comments »
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/layers/texture_layer.h" 5 #include "cc/layers/texture_layer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "cc/layers/texture_layer_client.h" 10 #include "cc/layers/texture_layer_client.h"
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 25
26 TextureLayer::TextureLayer(TextureLayerClient* client, bool uses_mailbox) 26 TextureLayer::TextureLayer(TextureLayerClient* client, bool uses_mailbox)
27 : Layer(), 27 : Layer(),
28 client_(client), 28 client_(client),
29 uses_mailbox_(uses_mailbox), 29 uses_mailbox_(uses_mailbox),
30 flipped_(true), 30 flipped_(true),
31 uv_top_left_(0.f, 0.f), 31 uv_top_left_(0.f, 0.f),
32 uv_bottom_right_(1.f, 1.f), 32 uv_bottom_right_(1.f, 1.f),
33 premultiplied_alpha_(true), 33 premultiplied_alpha_(true),
34 blend_background_color_(false),
34 rate_limit_context_(false), 35 rate_limit_context_(false),
35 content_committed_(false), 36 content_committed_(false),
36 texture_id_(0), 37 texture_id_(0),
37 needs_set_mailbox_(false) { 38 needs_set_mailbox_(false) {
38 vertex_opacity_[0] = 1.0f; 39 vertex_opacity_[0] = 1.0f;
39 vertex_opacity_[1] = 1.0f; 40 vertex_opacity_[1] = 1.0f;
40 vertex_opacity_[2] = 1.0f; 41 vertex_opacity_[2] = 1.0f;
41 vertex_opacity_[3] = 1.0f; 42 vertex_opacity_[3] = 1.0f;
42 } 43 }
43 44
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 SetNeedsCommit(); 99 SetNeedsCommit();
99 } 100 }
100 101
101 void TextureLayer::SetPremultipliedAlpha(bool premultiplied_alpha) { 102 void TextureLayer::SetPremultipliedAlpha(bool premultiplied_alpha) {
102 if (premultiplied_alpha_ == premultiplied_alpha) 103 if (premultiplied_alpha_ == premultiplied_alpha)
103 return; 104 return;
104 premultiplied_alpha_ = premultiplied_alpha; 105 premultiplied_alpha_ = premultiplied_alpha;
105 SetNeedsCommit(); 106 SetNeedsCommit();
106 } 107 }
107 108
109 void TextureLayer::SetBlendBackgroundColor(bool blend) {
110 if (blend_background_color_ == blend)
111 return;
112 blend_background_color_ = blend;
113 SetNeedsCommit();
114 }
115
108 void TextureLayer::SetRateLimitContext(bool rate_limit) { 116 void TextureLayer::SetRateLimitContext(bool rate_limit) {
109 if (!rate_limit && rate_limit_context_ && client_ && layer_tree_host()) 117 if (!rate_limit && rate_limit_context_ && client_ && layer_tree_host())
110 layer_tree_host()->StopRateLimiter(client_->Context3d()); 118 layer_tree_host()->StopRateLimiter(client_->Context3d());
111 119
112 rate_limit_context_ = rate_limit; 120 rate_limit_context_ = rate_limit;
113 } 121 }
114 122
115 void TextureLayer::SetTextureId(unsigned id) { 123 void TextureLayer::SetTextureId(unsigned id) {
116 DCHECK(!uses_mailbox_); 124 DCHECK(!uses_mailbox_);
117 if (texture_id_ == id) 125 if (texture_id_ == id)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 203
196 void TextureLayer::PushPropertiesTo(LayerImpl* layer) { 204 void TextureLayer::PushPropertiesTo(LayerImpl* layer) {
197 Layer::PushPropertiesTo(layer); 205 Layer::PushPropertiesTo(layer);
198 206
199 TextureLayerImpl* texture_layer = static_cast<TextureLayerImpl*>(layer); 207 TextureLayerImpl* texture_layer = static_cast<TextureLayerImpl*>(layer);
200 texture_layer->set_flipped(flipped_); 208 texture_layer->set_flipped(flipped_);
201 texture_layer->set_uv_top_left(uv_top_left_); 209 texture_layer->set_uv_top_left(uv_top_left_);
202 texture_layer->set_uv_bottom_right(uv_bottom_right_); 210 texture_layer->set_uv_bottom_right(uv_bottom_right_);
203 texture_layer->set_vertex_opacity(vertex_opacity_); 211 texture_layer->set_vertex_opacity(vertex_opacity_);
204 texture_layer->set_premultiplied_alpha(premultiplied_alpha_); 212 texture_layer->set_premultiplied_alpha(premultiplied_alpha_);
213 texture_layer->set_blend_background_color(blend_background_color_);
205 if (uses_mailbox_ && needs_set_mailbox_) { 214 if (uses_mailbox_ && needs_set_mailbox_) {
206 TextureMailbox texture_mailbox; 215 TextureMailbox texture_mailbox;
207 if (holder_ref_) { 216 if (holder_ref_) {
208 MailboxHolder* holder = holder_ref_->holder(); 217 MailboxHolder* holder = holder_ref_->holder();
209 TextureMailbox::ReleaseCallback callback = 218 TextureMailbox::ReleaseCallback callback =
210 holder->GetCallbackForImplThread(); 219 holder->GetCallbackForImplThread();
211 texture_mailbox = holder->mailbox().CopyWithNewCallback(callback); 220 texture_mailbox = holder->mailbox().CopyWithNewCallback(callback);
212 } 221 }
213 texture_layer->SetTextureMailbox(texture_mailbox); 222 texture_layer->SetTextureMailbox(texture_mailbox);
214 needs_set_mailbox_ = false; 223 needs_set_mailbox_ = false;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 } 300 }
292 301
293 void TextureLayer::MailboxHolder::ReturnAndReleaseOnImplThread( 302 void TextureLayer::MailboxHolder::ReturnAndReleaseOnImplThread(
294 unsigned sync_point, bool is_lost) { 303 unsigned sync_point, bool is_lost) {
295 message_loop_->PostTask(FROM_HERE, base::Bind( 304 message_loop_->PostTask(FROM_HERE, base::Bind(
296 &MailboxHolder::ReturnAndReleaseOnMainThread, 305 &MailboxHolder::ReturnAndReleaseOnMainThread,
297 this, sync_point, is_lost)); 306 this, sync_point, is_lost));
298 } 307 }
299 308
300 } // namespace cc 309 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/texture_layer.h ('k') | cc/layers/texture_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698