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

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: 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
8 #include "cc/cc_export.h" 10 #include "cc/cc_export.h"
9 #include "cc/layer.h" 11 #include "cc/layer.h"
10 12
11 namespace WebKit { 13 namespace WebKit {
12 class WebGraphicsContext3D; 14 class WebGraphicsContext3D;
13 } 15 }
14 16
15 namespace cc { 17 namespace cc {
16 18
17 class TextureLayerClient; 19 class TextureLayerClient;
20 class MailboxReleaseClient;
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
31 static scoped_refptr<TextureLayer> createWithMailboxClient(MailboxReleaseCli ent*);
danakj 2012/12/20 02:16:19 Instead of using a client, can we use a base::bind
alexst (slow to review) 2012/12/21 14:15:21 I was thinking of trying this approach myself. New
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
51 void willModifyTexture(); 60 void willModifyTexture();
52 61
53 virtual void setNeedsDisplayRect(const gfx::RectF&) OVERRIDE; 62 virtual void setNeedsDisplayRect(const gfx::RectF&) OVERRIDE;
54 63
55 virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE; 64 virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE;
56 virtual bool drawsContent() const OVERRIDE; 65 virtual bool drawsContent() const OVERRIDE;
57 virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, Rendering Stats&) OVERRIDE; 66 virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, Rendering Stats&) OVERRIDE;
58 virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; 67 virtual void pushPropertiesTo(LayerImpl*) OVERRIDE;
59 virtual bool blocksPendingCommit() const OVERRIDE; 68 virtual bool blocksPendingCommit() const OVERRIDE;
60 69
61 protected: 70 protected:
62 explicit TextureLayer(TextureLayerClient*); 71 TextureLayer(TextureLayerClient*, MailboxReleaseClient*);
63 virtual ~TextureLayer(); 72 virtual ~TextureLayer();
64 73
65 private: 74 private:
66 TextureLayerClient* m_client; 75 TextureLayerClient* m_client;
76 MailboxReleaseClient* m_mailboxClient;
67 77
68 bool m_flipped; 78 bool m_flipped;
69 gfx::RectF m_uvRect; 79 gfx::RectF m_uvRect;
70 // [bottom left, top left, top right, bottom right] 80 // [bottom left, top left, top right, bottom right]
71 float m_vertexOpacity[4]; 81 float m_vertexOpacity[4];
72 bool m_premultipliedAlpha; 82 bool m_premultipliedAlpha;
73 bool m_rateLimitContext; 83 bool m_rateLimitContext;
74 bool m_contextLost; 84 bool m_contextLost;
75 bool m_contentCommitted; 85 bool m_contentCommitted;
76 86
77 unsigned m_textureId; 87 unsigned m_textureId;
88 std::string m_mailboxName;
78 }; 89 };
79 90
80 } 91 }
81 #endif // CC_TEXTURE_LAYER_H_ 92 #endif // CC_TEXTURE_LAYER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698