diff options
-rw-r--r-- | CONTRIBUTING | 17 | ||||
-rw-r--r-- | src/image.c | 4 | ||||
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/texture.c | 4 |
4 files changed, 24 insertions, 3 deletions
diff --git a/CONTRIBUTING b/CONTRIBUTING new file mode 100644 index 0000000..143eb21 --- /dev/null +++ b/CONTRIBUTING @@ -0,0 +1,17 @@ + imv Contributing Guidelines + =========================== + +1) Please keep pull requests rebased onto the latest master. All merges should + be simple fast-forward merges. While rebasing, tidy up and merge your commits + as you think appropriate. + +2) Please ensure that your changes fit with the existing coding style of imv. + Strictly no tabs, and 2 spaces of indentation. + +3) All contributions must be provided under the license included with imv: the + GNU General Public License Version 2. You retain the copyright ownership of + any contributions you make. + +4) If your pull request isn't immediately accepted please don't take it + personally. We hope to retain a high level of code quality as the project + matures. diff --git a/src/image.c b/src/image.c index b2bf2c9..c7bac62 100644 --- a/src/image.c +++ b/src/image.c @@ -150,6 +150,10 @@ void imv_image_load_next_frame(struct imv_image *img) frame_time = *(int*)FreeImage_GetTagValue(tag); } + /* some gifs don't provide a frame time at all */ + if(frame_time == 0) { + frame_time = 100; + } img->frame_time += frame_time * 0.001; FreeImage_UnlockPage(img->mbmp, frame, 0); @@ -272,6 +272,7 @@ int main(int argc, char** argv) if(view.playing) { double cur_time = SDL_GetTicks() / 1000.0; double dt = cur_time - last_time; + last_time = SDL_GetTicks() / 1000.0; imv_image_play(&img, dt); } @@ -286,7 +287,6 @@ int main(int argc, char** argv) view.redraw = 0; SDL_RenderPresent(renderer); } - last_time = SDL_GetTicks() / 1000.0; SDL_Delay(10); } diff --git a/src/texture.c b/src/texture.c index 2ce328f..a5c5001 100644 --- a/src/texture.c +++ b/src/texture.c @@ -25,8 +25,8 @@ void imv_init_texture(struct imv_texture *tex, SDL_Renderer *r) SDL_RendererInfo ri; SDL_GetRendererInfo(r, &ri); - tex->chunk_width = ri.max_texture_width; - tex->chunk_height = ri.max_texture_height; + tex->chunk_width = ri.max_texture_width != 0 ? ri.max_texture_width : 4096; + tex->chunk_height = ri.max_texture_height != 0 ? ri.max_texture_height : 4096; } void imv_destroy_texture(struct imv_texture *tex) |