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

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: Comments 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
« no previous file with comments | « cc/resource_provider.cc ('k') | cc/texture_layer.cc » ('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 #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:
25 typedef base::Callback<void(unsigned)> MailboxCallback;
26
22 // If this texture layer requires special preparation logic for each frame d riven by 27 // 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 28 // the compositor, pass in a non-nil client. Pass in a nil client pointer if texture updates
24 // are driven by an external process. 29 // are driven by an external process.
25 static scoped_refptr<TextureLayer> create(TextureLayerClient*); 30 static scoped_refptr<TextureLayer> create(TextureLayerClient*);
26 31
32 // Used when mailbox names are specified instead of texture IDs.
33 static scoped_refptr<TextureLayer> createForMailbox();
34
27 void clearClient() { m_client = 0; } 35 void clearClient() { m_client = 0; }
28 36
29 virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl) OVERR IDE; 37 virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl) OVERR IDE;
30 38
31 // Sets whether this texture should be Y-flipped at draw time. Defaults to t rue. 39 // Sets whether this texture should be Y-flipped at draw time. Defaults to t rue.
32 void setFlipped(bool); 40 void setFlipped(bool);
33 41
34 // Sets a UV transform to be used at draw time. Defaults to (0, 0, 1, 1). 42 // Sets a UV transform to be used at draw time. Defaults to (0, 0, 1, 1).
35 void setUVRect(const gfx::RectF&); 43 void setUVRect(const gfx::RectF&);
36 44
37 // Sets an opacity value per vertex. It will be multiplied by the layer opac ity value. 45 // 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); 46 void setVertexOpacity(float bottomLeft, float topLeft, float topRight, float bottomRight);
39 47
40 // Sets whether the alpha channel is premultiplied or unpremultiplied. Defau lts to true. 48 // Sets whether the alpha channel is premultiplied or unpremultiplied. Defau lts to true.
41 void setPremultipliedAlpha(bool); 49 void setPremultipliedAlpha(bool);
42 50
43 // Sets whether this context should rate limit on damage to prevent too many frames from 51 // 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. 52 // being queued up before the compositor gets a chance to run. Requires a no n-nil client.
45 // Defaults to false. 53 // Defaults to false.
46 void setRateLimitContext(bool); 54 void setRateLimitContext(bool);
47 55
48 // Code path for plugins which supply their own texture ID. 56 // Code path for plugins which supply their own texture ID.
49 void setTextureId(unsigned); 57 void setTextureId(unsigned);
50 58
59 // Code path for plugins which supply their own texture ID.
60 void setTextureMailbox(const std::string&, const MailboxCallback&);
61
51 void willModifyTexture(); 62 void willModifyTexture();
52 63
53 virtual void setNeedsDisplayRect(const gfx::RectF&) OVERRIDE; 64 virtual void setNeedsDisplayRect(const gfx::RectF&) OVERRIDE;
54 65
55 virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE; 66 virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE;
56 virtual bool drawsContent() const OVERRIDE; 67 virtual bool drawsContent() const OVERRIDE;
57 virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, Rendering Stats&) OVERRIDE; 68 virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, Rendering Stats&) OVERRIDE;
58 virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; 69 virtual void pushPropertiesTo(LayerImpl*) OVERRIDE;
59 virtual bool blocksPendingCommit() const OVERRIDE; 70 virtual bool blocksPendingCommit() const OVERRIDE;
60 71
61 protected: 72 protected:
62 explicit TextureLayer(TextureLayerClient*); 73 TextureLayer(TextureLayerClient*, bool usesMailbox);
63 virtual ~TextureLayer(); 74 virtual ~TextureLayer();
64 75
65 private: 76 private:
66 TextureLayerClient* m_client; 77 TextureLayerClient* m_client;
78 bool m_usesMailbox;
79 MailboxCallback m_mailboxReleaseCallback;
67 80
68 bool m_flipped; 81 bool m_flipped;
69 gfx::RectF m_uvRect; 82 gfx::RectF m_uvRect;
70 // [bottom left, top left, top right, bottom right] 83 // [bottom left, top left, top right, bottom right]
71 float m_vertexOpacity[4]; 84 float m_vertexOpacity[4];
72 bool m_premultipliedAlpha; 85 bool m_premultipliedAlpha;
73 bool m_rateLimitContext; 86 bool m_rateLimitContext;
74 bool m_contextLost; 87 bool m_contextLost;
75 bool m_contentCommitted; 88 bool m_contentCommitted;
76 89
77 unsigned m_textureId; 90 unsigned m_textureId;
91 std::string m_mailboxName;
78 }; 92 };
79 93
80 } 94 }
81 #endif // CC_TEXTURE_LAYER_H_ 95 #endif // CC_TEXTURE_LAYER_H_
OLDNEW
« no previous file with comments | « cc/resource_provider.cc ('k') | cc/texture_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698