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

Side by Side Diff: ppapi/thunk/ppb_image_data_thunk.cc

Issue 6905088: New thunk system for Pepper proxy and implementation (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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/thunk/ppb_image_data_api.h ('k') | ppapi/thunk/resource_creation_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 #include "ppapi/c/pp_errors.h"
6 #include "ppapi/c/ppb_image_data.h"
7 #include "ppapi/shared_impl/image_data_impl.h"
8 #include "ppapi/thunk/enter.h"
9 #include "ppapi/thunk/ppb_image_data_api.h"
10 #include "ppapi/thunk/resource_creation_api.h"
11
12 namespace ppapi {
13 namespace thunk {
14
15 namespace {
16
17 PP_ImageDataFormat GetNativeImageDataFormat() {
18 return pp::shared_impl::ImageDataImpl::GetNativeImageDataFormat();
19 }
20
21 PP_Bool IsImageDataFormatSupported(PP_ImageDataFormat format) {
22 return pp::shared_impl::ImageDataImpl::IsImageDataFormatSupported(format)
23 ? PP_TRUE : PP_FALSE;
24 }
25
26 PP_Resource Create(PP_Instance instance,
27 PP_ImageDataFormat format,
28 const PP_Size* size,
29 PP_Bool init_to_zero) {
30 EnterFunction<ResourceCreationAPI> enter(instance, true);
31 if (enter.failed())
32 return 0;
33 return enter.functions()->CreateImageData(instance, format,
34 *size, init_to_zero);
35 }
36
37 PP_Bool IsImageData(PP_Resource resource) {
38 EnterResource<PPB_ImageData_API> enter(resource, false);
39 return enter.succeeded() ? PP_TRUE : PP_FALSE;
40 }
41
42 PP_Bool Describe(PP_Resource resource, PP_ImageDataDesc* desc) {
43 // Give predictable values on failure.
44 memset(desc, 0, sizeof(PP_ImageDataDesc));
45
46 EnterResource<PPB_ImageData_API> enter(resource, true);
47 if (enter.failed())
48 return PP_FALSE;
49 return enter.object()->Describe(desc);
50 }
51
52 void* Map(PP_Resource resource) {
53 EnterResource<PPB_ImageData_API> enter(resource, true);
54 if (enter.failed())
55 return NULL;
56 return enter.object()->Map();
57 }
58
59 void Unmap(PP_Resource resource) {
60 EnterResource<PPB_ImageData_API> enter(resource, true);
61 if (enter.failed())
62 return;
63 enter.object()->Unmap();
64 }
65
66 const PPB_ImageData g_ppb_image_data_thunk = {
67 &GetNativeImageDataFormat,
68 &IsImageDataFormatSupported,
69 &Create,
70 &IsImageData,
71 &Describe,
72 &Map,
73 &Unmap,
74 };
75
76 } // namespace
77
78 const PPB_ImageData* GetPPB_ImageData_Thunk() {
79 return &g_ppb_image_data_thunk;
80 }
81
82 } // namespace thunk
83 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/thunk/ppb_image_data_api.h ('k') | ppapi/thunk/resource_creation_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698