Skip to content

Commit

Permalink
Surface constructor that takes std::vector with image file bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
rsaarelm committed Apr 22, 2012
1 parent fb9a636 commit ec91b18
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/util/surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ Surface::Surface(std::initializer_list<uint8_t> args)
load_image(args.begin(), args.size());
}

Surface::Surface(std::vector<uint8_t> data)
: data_(nullptr)
, width_(0)
, height_(0) {
load_image(data.data(), data.size());
}

Surface::Surface(int width, int height)
: data_(nullptr)
, width_(0)
Expand Down
1 change: 1 addition & 0 deletions src/util/surface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Surface {
Surface();
Surface(const char* filename);
Surface(std::initializer_list<uint8_t> args);
Surface(std::vector<uint8_t> data);
Surface(int width, int height);
Surface(const Vec2i& dim);
~Surface();
Expand Down

0 comments on commit ec91b18

Please sign in to comment.