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

Side by Side Diff: ppapi/proxy/compositor_layer_resource.h

Issue 331123003: Revert 277208 "[PPAPI] Compositor API implementation." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | « ppapi/ppapi_tests.gypi ('k') | ppapi/proxy/compositor_layer_resource.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 PPAPI_PROXY_COMPOSITOR_LAYER_RESOURCE_H_ 5 #ifndef PPAPI_PROXY_COMPOSITOR_LAYER_RESOURCE_H_
6 #define PPAPI_PROXY_COMPOSITOR_LAYER_RESOURCE_H_ 6 #define PPAPI_PROXY_COMPOSITOR_LAYER_RESOURCE_H_
7 7
8 #include "ppapi/c/ppb_compositor_layer.h" 8 #include "ppapi/c/ppb_compositor_layer.h"
9 #include "ppapi/proxy/plugin_resource.h" 9 #include "ppapi/proxy/plugin_resource.h"
10 #include "ppapi/proxy/ppapi_proxy_export.h" 10 #include "ppapi/proxy/ppapi_proxy_export.h"
11 #include "ppapi/shared_impl/compositor_layer_data.h"
12 #include "ppapi/shared_impl/scoped_pp_resource.h"
13 #include "ppapi/thunk/ppb_compositor_layer_api.h" 11 #include "ppapi/thunk/ppb_compositor_layer_api.h"
14 12
15 namespace ppapi { 13 namespace ppapi {
16 namespace proxy { 14 namespace proxy {
17 15
18 class CompositorResource;
19
20 class PPAPI_PROXY_EXPORT CompositorLayerResource 16 class PPAPI_PROXY_EXPORT CompositorLayerResource
21 : public PluginResource, 17 : public PluginResource,
22 public thunk::PPB_CompositorLayer_API { 18 public thunk::PPB_CompositorLayer_API {
23 public: 19 public:
24 // Release callback for texture or image layer.
25 typedef base::Callback<void(uint32_t, bool)> ReleaseCallback;
26
27 CompositorLayerResource(Connection connection, 20 CompositorLayerResource(Connection connection,
28 PP_Instance instance, 21 PP_Instance instance);
29 const CompositorResource* compositor);
30
31 const CompositorLayerData& data() const { return data_; }
32 const ReleaseCallback& release_callback() const {
33 return release_callback_;
34 }
35 void ResetReleaseCallback() { release_callback_.Reset(); }
36 void Invalidate() { compositor_ = NULL; }
37 22
38 private: 23 private:
39 enum LayerType {
40 TYPE_COLOR,
41 TYPE_TEXTURE,
42 TYPE_IMAGE,
43 };
44
45 virtual ~CompositorLayerResource(); 24 virtual ~CompositorLayerResource();
46 25
47 // Resource overrides: 26 // Resource overrides:
48 virtual thunk::PPB_CompositorLayer_API* AsPPB_CompositorLayer_API() OVERRIDE; 27 virtual thunk::PPB_CompositorLayer_API* AsPPB_CompositorLayer_API() OVERRIDE;
49 28
50 // thunk::PPB_Compositor_API overrides: 29 // thunk::PPB_Compositor_API overrides:
51 virtual int32_t SetColor(float red, 30 virtual int32_t SetColor(float red,
52 float green, 31 float green,
53 float blue, 32 float blue,
54 float alpha, 33 float alpha,
55 const PP_Size* size) OVERRIDE; 34 const PP_Size* size) OVERRIDE;
56 virtual int32_t SetTexture( 35 virtual int32_t SetTexture(
57 PP_Resource context, 36 PP_Resource context,
58 uint32_t texture, 37 uint32_t texture,
59 const PP_Size* size, 38 const PP_Size* size,
60 const scoped_refptr<TrackedCallback>& callback) OVERRIDE; 39 const scoped_refptr<ppapi::TrackedCallback>& callback) OVERRIDE;
61 virtual int32_t SetImage( 40 virtual int32_t SetImage(
62 PP_Resource image_data, 41 PP_Resource image_data,
63 const PP_Size* size, 42 const PP_Size* size,
64 const scoped_refptr<TrackedCallback>& callback) OVERRIDE; 43 const scoped_refptr<ppapi::TrackedCallback>& callback) OVERRIDE;
65 virtual int32_t SetClipRect(const PP_Rect* rect) OVERRIDE; 44 virtual int32_t SetClipRect(const PP_Rect* rect) OVERRIDE;
66 virtual int32_t SetTransform(const float matrix[16]) OVERRIDE; 45 virtual int32_t SetTransform(const float matrix[16]) OVERRIDE;
67 virtual int32_t SetOpacity(float opacity) OVERRIDE; 46 virtual int32_t SetOpacity(float opacity) OVERRIDE;
68 virtual int32_t SetBlendMode(PP_BlendMode mode) OVERRIDE; 47 virtual int32_t SetBlendMode(PP_BlendMode mode) OVERRIDE;
69 virtual int32_t SetSourceRect(const PP_FloatRect* rect) OVERRIDE; 48 virtual int32_t SetSourceRect(const PP_FloatRect* rect) OVERRIDE;
70 virtual int32_t SetPremultipliedAlpha(PP_Bool premult) OVERRIDE; 49 virtual int32_t SetPremultipliedAlpha(PP_Bool premult) OVERRIDE;
71 50
72 bool SetType(LayerType type);
73 int32_t CheckForSetTextureAndImage(
74 LayerType type,
75 const scoped_refptr<TrackedCallback>& release_callback);
76
77 // The CompositorResource which own the layer. The layer is invalidated if
78 // compositor_ is NULL.
79 const CompositorResource* compositor_;
80
81 // Release callback for uncommitted texture or image. When CommitLayers() on
82 // the compositor_ is called, the callback will be copied into a map in the
83 // compositor_, and it will be reset to NULL.
84 ReleaseCallback release_callback_;
85
86 // Size of texture or image. It is used to verify the rect arg of
87 // SetSourceRect().
88 PP_FloatSize source_size_;
89
90 // Layer data.
91 CompositorLayerData data_;
92
93 DISALLOW_COPY_AND_ASSIGN(CompositorLayerResource); 51 DISALLOW_COPY_AND_ASSIGN(CompositorLayerResource);
94 }; 52 };
95 53
96 } // namespace proxy 54 } // namespace proxy
97 } // namespace ppapi 55 } // namespace ppapi
98 56
99 #endif // PPAPI_PROXY_COMPOSITOR_LAYER_RESOURCE_H_ 57 #endif // PPAPI_PROXY_COMPOSITOR_LAYER_RESOURCE_H_
OLDNEW
« no previous file with comments | « ppapi/ppapi_tests.gypi ('k') | ppapi/proxy/compositor_layer_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698