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

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: Update 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
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 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "gpu/command_buffer/client/gles2_implementation.h" 10 #include "gpu/command_buffer/client/gles2_implementation.h"
11 #include "gpu/command_buffer/common/mailbox.h" 11 #include "gpu/command_buffer/common/mailbox.h"
12 #include "ppapi/proxy/ppapi_messages.h" 12 #include "ppapi/proxy/ppapi_messages.h"
13 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" 13 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h"
14 #include "ppapi/shared_impl/var.h" 14 #include "ppapi/shared_impl/var.h"
15 #include "ppapi/thunk/enter.h" 15 #include "ppapi/thunk/enter.h"
16 #include "ppapi/thunk/ppb_graphics_3d_api.h" 16 #include "ppapi/thunk/ppb_graphics_3d_api.h"
17 17
18 using ppapi::thunk::EnterResourceNoLock; 18 using ppapi::thunk::EnterResourceNoLock;
19 using ppapi::thunk::PPB_Graphics3D_API; 19 using ppapi::thunk::PPB_Graphics3D_API;
20 20
21 namespace ppapi { 21 namespace ppapi {
22 namespace proxy { 22 namespace proxy {
23 23
24 CompositorLayerResource::CompositorLayerResource(Connection connection, 24 CompositorLayerResource::CompositorLayerResource(
25 PP_Instance instance) 25 Connection connection,
26 : PluginResource(connection, instance) { 26 PP_Instance instance,
27 base::WeakPtr<CompositorResource::Layer> layer)
28 : PluginResource(connection, instance),
29 layer_(layer) {
27 } 30 }
28 31
29 CompositorLayerResource::~CompositorLayerResource() { 32 CompositorLayerResource::~CompositorLayerResource() {
30 } 33 }
31 34
32 thunk::PPB_CompositorLayer_API* 35 thunk::PPB_CompositorLayer_API*
33 CompositorLayerResource::AsPPB_CompositorLayer_API() { 36 CompositorLayerResource::AsPPB_CompositorLayer_API() {
34 return this; 37 return this;
35 } 38 }
36 39
37 int32_t CompositorLayerResource::SetColor(uint8_t red, 40 int32_t CompositorLayerResource::SetColor(uint8_t red,
38 uint8_t green, 41 uint8_t green,
39 uint8_t blue, 42 uint8_t blue,
40 uint8_t alpha, 43 uint8_t alpha,
41 const struct PP_Size* size) { 44 const struct PP_Size* size) {
42 return PP_ERROR_NOTSUPPORTED; 45 if (!layer_)
46 return PP_ERROR_BADARGUMENT;
47 return layer_->SetColor(red, green, blue, alpha, size);
43 } 48 }
44 49
45 int32_t CompositorLayerResource::SetTexture( 50 int32_t CompositorLayerResource::SetTexture(
46 PP_Resource context, 51 PP_Resource context,
47 uint32_t texture, 52 uint32_t texture,
48 const struct PP_Size* size, 53 const struct PP_Size* size,
49 const scoped_refptr<ppapi::TrackedCallback>& callback) { 54 const scoped_refptr<ppapi::TrackedCallback>& callback) {
50 return PP_ERROR_NOTSUPPORTED; 55 if (!layer_)
56 return PP_ERROR_BADARGUMENT;
57 return layer_->SetTexture(context, texture, size, callback);
51 } 58 }
52 59
53 int32_t CompositorLayerResource::SetImage( 60 int32_t CompositorLayerResource::SetImage(
54 PP_Resource image_data, 61 PP_Resource image_data,
55 const struct PP_Size* size, 62 const struct PP_Size* size,
56 const scoped_refptr<ppapi::TrackedCallback>& callback) { 63 const scoped_refptr<ppapi::TrackedCallback>& callback) {
57 return PP_ERROR_NOTSUPPORTED; 64 if (!layer_)
65 return PP_ERROR_BADARGUMENT;
66 return layer_->SetImage(image_data, size, callback);
58 } 67 }
59 68
60 int32_t CompositorLayerResource::SetClipRect(const struct PP_Rect* rect) { 69 int32_t CompositorLayerResource::SetClipRect(const struct PP_Rect* rect) {
61 return PP_ERROR_NOTSUPPORTED; 70 if (!layer_)
71 return PP_ERROR_BADARGUMENT;
72 return layer_->SetClipRect(rect);
62 } 73 }
63 74
64 int32_t CompositorLayerResource::SetTransform(const float matrix[16]) { 75 int32_t CompositorLayerResource::SetTransform(const float matrix[16]) {
65 return PP_ERROR_NOTSUPPORTED; 76 if (!layer_)
77 return PP_ERROR_BADARGUMENT;
78 return layer_->SetTransform(matrix);
66 } 79 }
67 80
68 int32_t CompositorLayerResource::SetOpacity(uint8_t opacity) { 81 int32_t CompositorLayerResource::SetOpacity(uint8_t opacity) {
69 return PP_ERROR_NOTSUPPORTED; 82 if (!layer_)
83 return PP_ERROR_BADARGUMENT;
84 return layer_->SetOpacity(opacity);
70 } 85 }
71 86
72 int32_t CompositorLayerResource::SetBlendMode(PP_BlendMode mode) { 87 int32_t CompositorLayerResource::SetBlendMode(PP_BlendMode mode) {
73 return PP_ERROR_NOTSUPPORTED; 88 if (!layer_)
89 return PP_ERROR_BADARGUMENT;
90 return layer_->SetBlendMode(mode);
74 } 91 }
75 92
76 int32_t CompositorLayerResource::SetSourceRect( 93 int32_t CompositorLayerResource::SetSourceRect(
77 const struct PP_FloatRect* rect) { 94 const struct PP_FloatRect* rect) {
78 return PP_ERROR_NOTSUPPORTED; 95 if (!layer_)
96 return PP_ERROR_BADARGUMENT;
97 return layer_->SetSourceRect(rect);
79 } 98 }
80 99
81 int32_t CompositorLayerResource::SetPremultipliedAlpha(PP_Bool premult) { 100 int32_t CompositorLayerResource::SetPremultipliedAlpha(PP_Bool premult) {
82 return PP_ERROR_NOTSUPPORTED; 101 if (!layer_)
102 return PP_ERROR_BADARGUMENT;
103 return layer_->SetPremultipliedAlpha(premult);
83 } 104 }
84 105
85 } // namespace proxy 106 } // namespace proxy
86 } // namespace ppapi 107 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698