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

Side by Side Diff: cc/texture_layer.h

Issue 12603013: Part 10 of cc/ directory shuffles: layers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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/test/tiled_layer_test_common.h ('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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CC_TEXTURE_LAYER_H_
6 #define CC_TEXTURE_LAYER_H_
7
8 #include <string>
9
10 #include "base/callback.h"
11 #include "cc/base/cc_export.h"
12 #include "cc/layer.h"
13 #include "cc/resources/texture_mailbox.h"
14
15 namespace WebKit { class WebGraphicsContext3D; }
16
17 namespace cc {
18
19 class TextureLayerClient;
20
21 // A Layer containing a the rendered output of a plugin instance.
22 class CC_EXPORT TextureLayer : public Layer {
23 public:
24 // If this texture layer requires special preparation logic for each frame
25 // driven by the compositor, pass in a non-nil client. Pass in a nil client
26 // pointer if texture updates are driven by an external process.
27 static scoped_refptr<TextureLayer> Create(TextureLayerClient* client);
28
29 // Used when mailbox names are specified instead of texture IDs.
30 static scoped_refptr<TextureLayer> CreateForMailbox();
31
32 void ClearClient() { client_ = NULL; }
33
34 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
35 OVERRIDE;
36
37 // Sets whether this texture should be Y-flipped at draw time. Defaults to
38 // true.
39 void SetFlipped(bool flipped);
40
41 // Sets a UV transform to be used at draw time. Defaults to (0, 0) and (1, 1).
42 void SetUV(gfx::PointF top_left, gfx::PointF bottom_right);
43
44 // Sets an opacity value per vertex. It will be multiplied by the layer
45 // opacity value.
46 void SetVertexOpacity(float bottom_left,
47 float top_left,
48 float top_right,
49 float bottom_right);
50
51 // Sets whether the alpha channel is premultiplied or unpremultiplied.
52 // Defaults to true.
53 void SetPremultipliedAlpha(bool premultiplied_alpha);
54
55 // Sets whether this context should rate limit on damage to prevent too many
56 // frames from being queued up before the compositor gets a chance to run.
57 // Requires a non-nil client. Defaults to false.
58 void SetRateLimitContext(bool rate_limit);
59
60 // Code path for plugins which supply their own texture ID.
61 void SetTextureId(unsigned texture_id);
62
63 // Code path for plugins which supply their own mailbox.
64 void SetTextureMailbox(const TextureMailbox& mailbox);
65
66 void WillModifyTexture();
67
68 virtual void SetNeedsDisplayRect(const gfx::RectF& dirty_rect) OVERRIDE;
69
70 virtual void SetLayerTreeHost(LayerTreeHost* layer_tree_host) OVERRIDE;
71 virtual bool DrawsContent() const OVERRIDE;
72 virtual void Update(ResourceUpdateQueue* queue,
73 const OcclusionTracker* occlusion,
74 RenderingStats* stats) OVERRIDE;
75 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE;
76 virtual bool BlocksPendingCommit() const OVERRIDE;
77
78 virtual bool CanClipSelf() const OVERRIDE;
79
80 protected:
81 TextureLayer(TextureLayerClient* client, bool uses_mailbox);
82 virtual ~TextureLayer();
83
84 private:
85 TextureLayerClient* client_;
86 bool uses_mailbox_;
87
88 bool flipped_;
89 gfx::PointF uv_top_left_;
90 gfx::PointF uv_bottom_right_;
91 // [bottom left, top left, top right, bottom right]
92 float vertex_opacity_[4];
93 bool premultiplied_alpha_;
94 bool rate_limit_context_;
95 bool context_lost_;
96 bool content_committed_;
97
98 unsigned texture_id_;
99 TextureMailbox texture_mailbox_;
100 bool own_mailbox_;
101
102 DISALLOW_COPY_AND_ASSIGN(TextureLayer);
103 };
104
105 }
106 #endif // CC_TEXTURE_LAYER_H_
OLDNEW
« no previous file with comments | « cc/test/tiled_layer_test_common.h ('k') | cc/texture_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698