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

Side by Side Diff: trunk/src/cc/layers/texture_layer.h

Issue 19463010: Revert 212008 "cc: Remove TextureLayer::SetTextureId and Texture..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 5 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 | « no previous file | trunk/src/cc/layers/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_LAYERS_TEXTURE_LAYER_H_ 5 #ifndef CC_LAYERS_TEXTURE_LAYER_H_
6 #define CC_LAYERS_TEXTURE_LAYER_H_ 6 #define CC_LAYERS_TEXTURE_LAYER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 16 matching lines...) Expand all
27 public: 27 public:
28 // If this texture layer requires special preparation logic for each frame 28 // If this texture layer requires special preparation logic for each frame
29 // driven by the compositor, pass in a non-nil client. Pass in a nil client 29 // driven by the compositor, pass in a non-nil client. Pass in a nil client
30 // pointer if texture updates are driven by an external process. 30 // pointer if texture updates are driven by an external process.
31 static scoped_refptr<TextureLayer> Create(TextureLayerClient* client); 31 static scoped_refptr<TextureLayer> Create(TextureLayerClient* client);
32 32
33 // Used when mailbox names are specified instead of texture IDs. 33 // Used when mailbox names are specified instead of texture IDs.
34 static scoped_refptr<TextureLayer> CreateForMailbox( 34 static scoped_refptr<TextureLayer> CreateForMailbox(
35 TextureLayerClient* client); 35 TextureLayerClient* client);
36 36
37 // Resets the client, which also resets the texture. This may synchronize with
38 // the impl thread if it is currently drawing a texture or a mailbox from the
39 // client. After this call it is safe to destroy the texture / mailbox.
40 void ClearClient(); 37 void ClearClient();
41 38
42 // Resets the texture. This may synchronize with the impl thread if it is
43 // currently drawing a texture or a mailbox from the client. After this call
44 // it is safe to destroy the texture / mailbox.
45 void ClearTexture();
46
47 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) 39 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
48 OVERRIDE; 40 OVERRIDE;
49 41
50 // Sets whether this texture should be Y-flipped at draw time. Defaults to 42 // Sets whether this texture should be Y-flipped at draw time. Defaults to
51 // true. 43 // true.
52 void SetFlipped(bool flipped); 44 void SetFlipped(bool flipped);
53 45
54 // Sets a UV transform to be used at draw time. Defaults to (0, 0) and (1, 1). 46 // Sets a UV transform to be used at draw time. Defaults to (0, 0) and (1, 1).
55 void SetUV(gfx::PointF top_left, gfx::PointF bottom_right); 47 void SetUV(gfx::PointF top_left, gfx::PointF bottom_right);
56 48
(...skipping 10 matching lines...) Expand all
67 59
68 // Sets whether the texture should be blended with the background color 60 // Sets whether the texture should be blended with the background color
69 // at draw time. Defaults to false. 61 // at draw time. Defaults to false.
70 void SetBlendBackgroundColor(bool blend); 62 void SetBlendBackgroundColor(bool blend);
71 63
72 // Sets whether this context should rate limit on damage to prevent too many 64 // Sets whether this context should rate limit on damage to prevent too many
73 // frames from being queued up before the compositor gets a chance to run. 65 // frames from being queued up before the compositor gets a chance to run.
74 // Requires a non-nil client. Defaults to false. 66 // Requires a non-nil client. Defaults to false.
75 void SetRateLimitContext(bool rate_limit); 67 void SetRateLimitContext(bool rate_limit);
76 68
69 // Code path for plugins which supply their own texture ID.
70 void SetTextureId(unsigned texture_id);
71
77 // Code path for plugins which supply their own mailbox. 72 // Code path for plugins which supply their own mailbox.
78 bool uses_mailbox() const { return uses_mailbox_; } 73 bool uses_mailbox() const { return uses_mailbox_; }
79 void SetTextureMailbox(const TextureMailbox& mailbox); 74 void SetTextureMailbox(const TextureMailbox& mailbox);
80 75
76 void WillModifyTexture();
77
81 virtual void SetNeedsDisplayRect(const gfx::RectF& dirty_rect) OVERRIDE; 78 virtual void SetNeedsDisplayRect(const gfx::RectF& dirty_rect) OVERRIDE;
82 79
83 virtual void SetLayerTreeHost(LayerTreeHost* layer_tree_host) OVERRIDE; 80 virtual void SetLayerTreeHost(LayerTreeHost* layer_tree_host) OVERRIDE;
84 virtual bool DrawsContent() const OVERRIDE; 81 virtual bool DrawsContent() const OVERRIDE;
85 virtual bool Update(ResourceUpdateQueue* queue, 82 virtual bool Update(ResourceUpdateQueue* queue,
86 const OcclusionTracker* occlusion) OVERRIDE; 83 const OcclusionTracker* occlusion) OVERRIDE;
87 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; 84 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE;
88 virtual bool BlocksPendingCommit() const OVERRIDE; 85 virtual bool BlocksPendingCommit() const OVERRIDE;
89 86
90 virtual bool CanClipSelf() const OVERRIDE; 87 virtual bool CanClipSelf() const OVERRIDE;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // are only used on the main thread, or on the impl thread during commit 128 // are only used on the main thread, or on the impl thread during commit
132 // where the main thread is blocked. 129 // where the main thread is blocked.
133 const scoped_refptr<base::MessageLoopProxy> message_loop_; 130 const scoped_refptr<base::MessageLoopProxy> message_loop_;
134 unsigned internal_references_; 131 unsigned internal_references_;
135 TextureMailbox mailbox_; 132 TextureMailbox mailbox_;
136 unsigned sync_point_; 133 unsigned sync_point_;
137 bool is_lost_; 134 bool is_lost_;
138 DISALLOW_COPY_AND_ASSIGN(MailboxHolder); 135 DISALLOW_COPY_AND_ASSIGN(MailboxHolder);
139 }; 136 };
140 137
141 // Returns true if we draw content coming from the client, which implies we
142 // may need to synchronize with the impl thread when the client goes away.
143 bool DrawsClientData() const;
144
145 TextureLayerClient* client_; 138 TextureLayerClient* client_;
146 bool uses_mailbox_; 139 bool uses_mailbox_;
147 140
148 bool flipped_; 141 bool flipped_;
149 gfx::PointF uv_top_left_; 142 gfx::PointF uv_top_left_;
150 gfx::PointF uv_bottom_right_; 143 gfx::PointF uv_bottom_right_;
151 // [bottom left, top left, top right, bottom right] 144 // [bottom left, top left, top right, bottom right]
152 float vertex_opacity_[4]; 145 float vertex_opacity_[4];
153 bool premultiplied_alpha_; 146 bool premultiplied_alpha_;
154 bool blend_background_color_; 147 bool blend_background_color_;
155 bool rate_limit_context_; 148 bool rate_limit_context_;
156 bool impl_may_draw_client_data_; 149 bool content_committed_;
157 150
158 unsigned texture_id_; 151 unsigned texture_id_;
159 scoped_ptr<MailboxHolder::MainThreadReference> holder_ref_; 152 scoped_ptr<MailboxHolder::MainThreadReference> holder_ref_;
160 bool needs_set_mailbox_; 153 bool needs_set_mailbox_;
161 154
162 DISALLOW_COPY_AND_ASSIGN(TextureLayer); 155 DISALLOW_COPY_AND_ASSIGN(TextureLayer);
163 }; 156 };
164 157
165 } // namespace cc 158 } // namespace cc
166 #endif // CC_LAYERS_TEXTURE_LAYER_H_ 159 #endif // CC_LAYERS_TEXTURE_LAYER_H_
OLDNEW
« no previous file with comments | « no previous file | trunk/src/cc/layers/texture_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698