| 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/plugin_dispatcher.h" | 16 #include "ppapi/proxy/plugin_dispatcher.h" |
| 17 #include "ppapi/proxy/plugin_resource_tracker.h" | 17 #include "ppapi/proxy/plugin_resource_tracker.h" |
| 18 #include "ppapi/proxy/ppapi_messages.h" | 18 #include "ppapi/proxy/ppapi_messages.h" |
| 19 #include "ppapi/shared_impl/host_resource.h" | 19 #include "ppapi/shared_impl/host_resource.h" |
| 20 #include "ppapi/shared_impl/resource.h" | 20 #include "ppapi/shared_impl/resource.h" |
| 21 #include "ppapi/thunk/thunk.h" | 21 #include "ppapi/thunk/thunk.h" |
| 22 #include "skia/ext/platform_canvas.h" | 22 #include "skia/ext/platform_canvas.h" |
| 23 #include "ui/gfx/surface/transport_dib.h" | 23 #include "ui/gfx/surface/transport_dib.h" |
| 24 | 24 |
| 25 namespace ppapi { | 25 namespace ppapi { |
| 26 namespace proxy { | 26 namespace proxy { |
| 27 | 27 |
| 28 namespace { | |
| 29 | |
| 30 InterfaceProxy* CreateImageDataProxy(Dispatcher* dispatcher, | |
| 31 const void* target_interface) { | |
| 32 return new PPB_ImageData_Proxy(dispatcher, target_interface); | |
| 33 } | |
| 34 | |
| 35 } // namespace | |
| 36 | |
| 37 // PPB_ImageData_Proxy --------------------------------------------------------- | |
| 38 | |
| 39 PPB_ImageData_Proxy::PPB_ImageData_Proxy(Dispatcher* dispatcher, | |
| 40 const void* target_interface) | |
| 41 : InterfaceProxy(dispatcher, target_interface) { | |
| 42 } | |
| 43 | |
| 44 PPB_ImageData_Proxy::~PPB_ImageData_Proxy() { | |
| 45 } | |
| 46 | |
| 47 // static | |
| 48 const InterfaceProxy::Info* PPB_ImageData_Proxy::GetInfo() { | |
| 49 static const Info info = { | |
| 50 thunk::GetPPB_ImageData_Thunk(), | |
| 51 PPB_IMAGEDATA_INTERFACE, | |
| 52 INTERFACE_ID_PPB_IMAGE_DATA, | |
| 53 false, | |
| 54 &CreateImageDataProxy, | |
| 55 }; | |
| 56 return &info; | |
| 57 } | |
| 58 | |
| 59 bool PPB_ImageData_Proxy::OnMessageReceived(const IPC::Message& msg) { | |
| 60 return false; | |
| 61 } | |
| 62 | |
| 63 // ImageData ------------------------------------------------------------------- | |
| 64 | |
| 65 ImageData::ImageData(const HostResource& resource, | 28 ImageData::ImageData(const HostResource& resource, |
| 66 const PP_ImageDataDesc& desc, | 29 const PP_ImageDataDesc& desc, |
| 67 ImageHandle handle) | 30 ImageHandle handle) |
| 68 : Resource(resource), | 31 : Resource(resource), |
| 69 desc_(desc) { | 32 desc_(desc) { |
| 70 #if defined(OS_WIN) | 33 #if defined(OS_WIN) |
| 71 transport_dib_.reset(TransportDIB::CreateWithHandle(handle)); | 34 transport_dib_.reset(TransportDIB::CreateWithHandle(handle)); |
| 72 #else | 35 #else |
| 73 transport_dib_.reset(TransportDIB::Map(handle)); | 36 transport_dib_.reset(TransportDIB::Map(handle)); |
| 74 #endif | 37 #endif |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 return reinterpret_cast<ImageHandle>(i); | 89 return reinterpret_cast<ImageHandle>(i); |
| 127 #elif defined(OS_MACOSX) | 90 #elif defined(OS_MACOSX) |
| 128 return ImageHandle(i, false); | 91 return ImageHandle(i, false); |
| 129 #else | 92 #else |
| 130 return static_cast<ImageHandle>(i); | 93 return static_cast<ImageHandle>(i); |
| 131 #endif | 94 #endif |
| 132 } | 95 } |
| 133 | 96 |
| 134 } // namespace proxy | 97 } // namespace proxy |
| 135 } // namespace ppapi | 98 } // namespace ppapi |
| OLD | NEW |