Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2246)

Unified Diff: cc/resources/resource.h

Issue 1531403002: Revert "Delete CC." (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/resources/release_callback_impl.h ('k') | cc/resources/resource.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/resource.h
diff --git a/cc/resources/resource.h b/cc/resources/resource.h
new file mode 100644
index 0000000000000000000000000000000000000000..642ba16570468c4d89db1189b46cb0c2c1df66e4
--- /dev/null
+++ b/cc/resources/resource.h
@@ -0,0 +1,49 @@
+// Copyright 2012 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_H_
+#define CC_RESOURCES_RESOURCE_H_
+
+#include "cc/resources/resource_provider.h"
+#include "ui/gfx/geometry/size.h"
+
+namespace cc {
+
+class Resource {
+ public:
+ Resource() : id_(0) {}
+ Resource(unsigned id, const gfx::Size& size, ResourceFormat format)
+ : id_(id),
+ size_(size),
+ format_(format) {}
+
+ ResourceProvider::ResourceId id() const { return id_; }
+ gfx::Size size() const { return size_; }
+ ResourceFormat format() const { return format_; }
+ size_t bytes() const;
+
+ inline static size_t MemorySizeBytes(const gfx::Size& size,
+ ResourceFormat format) {
+ DCHECK_EQ(0u, (BitsPerPixel(format) * size.width() * size.height()) % 8);
+ return (BitsPerPixel(format) * size.width() * size.height()) / 8;
+ }
+
+ protected:
+ void set_id(ResourceProvider::ResourceId id) { id_ = id; }
+ void set_dimensions(const gfx::Size& size, ResourceFormat format) {
+ size_ = size;
+ format_ = format;
+ }
+
+ private:
+ ResourceProvider::ResourceId id_;
+ gfx::Size size_;
+ ResourceFormat format_;
+
+ DISALLOW_COPY_AND_ASSIGN(Resource);
+};
+
+} // namespace cc
+
+#endif // CC_RESOURCES_RESOURCE_H_
« no previous file with comments | « cc/resources/release_callback_impl.h ('k') | cc/resources/resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698