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

Side by Side Diff: cc/texture_layer.h

Issue 11638028: Mailbox support for texture layers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Formatting 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
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 #ifndef CC_TEXTURE_LAYER_H_ 5 #ifndef CC_TEXTURE_LAYER_H_
6 #define CC_TEXTURE_LAYER_H_ 6 #define CC_TEXTURE_LAYER_H_
7 7
8 #include <string>
9
10 #include "base/callback.h"
8 #include "cc/cc_export.h" 11 #include "cc/cc_export.h"
9 #include "cc/layer.h" 12 #include "cc/layer.h"
10 13
11 namespace WebKit { 14 namespace WebKit {
12 class WebGraphicsContext3D; 15 class WebGraphicsContext3D;
13 } 16 }
14 17
15 namespace cc { 18 namespace cc {
16 19
17 class TextureLayerClient; 20 class TextureLayerClient;
18 21
19 // A Layer containing a the rendered output of a plugin instance. 22 // A Layer containing a the rendered output of a plugin instance.
20 class CC_EXPORT TextureLayer : public Layer { 23 class CC_EXPORT TextureLayer : public Layer {
21 public: 24 public:
22 // If this texture layer requires special preparation logic for each frame d riven by 25 // If this texture layer requires special preparation logic for each frame d riven by
23 // the compositor, pass in a non-nil client. Pass in a nil client pointer if texture updates 26 // the compositor, pass in a non-nil client. Pass in a nil client pointer if texture updates
24 // are driven by an external process. 27 // are driven by an external process.
25 static scoped_refptr<TextureLayer> create(TextureLayerClient*); 28 static scoped_refptr<TextureLayer> create(TextureLayerClient*);
26 29
30 // Used when mailbox names are specified instead of texture id's
danakj 2013/01/02 16:17:22 nit: "IDs"
31 static scoped_refptr<TextureLayer> createMailboxLayer();
danakj 2013/01/02 16:17:22 nit: createForMailbox? "MailboxLayer" sounds like
32
27 void clearClient() { m_client = 0; } 33 void clearClient() { m_client = 0; }
28 34
29 virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl) OVERR IDE; 35 virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl) OVERR IDE;
30 36
31 // Sets whether this texture should be Y-flipped at draw time. Defaults to t rue. 37 // Sets whether this texture should be Y-flipped at draw time. Defaults to t rue.
32 void setFlipped(bool); 38 void setFlipped(bool);
33 39
34 // Sets a UV transform to be used at draw time. Defaults to (0, 0, 1, 1). 40 // Sets a UV transform to be used at draw time. Defaults to (0, 0, 1, 1).
35 void setUVRect(const gfx::RectF&); 41 void setUVRect(const gfx::RectF&);
36 42
37 // Sets an opacity value per vertex. It will be multiplied by the layer opac ity value. 43 // Sets an opacity value per vertex. It will be multiplied by the layer opac ity value.
38 void setVertexOpacity(float bottomLeft, float topLeft, float topRight, float bottomRight); 44 void setVertexOpacity(float bottomLeft, float topLeft, float topRight, float bottomRight);
39 45
40 // Sets whether the alpha channel is premultiplied or unpremultiplied. Defau lts to true. 46 // Sets whether the alpha channel is premultiplied or unpremultiplied. Defau lts to true.
41 void setPremultipliedAlpha(bool); 47 void setPremultipliedAlpha(bool);
42 48
43 // Sets whether this context should rate limit on damage to prevent too many frames from 49 // Sets whether this context should rate limit on damage to prevent too many frames from
44 // being queued up before the compositor gets a chance to run. Requires a no n-nil client. 50 // being queued up before the compositor gets a chance to run. Requires a no n-nil client.
45 // Defaults to false. 51 // Defaults to false.
46 void setRateLimitContext(bool); 52 void setRateLimitContext(bool);
47 53
48 // Code path for plugins which supply their own texture ID. 54 // Code path for plugins which supply their own texture ID.
49 void setTextureId(unsigned); 55 void setTextureId(unsigned);
50 56
57 // Code path for plugins which supply their own texture ID.
58 void setTextureMailbox(const std::string&,
59 const base::Callback<void(unsigned)>&);
60
51 void willModifyTexture(); 61 void willModifyTexture();
52 62
53 virtual void setNeedsDisplayRect(const gfx::RectF&) OVERRIDE; 63 virtual void setNeedsDisplayRect(const gfx::RectF&) OVERRIDE;
54 64
55 virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE; 65 virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE;
56 virtual bool drawsContent() const OVERRIDE; 66 virtual bool drawsContent() const OVERRIDE;
57 virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, Rendering Stats&) OVERRIDE; 67 virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, Rendering Stats&) OVERRIDE;
58 virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; 68 virtual void pushPropertiesTo(LayerImpl*) OVERRIDE;
59 virtual bool blocksPendingCommit() const OVERRIDE; 69 virtual bool blocksPendingCommit() const OVERRIDE;
60 70
61 protected: 71 protected:
62 explicit TextureLayer(TextureLayerClient*); 72 TextureLayer(TextureLayerClient*, bool mailboxLayer);
danakj 2013/01/02 16:17:22 nit: "usesMailbox"?
63 virtual ~TextureLayer(); 73 virtual ~TextureLayer();
64 74
65 private: 75 private:
66 TextureLayerClient* m_client; 76 TextureLayerClient* m_client;
77 bool m_mailboxLayer;
78 base::Callback<void(unsigned)> m_mailboxReleaseCallback;
67 79
68 bool m_flipped; 80 bool m_flipped;
69 gfx::RectF m_uvRect; 81 gfx::RectF m_uvRect;
70 // [bottom left, top left, top right, bottom right] 82 // [bottom left, top left, top right, bottom right]
71 float m_vertexOpacity[4]; 83 float m_vertexOpacity[4];
72 bool m_premultipliedAlpha; 84 bool m_premultipliedAlpha;
73 bool m_rateLimitContext; 85 bool m_rateLimitContext;
74 bool m_contextLost; 86 bool m_contextLost;
75 bool m_contentCommitted; 87 bool m_contentCommitted;
76 88
77 unsigned m_textureId; 89 unsigned m_textureId;
90 std::string m_mailboxName;
78 }; 91 };
79 92
80 } 93 }
81 #endif // CC_TEXTURE_LAYER_H_ 94 #endif // CC_TEXTURE_LAYER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698