Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-04-02 14:50:06 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-04-02 14:54:30 +0400
commit11ee2d8b97ddbdde9ef5a7b77df2b9f9eb2d0e91 (patch)
tree45c8792b3bd4efa9567a730a324efb2491284dbe /source/blender/editors/space_image
parent6cd717e0a3c6151f6dc578dcfc27cc269b172c99 (diff)
implement cache line for image editor
It works exactly the same as a cache line in movie clip editor.
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r--source/blender/editors/space_image/image_draw.c48
-rw-r--r--source/blender/editors/space_image/image_intern.h1
-rw-r--r--source/blender/editors/space_image/space_image.c4
3 files changed, 51 insertions, 2 deletions
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 2cdd105fac9..27d2a19016d 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -40,6 +40,7 @@
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_brush_types.h"
+#include "DNA_mask_types.h"
#include "PIL_time.h"
@@ -52,6 +53,7 @@
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
#include "IMB_colormanagement.h"
+#include "IMB_moviecache.h"
#include "BKE_context.h"
#include "BKE_global.h"
@@ -65,6 +67,7 @@
#include "ED_gpencil.h"
#include "ED_image.h"
+#include "ED_mask.h"
#include "ED_screen.h"
#include "UI_interface.h"
@@ -884,3 +887,48 @@ void draw_image_main(const bContext *C, ARegion *ar)
if (ima && show_render)
draw_render_info(scene, ima, ar, zoomx, zoomy);
}
+
+void draw_image_cache(const bContext *C, ARegion *ar)
+{
+ SpaceImage *sima = CTX_wm_space_image(C);
+ Scene *scene = CTX_data_scene(C);
+ Image *image = ED_space_image(sima);
+ float x, cfra = CFRA, sfra = SFRA, efra = EFRA, framelen = ar->winx / (efra - sfra + 1);
+ Mask *mask = NULL;
+
+ if (sima->mode == SI_MODE_MASK) {
+ mask = ED_space_image_get_mask(sima);
+ }
+
+ if (image == NULL && mask == NULL) {
+ return;
+ }
+
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ /* Draw cache background. */
+ ED_region_cache_draw_background(ar);
+
+ /* Draw cached segments. */
+ if (image != NULL && image->cache != NULL && ELEM(image->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) {
+ int num_segments = 0;
+ int *points = NULL;
+
+ IMB_moviecache_get_cache_segments(image->cache, IMB_PROXY_NONE, 0, &num_segments, &points);
+ ED_region_cache_draw_cached_segments(ar, num_segments, points, sfra + sima->iuser.offset, efra + sima->iuser.offset);
+ }
+
+ glDisable(GL_BLEND);
+
+ /* Draw current frame. */
+ x = (cfra - sfra) / (efra - sfra + 1) * ar->winx;
+
+ UI_ThemeColor(TH_CFRAME);
+ glRecti(x, 0, x + ceilf(framelen), 8 * UI_DPI_FAC);
+ ED_region_cache_draw_curfra_label(cfra, x, 8.0f * UI_DPI_FAC);
+
+ if (mask != NULL) {
+ ED_mask_draw_frames(mask, ar, cfra, sfra, efra);
+ }
+}
diff --git a/source/blender/editors/space_image/image_intern.h b/source/blender/editors/space_image/image_intern.h
index 30fa5f4baa2..a6c7e156f90 100644
--- a/source/blender/editors/space_image/image_intern.h
+++ b/source/blender/editors/space_image/image_intern.h
@@ -53,6 +53,7 @@ extern const char *image_context_dir[]; /* doc access */
/* image_draw.c */
void draw_image_main(const struct bContext *C, struct ARegion *ar);
+void draw_image_cache(const struct bContext *C, struct ARegion *ar);
void draw_image_grease_pencil(struct bContext *C, bool onlyv2d);
void draw_image_sample_line(struct SpaceImage *sima);
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 1224ade8337..50f3bc2f552 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -739,13 +739,13 @@ static void image_main_area_draw(const bContext *C, ARegion *ar)
true, false,
NULL, C);
- ED_mask_draw_frames(mask, ar, CFRA, mask->sfra, mask->efra);
-
UI_view2d_view_ortho(v2d);
draw_image_cursor(ar, sima->cursor);
UI_view2d_view_restore(C);
}
+ draw_image_cache(C, ar);
+
/* scrollers? */
#if 0
scrollers = UI_view2d_scrollers_calc(C, v2d, V2D_UNIT_VALUES, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);