Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 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 CC_RESOURCES_UI_RESOURCE_MANAGER_H_ | |
| 6 #define CC_RESOURCES_UI_RESOURCE_MANAGER_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 #include "ui/gfx/size.h" | |
| 10 | |
| 11 namespace cc { | |
| 12 | |
| 13 typedef int UIResourceId; | |
| 14 | |
| 15 class UIResourceManagerClient { | |
|
aelias_OOO_until_Jul13
2013/07/10 23:07:22
Each class should be defined in a file with the sa
powei
2013/07/11 23:54:44
Done.
| |
| 16 public: | |
| 17 virtual ~UIResourceManagerClient() {} | |
| 18 | |
| 19 // This is called on the main thread when a recently created resource | |
| 20 // has been fully uploaded to a texture. Users of large resources may | |
| 21 // wish to wait for this callback before using the resource ID on a layer, | |
| 22 // to avoid jank until the upload completes. | |
| 23 virtual void UIResourceReady(UIResourceId id) = 0; | |
|
aelias_OOO_until_Jul13
2013/07/10 23:07:22
Most users won't need to take any action for this
powei
2013/07/11 23:54:44
Done.
| |
| 24 }; | |
| 25 | |
| 26 // Ref-counted bitmap class (can’t use SkBitmap because of ETC1) | |
| 27 class UIResourceBitmap : public base::RefCountedThreadSafe<UIResourceBitmap> { | |
|
aelias_OOO_until_Jul13
2013/07/10 23:07:22
Each class should be defined in a file with the sa
powei
2013/07/11 23:54:44
Done.
| |
| 28 public: | |
| 29 enum UIResourceFormat { | |
| 30 RGBA8, | |
| 31 ETC1 | |
| 32 }; | |
| 33 | |
| 34 ~UIResourceBitmap(); | |
| 35 | |
| 36 // Takes ownership of “pixels”. | |
| 37 static scoped_refptr<UIResourceBitmap> Create(void* pixels, | |
| 38 UIResourceFormat format, | |
| 39 gfx::Size size); | |
| 40 | |
| 41 gfx::Size GetSize() const { return size_; } | |
| 42 UIResourceFormat GetFormat() const { return format_; } | |
| 43 void* GetPixels() { return pixels_; } | |
| 44 | |
| 45 private: | |
| 46 void* pixels_; | |
| 47 UIResourceFormat format_; | |
| 48 gfx::Size size_; | |
| 49 }; | |
| 50 | |
| 51 } // namespace cc | |
| 52 | |
| 53 #endif // CC_RESOURCES_UI_RESOURCE_MANAGER_H_ | |
| OLD | NEW |