| 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 "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 20 matching lines...) Expand all Loading... |
| 31 height_(0) { | 31 height_(0) { |
| 32 } | 32 } |
| 33 | 33 |
| 34 PPB_ImageData_Impl::~PPB_ImageData_Impl() { | 34 PPB_ImageData_Impl::~PPB_ImageData_Impl() { |
| 35 } | 35 } |
| 36 | 36 |
| 37 PPB_ImageData_API* PPB_ImageData_Impl::AsPPB_ImageData_API() { | 37 PPB_ImageData_API* PPB_ImageData_Impl::AsPPB_ImageData_API() { |
| 38 return this; | 38 return this; |
| 39 } | 39 } |
| 40 | 40 |
| 41 PPB_ImageData_Impl* PPB_ImageData_Impl::AsPPB_ImageData_Impl() { | |
| 42 return this; | |
| 43 } | |
| 44 | |
| 45 bool PPB_ImageData_Impl::Init(PP_ImageDataFormat format, | 41 bool PPB_ImageData_Impl::Init(PP_ImageDataFormat format, |
| 46 int width, int height, | 42 int width, int height, |
| 47 bool init_to_zero) { | 43 bool init_to_zero) { |
| 48 // TODO(brettw) this should be called only on the main thread! | 44 // TODO(brettw) this should be called only on the main thread! |
| 49 // TODO(brettw) use init_to_zero when we implement caching. | 45 // TODO(brettw) use init_to_zero when we implement caching. |
| 50 if (!IsImageDataFormatSupported(format)) | 46 if (!IsImageDataFormatSupported(format)) |
| 51 return false; // Only support this one format for now. | 47 return false; // Only support this one format for now. |
| 52 if (width <= 0 || height <= 0) | 48 if (width <= 0 || height <= 0) |
| 53 return false; | 49 return false; |
| 54 if (static_cast<int64>(width) * static_cast<int64>(height) >= | 50 if (static_cast<int64>(width) * static_cast<int64>(height) >= |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 swap(other->platform_image_, platform_image_); | 106 swap(other->platform_image_, platform_image_); |
| 111 swap(other->mapped_canvas_, mapped_canvas_); | 107 swap(other->mapped_canvas_, mapped_canvas_); |
| 112 std::swap(other->format_, format_); | 108 std::swap(other->format_, format_); |
| 113 std::swap(other->width_, width_); | 109 std::swap(other->width_, width_); |
| 114 std::swap(other->height_, height_); | 110 std::swap(other->height_, height_); |
| 115 } | 111 } |
| 116 | 112 |
| 117 } // namespace ppapi | 113 } // namespace ppapi |
| 118 } // namespace webkit | 114 } // namespace webkit |
| 119 | 115 |
| OLD | NEW |