Add gfx::texture_atlas_2d::used_pixels()

This commit is contained in:
Nikita Lisitsa 2022-03-13 18:00:47 +03:00
parent c5ca7a3c4f
commit 8d41e7fcd9

View file

@ -21,9 +21,12 @@ namespace psemek::gfx
texture_view find(Key const & key) const;
texture_view at(Key const & key) const;
std::size_t used_pixels() const { return used_pixels_; }
private:
util::atlas<Pixel, 2, Key, Compare> atlas_;
texture_2d texture_;
std::size_t used_pixels_ = 0;
void update_texture();
@ -42,6 +45,8 @@ namespace psemek::gfx
if (result.second)
update_texture();
used_pixels_ += data.size();
return {to_view(result.first), result.second};
}