Skip to content

Commit

Permalink
Changed data parameters to use void*.
Browse files Browse the repository at this point in the history
This is more generic than uint8_t*, which may require casts.
  • Loading branch information
akb825 committed Sep 25, 2020
1 parent c9754b0 commit 9c376a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions lib/include/cuttlefish/Image.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class CUTTLEFISH_EXPORT Image
* @param colorSpace The color space of the image.
* @remark The image will be invalid if it failed to load.
*/
Image(const std::uint8_t* data, std::size_t size, ColorSpace colorSpace = ColorSpace::Linear);
Image(const void* data, std::size_t size, ColorSpace colorSpace = ColorSpace::Linear);

/**
* @brief Initializes an empty image.
Expand Down Expand Up @@ -169,8 +169,7 @@ class CUTTLEFISH_EXPORT Image
* @param colorSpace The color space of the image.
* @return False if the image couldn't be loaded.
*/
bool load(const std::uint8_t* data, std::size_t size,
ColorSpace colorSpace = ColorSpace::Linear);
bool load(const void* data, std::size_t size, ColorSpace colorSpace = ColorSpace::Linear);

/**
* @brief Saves an image to a file.
Expand Down
4 changes: 2 additions & 2 deletions lib/src/Image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ Image::Image(const char* fileName, ColorSpace colorSpace)
load(fileName, colorSpace);
}

Image::Image(const std::uint8_t* data, std::size_t size, ColorSpace colorSpace)
Image::Image(const void* data, std::size_t size, ColorSpace colorSpace)
: Image()
{
load(data, size, colorSpace);
Expand Down Expand Up @@ -621,7 +621,7 @@ bool Image::load(const char* fileName, ColorSpace colorSpace)
return m_impl != nullptr;
}

bool Image::load(const std::uint8_t* data, std::size_t size, ColorSpace colorSpace)
bool Image::load(const void* data, std::size_t size, ColorSpace colorSpace)
{
reset();

Expand Down

0 comments on commit 9c376a3

Please sign in to comment.