OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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/ppb_image_data_proxy.h" | 5 #include "ppapi/proxy/ppb_image_data_proxy.h" |
6 | 6 |
7 #include <string.h> // For memcpy | 7 #include <string.h> // For memcpy |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "ppapi/c/pp_completion_callback.h" | 13 #include "ppapi/c/pp_completion_callback.h" |
14 #include "ppapi/c/pp_errors.h" | 14 #include "ppapi/c/pp_errors.h" |
15 #include "ppapi/c/pp_resource.h" | 15 #include "ppapi/c/pp_resource.h" |
16 #include "ppapi/proxy/host_resource.h" | |
17 #include "ppapi/proxy/plugin_dispatcher.h" | 16 #include "ppapi/proxy/plugin_dispatcher.h" |
18 #include "ppapi/proxy/plugin_resource_tracker.h" | 17 #include "ppapi/proxy/plugin_resource_tracker.h" |
19 #include "ppapi/proxy/ppapi_messages.h" | 18 #include "ppapi/proxy/ppapi_messages.h" |
| 19 #include "ppapi/shared_impl/host_resource.h" |
20 #include "ppapi/thunk/thunk.h" | 20 #include "ppapi/thunk/thunk.h" |
21 #include "skia/ext/platform_canvas.h" | 21 #include "skia/ext/platform_canvas.h" |
22 #include "ui/gfx/surface/transport_dib.h" | 22 #include "ui/gfx/surface/transport_dib.h" |
23 | 23 |
| 24 using ppapi::HostResource; |
| 25 |
24 namespace pp { | 26 namespace pp { |
25 namespace proxy { | 27 namespace proxy { |
26 | 28 |
27 namespace { | 29 namespace { |
28 | 30 |
29 InterfaceProxy* CreateImageDataProxy(Dispatcher* dispatcher, | 31 InterfaceProxy* CreateImageDataProxy(Dispatcher* dispatcher, |
30 const void* target_interface) { | 32 const void* target_interface) { |
31 return new PPB_ImageData_Proxy(dispatcher, target_interface); | 33 return new PPB_ImageData_Proxy(dispatcher, target_interface); |
32 } | 34 } |
33 | 35 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 #endif | 75 #endif |
74 } | 76 } |
75 | 77 |
76 ImageData::~ImageData() { | 78 ImageData::~ImageData() { |
77 } | 79 } |
78 | 80 |
79 ::ppapi::thunk::PPB_ImageData_API* ImageData::AsPPB_ImageData_API() { | 81 ::ppapi::thunk::PPB_ImageData_API* ImageData::AsPPB_ImageData_API() { |
80 return this; | 82 return this; |
81 } | 83 } |
82 | 84 |
83 ImageData* ImageData::AsImageData() { | |
84 return this; | |
85 } | |
86 | |
87 PP_Bool ImageData::Describe(PP_ImageDataDesc* desc) { | 85 PP_Bool ImageData::Describe(PP_ImageDataDesc* desc) { |
88 memcpy(desc, &desc_, sizeof(PP_ImageDataDesc)); | 86 memcpy(desc, &desc_, sizeof(PP_ImageDataDesc)); |
89 return PP_TRUE; | 87 return PP_TRUE; |
90 } | 88 } |
91 | 89 |
92 void* ImageData::Map() { | 90 void* ImageData::Map() { |
93 if (!mapped_canvas_.get()) { | 91 if (!mapped_canvas_.get()) { |
94 mapped_canvas_.reset(transport_dib_->GetPlatformCanvas(desc_.size.width, | 92 mapped_canvas_.reset(transport_dib_->GetPlatformCanvas(desc_.size.width, |
95 desc_.size.height)); | 93 desc_.size.height)); |
96 if (!mapped_canvas_.get()) | 94 if (!mapped_canvas_.get()) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 return reinterpret_cast<ImageHandle>(i); | 127 return reinterpret_cast<ImageHandle>(i); |
130 #elif defined(OS_MACOSX) | 128 #elif defined(OS_MACOSX) |
131 return ImageHandle(i, false); | 129 return ImageHandle(i, false); |
132 #else | 130 #else |
133 return static_cast<ImageHandle>(i); | 131 return static_cast<ImageHandle>(i); |
134 #endif | 132 #endif |
135 } | 133 } |
136 | 134 |
137 } // namespace proxy | 135 } // namespace proxy |
138 } // namespace pp | 136 } // namespace pp |
OLD | NEW |