| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "webkit/plugins/ppapi/ppb_image_data_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 PP_ImageDataFormat GetNativeImageDataFormat() { | 28 PP_ImageDataFormat GetNativeImageDataFormat() { |
| 29 return PPB_ImageData_Impl::GetNativeImageDataFormat(); | 29 return PPB_ImageData_Impl::GetNativeImageDataFormat(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 PP_Bool IsImageDataFormatSupported(PP_ImageDataFormat format) { | 32 PP_Bool IsImageDataFormatSupported(PP_ImageDataFormat format) { |
| 33 return BoolToPPBool(PPB_ImageData_Impl::IsImageDataFormatSupported(format)); | 33 return BoolToPPBool(PPB_ImageData_Impl::IsImageDataFormatSupported(format)); |
| 34 } | 34 } |
| 35 | 35 |
| 36 PP_Resource Create(PP_Module module_id, | 36 PP_Resource Create(PP_Instance instance_id, |
| 37 PP_ImageDataFormat format, | 37 PP_ImageDataFormat format, |
| 38 const PP_Size* size, | 38 const PP_Size* size, |
| 39 PP_Bool init_to_zero) { | 39 PP_Bool init_to_zero) { |
| 40 PluginModule* module = ResourceTracker::Get()->GetModule(module_id); | 40 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); |
| 41 if (!module) | 41 if (!instance) |
| 42 return 0; | 42 return 0; |
| 43 | 43 |
| 44 scoped_refptr<PPB_ImageData_Impl> data(new PPB_ImageData_Impl(module)); | 44 scoped_refptr<PPB_ImageData_Impl> data( |
| 45 new PPB_ImageData_Impl(instance->module())); |
| 45 if (!data->Init(format, | 46 if (!data->Init(format, |
| 46 size->width, | 47 size->width, |
| 47 size->height, | 48 size->height, |
| 48 PPBoolToBool(init_to_zero))) { | 49 PPBoolToBool(init_to_zero))) { |
| 49 return 0; | 50 return 0; |
| 50 } | 51 } |
| 51 | 52 |
| 52 return data->GetReference(); | 53 return data->GetReference(); |
| 53 } | 54 } |
| 54 | 55 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 swap(other->platform_image_, platform_image_); | 218 swap(other->platform_image_, platform_image_); |
| 218 swap(other->mapped_canvas_, mapped_canvas_); | 219 swap(other->mapped_canvas_, mapped_canvas_); |
| 219 std::swap(other->format_, format_); | 220 std::swap(other->format_, format_); |
| 220 std::swap(other->width_, width_); | 221 std::swap(other->width_, width_); |
| 221 std::swap(other->height_, height_); | 222 std::swap(other->height_, height_); |
| 222 } | 223 } |
| 223 | 224 |
| 224 } // namespace ppapi | 225 } // namespace ppapi |
| 225 } // namespace webkit | 226 } // namespace webkit |
| 226 | 227 |
| OLD | NEW |