add warning when line atlas is overflowed

This commit is contained in:
Ansis Brammanis
2015-01-16 13:37:13 -05:00
parent 221d256bea
commit 1ce0ca0b7a
2 changed files with 5 additions and 3 deletions

View File

@@ -33,7 +33,6 @@ LinePatternPos LineAtlas::getDashPosition(const std::vector<float> &dasharray, b
std::string key = sskey.str();
if (positions.find(key) == positions.end()) {
//fprintf(stderr, "add %s\n", key.c_str());
positions[key] = addDash(dasharray, round);
}
@@ -46,7 +45,10 @@ LinePatternPos LineAtlas::addDash(const std::vector<float> &dasharray, bool roun
int dashheight = 2 * n + 1;
const uint8_t offset = 128;
// TODO check if enough space
if (nextRow + dashheight > height) {
fprintf(stderr, "[WARNING] line atlas bitmap overflow\n");
return LinePatternPos();
}
float length = 0;
for (const float &part : dasharray) {

View File

@@ -32,7 +32,7 @@ private:
char *const data = nullptr;
std::atomic<bool> dirty;
uint32_t texture = 0;
uint32_t nextRow = 0;
int nextRow = 0;
std::map<std::string, LinePatternPos> positions;
};