BaseImage.cc 475 B

12345678910111213141516171819202122
  1. #include "BaseImage.hh"
  2. #include "MSXException.hh"
  3. namespace openmsx {
  4. constexpr int MAX_SIZE = 2048;
  5. void BaseImage::checkSize(gl::ivec2 size)
  6. {
  7. auto [w, h] = size;
  8. if (w < -MAX_SIZE || w > MAX_SIZE) {
  9. throw MSXException("Image width too large: ", w,
  10. " (max ", MAX_SIZE, ')');
  11. }
  12. if (h < -MAX_SIZE || h > MAX_SIZE) {
  13. throw MSXException("Image height too large: ", h,
  14. " (max ", MAX_SIZE, ')');
  15. }
  16. }
  17. } // namespace openmsx