OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef UI_ANDROID_RESOURCES_RESOURCE_H_ | |
6 #define UI_ANDROID_RESOURCES_RESOURCE_H_ | |
7 | |
8 #include "cc/resources/scoped_ui_resource.h" | |
9 #include "third_party/skia/include/core/SkBitmap.h" | |
10 #include "ui/android/ui_android_export.h" | |
11 #include "ui/gfx/geometry/rect.h" | |
12 | |
13 namespace ui { | |
14 | |
15 class UI_ANDROID_EXPORT Resource { | |
16 public: | |
17 enum class Type { BITMAP, NINE_PATCH_BITMAP, UNKNOWN }; | |
mdjones
2017/03/10 18:12:00
What is UNKNOWN used for?
Khushal
2017/03/10 19:19:24
I was planning on using it for sub-classes outside
mdjones
2017/03/13 16:47:06
I don't think we should have chrome specific thing
Khushal
2017/03/13 21:03:25
My plan for getting rid of padding/aperture coming
| |
18 | |
19 Resource(); | |
20 virtual ~Resource(); | |
21 | |
22 virtual std::unique_ptr<Resource> CreateForCopy(); | |
23 void SetUIResource(std::unique_ptr<cc::ScopedUIResource> ui_resource, | |
24 const gfx::Size& size_in_px); | |
25 size_t EstimateMemoryUsage() const; | |
26 | |
27 cc::ScopedUIResource* ui_resource() const { return ui_resource_.get(); } | |
28 gfx::Size size() const { return size_; } | |
29 Type type() const { return type_; } | |
30 | |
31 protected: | |
32 Resource(Type type); | |
33 | |
34 private: | |
35 const Type type_; | |
36 | |
37 // Size of the bitmap in physical pixels. | |
38 gfx::Size size_; | |
39 std::unique_ptr<cc::ScopedUIResource> ui_resource_; | |
40 }; | |
41 | |
42 } // namespace ui | |
43 | |
44 #endif // UI_ANDROID_RESOURCES_RESOURCE_H_ | |
OLD | NEW |