| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CC_RESOURCES_RESOURCE_UTIL_H_ | 5 #ifndef CC_RESOURCES_RESOURCE_UTIL_H_ |
| 6 #define CC_RESOURCES_RESOURCE_UTIL_H_ | 6 #define CC_RESOURCES_RESOURCE_UTIL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/numerics/safe_math.h" | 13 #include "base/numerics/safe_math.h" |
| 14 #include "cc/base/cc_export.h" | |
| 15 #include "cc/base/math_util.h" | 14 #include "cc/base/math_util.h" |
| 15 #include "cc/cc_export.h" |
| 16 #include "cc/resources/resource_format.h" | 16 #include "cc/resources/resource_format.h" |
| 17 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
| 18 | 18 |
| 19 namespace cc { | 19 namespace cc { |
| 20 | 20 |
| 21 class CC_EXPORT ResourceUtil { | 21 class CC_EXPORT ResourceUtil { |
| 22 public: | 22 public: |
| 23 // Returns true if the width is valid and fits in bytes, false otherwise. | 23 // Returns true if the width is valid and fits in bytes, false otherwise. |
| 24 template <typename T> | 24 template <typename T> |
| 25 static bool VerifyWidthInBytes(int width, ResourceFormat format); | 25 static bool VerifyWidthInBytes(int width, ResourceFormat format); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 bytes = MathUtil::UncheckedRoundUp<T>(bytes, 4); | 204 bytes = MathUtil::UncheckedRoundUp<T>(bytes, 4); |
| 205 if (verify_size) | 205 if (verify_size) |
| 206 bytes *= height; | 206 bytes *= height; |
| 207 | 207 |
| 208 return bytes; | 208 return bytes; |
| 209 } | 209 } |
| 210 | 210 |
| 211 } // namespace cc | 211 } // namespace cc |
| 212 | 212 |
| 213 #endif // CC_RESOURCES_RESOURCE_UTIL_H_ | 213 #endif // CC_RESOURCES_RESOURCE_UTIL_H_ |
| OLD | NEW |