summaryrefslogtreecommitdiffstats
path: root/cc/resources/resource.h
blob: 549a314d48eb601fc7eba5fc438378d0eb039c7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// 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/base/cc_export.h"
#include "cc/resources/resource_provider.h"
#include "cc/resources/resource_util.h"
#include "ui/gfx/geometry/size.h"

namespace cc {

class CC_EXPORT Resource {
 public:
  Resource() : id_(0), format_(RGBA_8888) {}
  Resource(unsigned id, const gfx::Size& size, ResourceFormat format)
      : id_(id),
        size_(size),
        format_(format) {}

  ResourceId id() const { return id_; }
  gfx::Size size() const { return size_; }
  ResourceFormat format() const { return format_; }

 protected:
  void set_id(ResourceId id) { id_ = id; }
  void set_dimensions(const gfx::Size& size, ResourceFormat format) {
    size_ = size;
    format_ = format;
  }

 private:
  ResourceId id_;
  gfx::Size size_;
  ResourceFormat format_;

  DISALLOW_COPY_AND_ASSIGN(Resource);
};

}  // namespace cc

#endif  // CC_RESOURCES_RESOURCE_H_