diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2016-04-02 13:00:29 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2016-04-02 13:00:29 +0200 |
commit | f8420e0a46e1069220dcd642bca30c3fcb8c1b91 (patch) | |
tree | 4f07eaf8f8fa4829c541d8aea66a3769c8080454 /src/renderer.c | |
parent | 2a8925a8612b5e632b0dbaa762ce834ad61704a8 (diff) |
Don't update xsections if unnecessary.
Diffstat (limited to 'src/renderer.c')
-rw-r--r-- | src/renderer.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/renderer.c b/src/renderer.c index 3c403a0..fb1647b 100644 --- a/src/renderer.c +++ b/src/renderer.c @@ -360,13 +360,21 @@ void r_xsection_destroy(r_xsection *xsection) } int r_xsection_update(r_window *rw, r_xsection *xsection, - phy_field_info *fi, float *field, + phy_field_info *fi, float *field, int64_t frame_index, r_xsection_type type, float frac) { size_t width, height, x, y, z; uint8_t *pixels; int pitch; + if (xsection->frame_index && + xsection->frame_index == frame_index && + xsection->last_frac == frac && + xsection->last_type == type) + return 0; // nothing's changed + + printf("r_xsection_update: tick %ld\n", frame_index); + switch (type) { case XSECTION_XY: width = fi->width; @@ -462,6 +470,9 @@ int r_xsection_update(r_window *rw, r_xsection *xsection, xsection->aspect_ratio = (float)width / height; + xsection->last_frac = frac; + xsection->last_type = type; + xsection->frame_index = frame_index; return 0; } |