summaryrefslogtreecommitdiffstats
path: root/minui/include
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-11-27 01:28:07 +0100
committerTao Bao <tbao@google.com>2018-11-27 07:46:19 +0100
commitdd78982d580aa61c39bfd13940140e5830f489b2 (patch)
tree6a59978781611cd0c24123b5705ceae9b46cf3c6 /minui/include
parentMerge "minui: Fix a wrong arg in calling GRSurface::Create()." (diff)
downloadandroid_bootable_recovery-dd78982d580aa61c39bfd13940140e5830f489b2.tar
android_bootable_recovery-dd78982d580aa61c39bfd13940140e5830f489b2.tar.gz
android_bootable_recovery-dd78982d580aa61c39bfd13940140e5830f489b2.tar.bz2
android_bootable_recovery-dd78982d580aa61c39bfd13940140e5830f489b2.tar.lz
android_bootable_recovery-dd78982d580aa61c39bfd13940140e5830f489b2.tar.xz
android_bootable_recovery-dd78982d580aa61c39bfd13940140e5830f489b2.tar.zst
android_bootable_recovery-dd78982d580aa61c39bfd13940140e5830f489b2.zip
Diffstat (limited to 'minui/include')
-rw-r--r--minui/include/minui/minui.h25
1 files changed, 16 insertions, 9 deletions
diff --git a/minui/include/minui/minui.h b/minui/include/minui/minui.h
index 3231248a0..e49c6ac97 100644
--- a/minui/include/minui/minui.h
+++ b/minui/include/minui/minui.h
@@ -33,13 +33,16 @@
class GRSurface {
public:
+ static constexpr size_t kSurfaceDataAlignment = 8;
+
virtual ~GRSurface() = default;
// Creates and returns a GRSurface instance that's sufficient for storing an image of the given
- // size. The starting address of the surface data is aligned to SURFACE_DATA_ALIGNMENT. Returns
- // the created GRSurface instance (in std::unique_ptr), or nullptr on error.
- static std::unique_ptr<GRSurface> Create(int width, int height, int row_bytes, int pixel_bytes,
- size_t data_size);
+ // size (i.e. row_bytes * height). The starting address of the surface data is aligned to
+ // kSurfaceDataAlignment. Returns the created GRSurface instance (in std::unique_ptr), or nullptr
+ // on error.
+ static std::unique_ptr<GRSurface> Create(size_t width, size_t height, size_t row_bytes,
+ size_t pixel_bytes);
// Clones the current GRSurface instance (i.e. an image).
std::unique_ptr<GRSurface> Clone() const;
@@ -52,13 +55,17 @@ class GRSurface {
return const_cast<const uint8_t*>(const_cast<GRSurface*>(this)->data());
}
- int width;
- int height;
- int row_bytes;
- int pixel_bytes;
+ size_t data_size() const {
+ return data_size_;
+ }
+
+ size_t width;
+ size_t height;
+ size_t row_bytes;
+ size_t pixel_bytes;
protected:
- GRSurface(int width, int height, int row_bytes, int pixel_bytes)
+ GRSurface(size_t width, size_t height, size_t row_bytes, size_t pixel_bytes)
: width(width), height(height), row_bytes(row_bytes), pixel_bytes(pixel_bytes) {}
private: