diff options
Diffstat (limited to 'src/mbgl/util/raster.hpp')
-rw-r--r-- | src/mbgl/util/raster.hpp | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/src/mbgl/util/raster.hpp b/src/mbgl/util/raster.hpp index 17319394c4..6223440bd6 100644 --- a/src/mbgl/util/raster.hpp +++ b/src/mbgl/util/raster.hpp @@ -2,22 +2,21 @@ #include <mbgl/gl/object_store.hpp> #include <mbgl/util/image.hpp> -#include <mbgl/util/ptr.hpp> -#include <mbgl/util/chrono.hpp> #include <mbgl/util/optional.hpp> - -#include <mutex> +#include <mbgl/util/atomic.hpp> namespace mbgl { -class Raster : public std::enable_shared_from_this<Raster> { - +class Raster { public: + enum class MipMap : bool { No = false, Yes = true }; + enum class Scaling : bool { Nearest = false, Linear = true }; + // load image data - void load(PremultipliedImage); + void load(PremultipliedImage, uint32_t mipmapLevel = 0); // bind current texture - void bind(bool linear, gl::ObjectStore&); + void bind(gl::ObjectStore&, Scaling = Scaling::Nearest, MipMap = MipMap::No); // uploads the texture if it hasn't been uploaded yet. void upload(gl::ObjectStore&); @@ -25,28 +24,19 @@ public: // loaded status bool isLoaded() const; -public: - // loaded image dimensions - GLsizei width = 0; - GLsizei height = 0; - - // GL buffer object handle. - mbgl::optional<gl::UniqueTexture> texture; - - // texture opacity - double opacity = 0; - private: - mutable std::mutex mtx; - // raw pixels have been loaded - bool loaded = false; + util::Atomic<bool> loaded { false }; - // min/mag filter - GLint filter = 0; + // filters + Scaling filter = Scaling::Nearest; + MipMap mipmap = MipMap::No; // the raw pixels - PremultipliedImage img; + std::vector<PremultipliedImage> images; + + // GL buffer object handle. + mbgl::optional<gl::UniqueTexture> texture; }; } // namespace mbgl |