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

Side by Side Diff: cc/texture_layer.cc

Issue 11570027: Adding support for per vertex opacity on textured layer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years 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/texture_layer.h ('k') | cc/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/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 "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h"
(...skipping 10 matching lines...) Expand all
21 : Layer() 21 : Layer()
22 , m_client(client) 22 , m_client(client)
23 , m_flipped(true) 23 , m_flipped(true)
24 , m_uvRect(0, 0, 1, 1) 24 , m_uvRect(0, 0, 1, 1)
25 , m_premultipliedAlpha(true) 25 , m_premultipliedAlpha(true)
26 , m_rateLimitContext(false) 26 , m_rateLimitContext(false)
27 , m_contextLost(false) 27 , m_contextLost(false)
28 , m_textureId(0) 28 , m_textureId(0)
29 , m_contentCommitted(false) 29 , m_contentCommitted(false)
30 { 30 {
31 m_vertexOpacity[0] = 1.0f;
32 m_vertexOpacity[1] = 1.0f;
33 m_vertexOpacity[2] = 1.0f;
34 m_vertexOpacity[3] = 1.0f;
31 } 35 }
32 36
33 TextureLayer::~TextureLayer() 37 TextureLayer::~TextureLayer()
34 { 38 {
35 if (layerTreeHost()) { 39 if (layerTreeHost()) {
36 if (m_textureId) 40 if (m_textureId)
37 layerTreeHost()->acquireLayerTextures(); 41 layerTreeHost()->acquireLayerTextures();
38 if (m_rateLimitContext && m_client) 42 if (m_rateLimitContext && m_client)
39 layerTreeHost()->stopRateLimiter(m_client->context()); 43 layerTreeHost()->stopRateLimiter(m_client->context());
40 } 44 }
41 } 45 }
42 46
43 scoped_ptr<LayerImpl> TextureLayer::createLayerImpl(LayerTreeImpl* treeImpl) 47 scoped_ptr<LayerImpl> TextureLayer::createLayerImpl(LayerTreeImpl* treeImpl)
44 { 48 {
45 return TextureLayerImpl::create(treeImpl, m_layerId).PassAs<LayerImpl>(); 49 return TextureLayerImpl::create(treeImpl, m_layerId).PassAs<LayerImpl>();
46 } 50 }
47 51
48 void TextureLayer::setFlipped(bool flipped) 52 void TextureLayer::setFlipped(bool flipped)
49 { 53 {
50 m_flipped = flipped; 54 m_flipped = flipped;
51 setNeedsCommit(); 55 setNeedsCommit();
52 } 56 }
53 57
54 void TextureLayer::setUVRect(const gfx::RectF& rect) 58 void TextureLayer::setUVRect(const gfx::RectF& rect)
55 { 59 {
56 m_uvRect = rect; 60 m_uvRect = rect;
57 setNeedsCommit(); 61 setNeedsCommit();
58 } 62 }
59 63
64 void TextureLayer::setVertexOpacity(float bottomLeft,
65 float topLeft,
66 float topRight,
67 float bottomRight) {
68 // Indexing according to the quad vertex generation:
69 // 1--2
70 // | |
71 // 0--3
72 m_vertexOpacity[0] = bottomLeft;
73 m_vertexOpacity[1] = topLeft;
74 m_vertexOpacity[2] = topRight;
75 m_vertexOpacity[3] = bottomRight;
76 setNeedsCommit();
77 }
78
60 void TextureLayer::setPremultipliedAlpha(bool premultipliedAlpha) 79 void TextureLayer::setPremultipliedAlpha(bool premultipliedAlpha)
61 { 80 {
62 m_premultipliedAlpha = premultipliedAlpha; 81 m_premultipliedAlpha = premultipliedAlpha;
63 setNeedsCommit(); 82 setNeedsCommit();
64 } 83 }
65 84
66 void TextureLayer::setRateLimitContext(bool rateLimit) 85 void TextureLayer::setRateLimitContext(bool rateLimit)
67 { 86 {
68 if (!rateLimit && m_rateLimitContext && m_client && layerTreeHost()) 87 if (!rateLimit && m_rateLimitContext && m_client && layerTreeHost())
69 layerTreeHost()->stopRateLimiter(m_client->context()); 88 layerTreeHost()->stopRateLimiter(m_client->context());
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 m_needsDisplay = false; 138 m_needsDisplay = false;
120 } 139 }
121 140
122 void TextureLayer::pushPropertiesTo(LayerImpl* layer) 141 void TextureLayer::pushPropertiesTo(LayerImpl* layer)
123 { 142 {
124 Layer::pushPropertiesTo(layer); 143 Layer::pushPropertiesTo(layer);
125 144
126 TextureLayerImpl* textureLayer = static_cast<TextureLayerImpl*>(layer); 145 TextureLayerImpl* textureLayer = static_cast<TextureLayerImpl*>(layer);
127 textureLayer->setFlipped(m_flipped); 146 textureLayer->setFlipped(m_flipped);
128 textureLayer->setUVRect(m_uvRect); 147 textureLayer->setUVRect(m_uvRect);
148 textureLayer->setVertexOpacity(m_vertexOpacity);
129 textureLayer->setPremultipliedAlpha(m_premultipliedAlpha); 149 textureLayer->setPremultipliedAlpha(m_premultipliedAlpha);
130 textureLayer->setTextureId(m_textureId); 150 textureLayer->setTextureId(m_textureId);
131 m_contentCommitted = drawsContent(); 151 m_contentCommitted = drawsContent();
132 } 152 }
133 153
134 bool TextureLayer::blocksPendingCommit() const 154 bool TextureLayer::blocksPendingCommit() const
135 { 155 {
136 // Double-buffered texture layers need to be blocked until they can be made 156 // Double-buffered texture layers need to be blocked until they can be made
137 // triple-buffered. Single-buffered layers already prevent draws, so 157 // triple-buffered. Single-buffered layers already prevent draws, so
138 // can block too for simplicity. 158 // can block too for simplicity.
139 return true; 159 return true;
140 } 160 }
141 161
142 } // namespace cc 162 } // namespace cc
OLDNEW
« no previous file with comments | « cc/texture_layer.h ('k') | cc/texture_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698