| 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/glue/plugins/pepper_image_data.h" | 5 #include "webkit/glue/plugins/pepper_image_data.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 13 matching lines...) Expand all Loading... |
| 24 PP_ImageDataFormat GetNativeImageDataFormat() { | 24 PP_ImageDataFormat GetNativeImageDataFormat() { |
| 25 return PP_IMAGEDATAFORMAT_BGRA_PREMUL; | 25 return PP_IMAGEDATAFORMAT_BGRA_PREMUL; |
| 26 } | 26 } |
| 27 | 27 |
| 28 PP_Resource Create(PP_Module module_id, | 28 PP_Resource Create(PP_Module module_id, |
| 29 PP_ImageDataFormat format, | 29 PP_ImageDataFormat format, |
| 30 const PP_Size* size, | 30 const PP_Size* size, |
| 31 bool init_to_zero) { | 31 bool init_to_zero) { |
| 32 PluginModule* module = PluginModule::FromPPModule(module_id); | 32 PluginModule* module = PluginModule::FromPPModule(module_id); |
| 33 if (!module) | 33 if (!module) |
| 34 return NULL; | 34 return 0; |
| 35 | 35 |
| 36 scoped_refptr<ImageData> data(new ImageData(module)); | 36 scoped_refptr<ImageData> data(new ImageData(module)); |
| 37 if (!data->Init(format, size->width, size->height, init_to_zero)) | 37 if (!data->Init(format, size->width, size->height, init_to_zero)) |
| 38 return NULL; | 38 return 0; |
| 39 | 39 |
| 40 return data->GetReference(); | 40 return data->GetReference(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 bool IsImageData(PP_Resource resource) { | 43 bool IsImageData(PP_Resource resource) { |
| 44 return !!Resource::GetAs<ImageData>(resource); | 44 return !!Resource::GetAs<ImageData>(resource); |
| 45 } | 45 } |
| 46 | 46 |
| 47 bool Describe(PP_Resource resource, PP_ImageDataDesc* desc) { | 47 bool Describe(PP_Resource resource, PP_ImageDataDesc* desc) { |
| 48 // Give predictable values on failure. | 48 // Give predictable values on failure. |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 } | 150 } |
| 151 | 151 |
| 152 void ImageData::Swap(ImageData* other) { | 152 void ImageData::Swap(ImageData* other) { |
| 153 swap(other->platform_image_, platform_image_); | 153 swap(other->platform_image_, platform_image_); |
| 154 swap(other->mapped_canvas_, mapped_canvas_); | 154 swap(other->mapped_canvas_, mapped_canvas_); |
| 155 std::swap(other->width_, width_); | 155 std::swap(other->width_, width_); |
| 156 std::swap(other->height_, height_); | 156 std::swap(other->height_, height_); |
| 157 } | 157 } |
| 158 | 158 |
| 159 } // namespace pepper | 159 } // namespace pepper |
| OLD | NEW |