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

Side by Side Diff: cc/texture_layer.cc

Issue 11783094: cc: Add point-based UV coordinate on TextureLayer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed unittest and abreviations Created 7 years, 11 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 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 19 matching lines...) Expand all
30 scoped_refptr<TextureLayer> TextureLayer::createForMailbox() 30 scoped_refptr<TextureLayer> TextureLayer::createForMailbox()
31 { 31 {
32 return scoped_refptr<TextureLayer>(new TextureLayer(0, true)); 32 return scoped_refptr<TextureLayer>(new TextureLayer(0, true));
33 } 33 }
34 34
35 TextureLayer::TextureLayer(TextureLayerClient* client, bool usesMailbox) 35 TextureLayer::TextureLayer(TextureLayerClient* client, bool usesMailbox)
36 : Layer() 36 : Layer()
37 , m_client(client) 37 , m_client(client)
38 , m_usesMailbox(usesMailbox) 38 , m_usesMailbox(usesMailbox)
39 , m_flipped(true) 39 , m_flipped(true)
40 , m_uvRect(0, 0, 1, 1) 40 , m_uvTopLeft(0, 0)
danakj 2013/01/11 02:21:51 can you make these 0.f and 1.f while you're here?
Jerome 2013/01/11 18:00:01 Done.
41 , m_uvBottomRight(1, 1)
41 , m_premultipliedAlpha(true) 42 , m_premultipliedAlpha(true)
42 , m_rateLimitContext(false) 43 , m_rateLimitContext(false)
43 , m_contextLost(false) 44 , m_contextLost(false)
44 , m_textureId(0) 45 , m_textureId(0)
45 , m_contentCommitted(false) 46 , m_contentCommitted(false)
46 { 47 {
47 m_vertexOpacity[0] = 1.0f; 48 m_vertexOpacity[0] = 1.0f;
48 m_vertexOpacity[1] = 1.0f; 49 m_vertexOpacity[1] = 1.0f;
49 m_vertexOpacity[2] = 1.0f; 50 m_vertexOpacity[2] = 1.0f;
50 m_vertexOpacity[3] = 1.0f; 51 m_vertexOpacity[3] = 1.0f;
(...skipping 15 matching lines...) Expand all
66 { 67 {
67 return TextureLayerImpl::create(treeImpl, m_layerId, m_usesMailbox).PassAs<L ayerImpl>(); 68 return TextureLayerImpl::create(treeImpl, m_layerId, m_usesMailbox).PassAs<L ayerImpl>();
68 } 69 }
69 70
70 void TextureLayer::setFlipped(bool flipped) 71 void TextureLayer::setFlipped(bool flipped)
71 { 72 {
72 m_flipped = flipped; 73 m_flipped = flipped;
73 setNeedsCommit(); 74 setNeedsCommit();
74 } 75 }
75 76
76 void TextureLayer::setUVRect(const gfx::RectF& rect) 77 void TextureLayer::setUV(const gfx::PointF& topLeft, const gfx::PointF& bottomRi ght)
77 { 78 {
78 m_uvRect = rect; 79 m_uvTopLeft = topLeft;
80 m_uvBottomRight = bottomRight;
79 setNeedsCommit(); 81 setNeedsCommit();
80 } 82 }
81 83
82 void TextureLayer::setVertexOpacity(float bottomLeft, 84 void TextureLayer::setVertexOpacity(float bottomLeft,
83 float topLeft, 85 float topLeft,
84 float topRight, 86 float topRight,
85 float bottomRight) { 87 float bottomRight) {
86 // Indexing according to the quad vertex generation: 88 // Indexing according to the quad vertex generation:
87 // 1--2 89 // 1--2
88 // | | 90 // | |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 173
172 m_needsDisplay = false; 174 m_needsDisplay = false;
173 } 175 }
174 176
175 void TextureLayer::pushPropertiesTo(LayerImpl* layer) 177 void TextureLayer::pushPropertiesTo(LayerImpl* layer)
176 { 178 {
177 Layer::pushPropertiesTo(layer); 179 Layer::pushPropertiesTo(layer);
178 180
179 TextureLayerImpl* textureLayer = static_cast<TextureLayerImpl*>(layer); 181 TextureLayerImpl* textureLayer = static_cast<TextureLayerImpl*>(layer);
180 textureLayer->setFlipped(m_flipped); 182 textureLayer->setFlipped(m_flipped);
181 textureLayer->setUVRect(m_uvRect); 183 textureLayer->setUVTopLeft(m_uvTopLeft);
184 textureLayer->setUVBottomRight(m_uvBottomRight);
182 textureLayer->setVertexOpacity(m_vertexOpacity); 185 textureLayer->setVertexOpacity(m_vertexOpacity);
183 textureLayer->setPremultipliedAlpha(m_premultipliedAlpha); 186 textureLayer->setPremultipliedAlpha(m_premultipliedAlpha);
184 if (m_usesMailbox) { 187 if (m_usesMailbox) {
185 Thread* mainThread = layerTreeHost()->proxy()->mainThread(); 188 Thread* mainThread = layerTreeHost()->proxy()->mainThread();
186 textureLayer->setTextureMailbox(m_mailboxName, base::Bind(&postCallbackT oMainThread, mainThread, m_mailboxReleaseCallback)); 189 textureLayer->setTextureMailbox(m_mailboxName, base::Bind(&postCallbackT oMainThread, mainThread, m_mailboxReleaseCallback));
187 } else { 190 } else {
188 textureLayer->setTextureId(m_textureId); 191 textureLayer->setTextureId(m_textureId);
189 } 192 }
190 m_contentCommitted = drawsContent(); 193 m_contentCommitted = drawsContent();
191 } 194 }
192 195
193 bool TextureLayer::blocksPendingCommit() const 196 bool TextureLayer::blocksPendingCommit() const
194 { 197 {
195 // Double-buffered texture layers need to be blocked until they can be made 198 // Double-buffered texture layers need to be blocked until they can be made
196 // triple-buffered. Single-buffered layers already prevent draws, so 199 // triple-buffered. Single-buffered layers already prevent draws, so
197 // can block too for simplicity. 200 // can block too for simplicity.
198 return true; 201 return true;
199 } 202 }
200 203
201 } // namespace cc 204 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698