| 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/layers/texture_layer.h" | 5 #include "cc/layers/texture_layer.h" |
| 6 | 6 |
| 7 #include "cc/base/thread.h" | 7 #include "cc/base/thread.h" |
| 8 #include "cc/layers/texture_layer_client.h" | 8 #include "cc/layers/texture_layer_client.h" |
| 9 #include "cc/layers/texture_layer_impl.h" | 9 #include "cc/layers/texture_layer_impl.h" |
| 10 #include "cc/trees/layer_tree_host.h" | 10 #include "cc/trees/layer_tree_host.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 else | 76 else |
| 77 SetTextureId(0); | 77 SetTextureId(0); |
| 78 } | 78 } |
| 79 | 79 |
| 80 scoped_ptr<LayerImpl> TextureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { | 80 scoped_ptr<LayerImpl> TextureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { |
| 81 return TextureLayerImpl::Create(tree_impl, id(), uses_mailbox_). | 81 return TextureLayerImpl::Create(tree_impl, id(), uses_mailbox_). |
| 82 PassAs<LayerImpl>(); | 82 PassAs<LayerImpl>(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void TextureLayer::SetFlipped(bool flipped) { | 85 void TextureLayer::SetFlipped(bool flipped) { |
| 86 if (flipped_ == flipped) |
| 87 return; |
| 86 flipped_ = flipped; | 88 flipped_ = flipped; |
| 87 SetNeedsCommit(); | 89 SetNeedsCommit(); |
| 88 } | 90 } |
| 89 | 91 |
| 90 void TextureLayer::SetUV(gfx::PointF top_left, gfx::PointF bottom_right) { | 92 void TextureLayer::SetUV(gfx::PointF top_left, gfx::PointF bottom_right) { |
| 93 if (uv_top_left_ == top_left && uv_bottom_right_ == bottom_right) |
| 94 return; |
| 91 uv_top_left_ = top_left; | 95 uv_top_left_ = top_left; |
| 92 uv_bottom_right_ = bottom_right; | 96 uv_bottom_right_ = bottom_right; |
| 93 SetNeedsCommit(); | 97 SetNeedsCommit(); |
| 94 } | 98 } |
| 95 | 99 |
| 96 void TextureLayer::SetVertexOpacity(float bottom_left, | 100 void TextureLayer::SetVertexOpacity(float bottom_left, |
| 97 float top_left, | 101 float top_left, |
| 98 float top_right, | 102 float top_right, |
| 99 float bottom_right) { | 103 float bottom_right) { |
| 100 // Indexing according to the quad vertex generation: | 104 // Indexing according to the quad vertex generation: |
| 101 // 1--2 | 105 // 1--2 |
| 102 // | | | 106 // | | |
| 103 // 0--3 | 107 // 0--3 |
| 108 if (vertex_opacity_[0] == bottom_left && |
| 109 vertex_opacity_[1] == top_left && |
| 110 vertex_opacity_[2] == top_right && |
| 111 vertex_opacity_[3] == bottom_right) |
| 112 return; |
| 104 vertex_opacity_[0] = bottom_left; | 113 vertex_opacity_[0] = bottom_left; |
| 105 vertex_opacity_[1] = top_left; | 114 vertex_opacity_[1] = top_left; |
| 106 vertex_opacity_[2] = top_right; | 115 vertex_opacity_[2] = top_right; |
| 107 vertex_opacity_[3] = bottom_right; | 116 vertex_opacity_[3] = bottom_right; |
| 108 SetNeedsCommit(); | 117 SetNeedsCommit(); |
| 109 } | 118 } |
| 110 | 119 |
| 111 void TextureLayer::SetPremultipliedAlpha(bool premultiplied_alpha) { | 120 void TextureLayer::SetPremultipliedAlpha(bool premultiplied_alpha) { |
| 121 if (premultiplied_alpha_ == premultiplied_alpha) |
| 122 return; |
| 112 premultiplied_alpha_ = premultiplied_alpha; | 123 premultiplied_alpha_ = premultiplied_alpha; |
| 113 SetNeedsCommit(); | 124 SetNeedsCommit(); |
| 114 } | 125 } |
| 115 | 126 |
| 116 void TextureLayer::SetRateLimitContext(bool rate_limit) { | 127 void TextureLayer::SetRateLimitContext(bool rate_limit) { |
| 117 if (!rate_limit && rate_limit_context_ && client_ && layer_tree_host()) | 128 if (!rate_limit && rate_limit_context_ && client_ && layer_tree_host()) |
| 118 layer_tree_host()->StopRateLimiter(client_->Context3d()); | 129 layer_tree_host()->StopRateLimiter(client_->Context3d()); |
| 119 | 130 |
| 120 rate_limit_context_ = rate_limit; | 131 rate_limit_context_ = rate_limit; |
| 121 } | 132 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 // triple-buffered. Single-buffered layers already prevent draws, so | 225 // triple-buffered. Single-buffered layers already prevent draws, so |
| 215 // can block too for simplicity. | 226 // can block too for simplicity. |
| 216 return DrawsContent(); | 227 return DrawsContent(); |
| 217 } | 228 } |
| 218 | 229 |
| 219 bool TextureLayer::CanClipSelf() const { | 230 bool TextureLayer::CanClipSelf() const { |
| 220 return true; | 231 return true; |
| 221 } | 232 } |
| 222 | 233 |
| 223 } // namespace cc | 234 } // namespace cc |
| OLD | NEW |