| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "cc/output/software_frame_data.h" | 5 #include "cc/output/software_frame_data.h" |
| 6 | 6 |
| 7 namespace cc { | 7 namespace cc { |
| 8 | 8 |
| 9 SoftwareFrameData::SoftwareFrameData() | 9 SoftwareFrameData::SoftwareFrameData() |
| 10 : id(0), | 10 : id(0), |
| 11 handle(base::SharedMemory::NULLHandle()) {} | 11 handle(base::SharedMemory::NULLHandle()) {} |
| 12 | 12 |
| 13 SoftwareFrameData::~SoftwareFrameData() {} | 13 SoftwareFrameData::~SoftwareFrameData() {} |
| 14 | 14 |
| 15 size_t SoftwareFrameData::SizeInBytes() const { | |
| 16 size_t bytes_per_pixel = 4; | |
| 17 size_t width = size.width(); | |
| 18 size_t height = size.height(); | |
| 19 return bytes_per_pixel * width * height; | |
| 20 } | |
| 21 | |
| 22 base::CheckedNumeric<size_t> SoftwareFrameData::CheckedSizeInBytes() const { | |
| 23 return base::CheckedNumeric<size_t>(4) * | |
| 24 base::CheckedNumeric<size_t>(size.width()) * | |
| 25 base::CheckedNumeric<size_t>(size.height()); | |
| 26 } | |
| 27 | |
| 28 } // namespace cc | 15 } // namespace cc |
| OLD | NEW |