Index: cc/resources/resource_util.h |
diff --git a/cc/resources/resource_util.h b/cc/resources/resource_util.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6ec75595d64c6c79b90b9dbc05dff137fb17a6f1 |
--- /dev/null |
+++ b/cc/resources/resource_util.h |
@@ -0,0 +1,33 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CC_RESOURCES_RESOURCE_UTIL_H_ |
+#define CC_RESOURCES_RESOURCE_UTIL_H_ |
+ |
+#include "cc/base/cc_export.h" |
+#include "cc/resources/resource_format.h" |
+#include "ui/gfx/geometry/size.h" |
+ |
+namespace cc { |
+ |
+class CC_EXPORT ResourceUtil { |
+ public: |
+ // Return true if the call to SizeInBytes would return a value |
+ // that fits in a size_t. |
+ static bool VerifySizeInBytes(const gfx::Size& size, ResourceFormat format); |
+ static size_t CheckedSizeInBytes(const gfx::Size& size, |
+ ResourceFormat format); |
+ static size_t WidthInBytes(size_t width, ResourceFormat format); |
+ static size_t SizeInBytes(const gfx::Size& size, ResourceFormat format); |
+ static size_t WidthInBytesAligned(size_t width, ResourceFormat format); |
+ static size_t SizeInBytesAligned(const gfx::Size& size, |
+ ResourceFormat format); |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(ResourceUtil); |
+}; |
+ |
+} // namespace cc |
+ |
+#endif // CC_RESOURCES_RESOURCE_UTIL_H_ |