summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-11-23 13:37:00 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-11-23 17:28:44 -0800
commit36081f6486201d9bd316f3a8ceb5a38ad2e97310 (patch)
tree58797124ca97462a455c42314d0235ff6df33d11 /include
parenta620912176c066181c0cc81e41c9205cc2a0d9c0 (diff)
downloadqtlocation-mapboxgl-36081f6486201d9bd316f3a8ceb5a38ad2e97310.tar.gz
[core] For binary image data use uint8_t, not char
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/map/still_image.hpp8
-rw-r--r--include/mbgl/platform/default/image_reader.hpp4
-rw-r--r--include/mbgl/platform/default/jpeg_reader.hpp4
-rw-r--r--include/mbgl/platform/default/png_reader.hpp4
-rw-r--r--include/mbgl/util/image.hpp8
5 files changed, 13 insertions, 15 deletions
diff --git a/include/mbgl/map/still_image.hpp b/include/mbgl/map/still_image.hpp
index b9ce0620fa..36922fe95a 100644
--- a/include/mbgl/map/still_image.hpp
+++ b/include/mbgl/map/still_image.hpp
@@ -3,17 +3,15 @@
#include <mbgl/util/noncopyable.hpp>
-#include <string>
#include <cstdint>
namespace mbgl {
class StillImage : util::noncopyable {
public:
- uint16_t width = 0;
- uint16_t height = 0;
- using Pixel = uint32_t;
- std::unique_ptr<Pixel[]> pixels;
+ size_t width = 0;
+ size_t height = 0;
+ std::unique_ptr<uint8_t[]> pixels;
};
}
diff --git a/include/mbgl/platform/default/image_reader.hpp b/include/mbgl/platform/default/image_reader.hpp
index 52a67a2830..8e293d8be3 100644
--- a/include/mbgl/platform/default/image_reader.hpp
+++ b/include/mbgl/platform/default/image_reader.hpp
@@ -31,11 +31,11 @@ struct ImageReader : private noncopyable
virtual unsigned height() const=0;
virtual bool hasAlpha() const=0;
virtual bool premultipliedAlpha() const=0;
- virtual void read(unsigned x,unsigned y, unsigned width, unsigned height, char* image)=0;
+ virtual void read(unsigned x, unsigned y, unsigned width, unsigned height, uint8_t* image)=0;
virtual ~ImageReader() {}
};
-std::unique_ptr<ImageReader> getImageReader(char const* data, size_t size);
+std::unique_ptr<ImageReader> getImageReader(const uint8_t* data, size_t size);
}}
diff --git a/include/mbgl/platform/default/jpeg_reader.hpp b/include/mbgl/platform/default/jpeg_reader.hpp
index 3e64ce291b..d877005354 100644
--- a/include/mbgl/platform/default/jpeg_reader.hpp
+++ b/include/mbgl/platform/default/jpeg_reader.hpp
@@ -51,13 +51,13 @@ private:
unsigned width_;
unsigned height_;
public:
- JpegReader(char const* data, size_t size);
+ JpegReader(const uint8_t* data, size_t size);
~JpegReader();
unsigned width() const;
unsigned height() const;
inline bool hasAlpha() const { return false; }
inline bool premultipliedAlpha() const { return true; }
- void read(unsigned x,unsigned y, unsigned w, unsigned h, char *image);
+ void read(unsigned x, unsigned y, unsigned w, unsigned h, uint8_t* image);
private:
void init();
static void on_error(j_common_ptr cinfo);
diff --git a/include/mbgl/platform/default/png_reader.hpp b/include/mbgl/platform/default/png_reader.hpp
index 5cbbc51e77..9d6af91daa 100644
--- a/include/mbgl/platform/default/png_reader.hpp
+++ b/include/mbgl/platform/default/png_reader.hpp
@@ -49,13 +49,13 @@ private:
int color_type_;
bool has_alpha_;
public:
- PngReader(char const* data, std::size_t size);
+ PngReader(const uint8_t* data, std::size_t size);
~PngReader();
unsigned width() const;
unsigned height() const;
inline bool hasAlpha() const { return has_alpha_; }
bool premultipliedAlpha() const { return true; } // png_set_alpha_mode(png, PNG_ALPHA_PREMULTIPLIED, 2.2)
- void read(unsigned x,unsigned y, unsigned width, unsigned height, char * image);
+ void read(unsigned x,unsigned y, unsigned width, unsigned height, uint8_t* image);
private:
void init();
static void png_read_data(png_structp png_ptr, png_bytep data, png_size_t length);
diff --git a/include/mbgl/util/image.hpp b/include/mbgl/util/image.hpp
index f58c2c0989..fc4078501e 100644
--- a/include/mbgl/util/image.hpp
+++ b/include/mbgl/util/image.hpp
@@ -7,14 +7,14 @@
namespace mbgl {
namespace util {
-std::string compress_png(int width, int height, const void *rgba);
+std::string compress_png(size_t width, size_t height, const uint8_t* rgba);
class Image {
public:
- explicit Image(const std::string &img);
+ explicit Image(const std::string& img);
- inline const char *getData() const { return img.get(); }
+ inline const uint8_t* getData() const { return img.get(); }
inline uint32_t getWidth() const { return width; }
inline uint32_t getHeight() const { return height; }
inline operator bool() const { return img && width && height; }
@@ -24,7 +24,7 @@ private:
uint32_t width = 0, height = 0;
// the raw image data
- std::unique_ptr<char[]> img;
+ std::unique_ptr<uint8_t[]> img;
};