1 // Copyright (c) 2012 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.
5 // From ppb_image_data.idl modified Thu Jun 6 18:05:40 2013.
9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/c/ppb_image_data.h"
11 #include "ppapi/shared_impl/ppb_image_data_shared.h"
12 #include "ppapi/shared_impl/tracked_callback.h"
13 #include "ppapi/thunk/enter.h"
14 #include "ppapi/thunk/ppb_image_data_api.h"
15 #include "ppapi/thunk/ppb_instance_api.h"
16 #include "ppapi/thunk/resource_creation_api.h"
17 #include "ppapi/thunk/thunk.h"
24 PP_ImageDataFormat
GetNativeImageDataFormat(void) {
25 VLOG(4) << "PPB_ImageData::GetNativeImageDataFormat()";
26 return PPB_ImageData_Shared::GetNativeImageDataFormat();
29 PP_Bool
IsImageDataFormatSupported(PP_ImageDataFormat format
) {
30 VLOG(4) << "PPB_ImageData::IsImageDataFormatSupported()";
31 return PPB_ImageData_Shared::IsImageDataFormatSupported(format
);
34 PP_Resource
Create(PP_Instance instance
,
35 PP_ImageDataFormat format
,
36 const struct PP_Size
* size
,
37 PP_Bool init_to_zero
) {
38 VLOG(4) << "PPB_ImageData::Create()";
39 EnterResourceCreation
enter(instance
);
42 return enter
.functions()->CreateImageData(instance
,
48 PP_Bool
IsImageData(PP_Resource image_data
) {
49 VLOG(4) << "PPB_ImageData::IsImageData()";
50 EnterResource
<PPB_ImageData_API
> enter(image_data
, false);
51 return PP_FromBool(enter
.succeeded());
54 PP_Bool
Describe(PP_Resource image_data
, struct PP_ImageDataDesc
* desc
) {
55 VLOG(4) << "PPB_ImageData::Describe()";
56 EnterResource
<PPB_ImageData_API
> enter(image_data
, true);
58 memset(desc
, 0, sizeof(*desc
));
61 return enter
.object()->Describe(desc
);
64 void* Map(PP_Resource image_data
) {
65 VLOG(4) << "PPB_ImageData::Map()";
66 EnterResource
<PPB_ImageData_API
> enter(image_data
, true);
69 return enter
.object()->Map();
72 void Unmap(PP_Resource image_data
) {
73 VLOG(4) << "PPB_ImageData::Unmap()";
74 EnterResource
<PPB_ImageData_API
> enter(image_data
, true);
77 enter
.object()->Unmap();
80 const PPB_ImageData_1_0 g_ppb_imagedata_thunk_1_0
= {
81 &GetNativeImageDataFormat
,
82 &IsImageDataFormatSupported
,
92 const PPB_ImageData_1_0
* GetPPB_ImageData_1_0_Thunk() {
93 return &g_ppb_imagedata_thunk_1_0
;