Chromium Code Reviews

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

Issue 298023004: [PPAPI] Compositor API implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@compositor_api_def_new
Patch Set: Fix review issues Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 #include "ppapi/proxy/compositor_layer_resource.h" 5 #include "ppapi/proxy/compositor_layer_resource.h"
6 6
7 namespace ppapi { 7 namespace ppapi {
8 namespace proxy { 8 namespace proxy {
9 9
10 CompositorLayerResource::CompositorLayerResource(Connection connection, 10 CompositorLayerResource::CompositorLayerResource(
11 PP_Instance instance) 11 Connection connection,
12 : PluginResource(connection, instance) { 12 PP_Instance instance,
13 base::WeakPtr<CompositorResource::LayerImpl> impl)
14 : PluginResource(connection, instance),
15 impl_(impl) {
13 } 16 }
14 17
15 CompositorLayerResource::~CompositorLayerResource() { 18 CompositorLayerResource::~CompositorLayerResource() {
16 } 19 }
17 20
18 thunk::PPB_CompositorLayer_API* 21 thunk::PPB_CompositorLayer_API*
19 CompositorLayerResource::AsPPB_CompositorLayer_API() { 22 CompositorLayerResource::AsPPB_CompositorLayer_API() {
20 return this; 23 return this;
21 } 24 }
22 25
23 int32_t CompositorLayerResource::SetColor(uint8_t red, 26 int32_t CompositorLayerResource::SetColor(uint8_t red,
24 uint8_t green, 27 uint8_t green,
25 uint8_t blue, 28 uint8_t blue,
26 uint8_t alpha, 29 uint8_t alpha,
27 const struct PP_Size* size) { 30 const struct PP_Size* size) {
28 return PP_ERROR_NOTSUPPORTED; 31 if (!impl_)
32 return PP_ERROR_BADARGUMENT;
33 return impl_->SetColor(red, green, blue, alpha, size);
29 } 34 }
30 35
31 int32_t CompositorLayerResource::SetTexture( 36 int32_t CompositorLayerResource::SetTexture(
32 PP_Resource context, 37 PP_Resource context,
33 uint32_t texture, 38 uint32_t texture,
34 const struct PP_Size* size, 39 const struct PP_Size* size,
35 const scoped_refptr<ppapi::TrackedCallback>& callback) { 40 const scoped_refptr<ppapi::TrackedCallback>& callback) {
36 return PP_ERROR_NOTSUPPORTED; 41 if (!impl_)
42 return PP_ERROR_BADARGUMENT;
43 return impl_->SetTexture(context, texture, size, callback);
37 } 44 }
38 45
39 int32_t CompositorLayerResource::SetImage( 46 int32_t CompositorLayerResource::SetImage(
40 PP_Resource image_data, 47 PP_Resource image_data,
41 const struct PP_Size* size, 48 const struct PP_Size* size,
42 const scoped_refptr<ppapi::TrackedCallback>& callback) { 49 const scoped_refptr<ppapi::TrackedCallback>& callback) {
43 return PP_ERROR_NOTSUPPORTED; 50 if (!impl_)
51 return PP_ERROR_BADARGUMENT;
52 return impl_->SetImage(image_data, size, callback);
44 } 53 }
45 54
46 int32_t CompositorLayerResource::SetClipRect(const struct PP_Rect* rect) { 55 int32_t CompositorLayerResource::SetClipRect(const struct PP_Rect* rect) {
47 return PP_ERROR_NOTSUPPORTED; 56 if (!impl_)
57 return PP_ERROR_BADARGUMENT;
58 return impl_->SetClipRect(rect);
48 } 59 }
49 60
50 int32_t CompositorLayerResource::SetTransform(const float matrix[16]) { 61 int32_t CompositorLayerResource::SetTransform(const float matrix[16]) {
51 return PP_ERROR_NOTSUPPORTED; 62 if (!impl_)
63 return PP_ERROR_BADARGUMENT;
64 return impl_->SetTransform(matrix);
52 } 65 }
53 66
54 int32_t CompositorLayerResource::SetOpacity(uint8_t opacity) { 67 int32_t CompositorLayerResource::SetOpacity(uint8_t opacity) {
55 return PP_ERROR_NOTSUPPORTED; 68 if (!impl_)
69 return PP_ERROR_BADARGUMENT;
70 return impl_->SetOpacity(opacity);
56 } 71 }
57 72
58 int32_t CompositorLayerResource::SetBlendMode(PP_BlendMode mode) { 73 int32_t CompositorLayerResource::SetBlendMode(PP_BlendMode mode) {
59 return PP_ERROR_NOTSUPPORTED; 74 if (!impl_)
75 return PP_ERROR_BADARGUMENT;
76 return impl_->SetBlendMode(mode);
60 } 77 }
61 78
62 int32_t CompositorLayerResource::SetSourceRect( 79 int32_t CompositorLayerResource::SetSourceRect(
63 const struct PP_FloatRect* rect) { 80 const struct PP_FloatRect* rect) {
64 return PP_ERROR_NOTSUPPORTED; 81 if (!impl_)
82 return PP_ERROR_BADARGUMENT;
83 return impl_->SetSourceRect(rect);
65 } 84 }
66 85
67 int32_t CompositorLayerResource::SetPremultipliedAlpha(PP_Bool premult) { 86 int32_t CompositorLayerResource::SetPremultipliedAlpha(PP_Bool premult) {
68 return PP_ERROR_NOTSUPPORTED; 87 if (!impl_)
88 return PP_ERROR_BADARGUMENT;
89 return impl_->SetPremultipliedAlpha(premult);
69 } 90 }
70 91
71 } // namespace proxy 92 } // namespace proxy
72 } // namespace ppapi 93 } // namespace ppapi
OLDNEW

Powered by Google App Engine