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_clip
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_clip')
-rw-r--r--source/blender/editors/space_clip/clip_draw.c38
-rw-r--r--source/blender/editors/space_clip/clip_intern.h1
-rw-r--r--source/blender/editors/space_clip/clip_utils.c2
3 files changed, 4 insertions, 37 deletions
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index a17cf0e406d..eaf12a8d51c 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -76,26 +76,6 @@
/*********************** main area drawing *************************/
-void clip_draw_curfra_label(const int framenr, const float x, const float y)
-{
- uiStyle *style = UI_GetStyle();
- int fontid = style->widget.uifont_id;
- char numstr[32];
- float font_dims[2] = {0.0f, 0.0f};
-
- /* frame number */
- BLF_size(fontid, 11.0f * U.pixelsize, U.dpi);
- BLI_snprintf(numstr, sizeof(numstr), "%d", framenr);
-
- BLF_width_and_height(fontid, numstr, sizeof(numstr), &font_dims[0], &font_dims[1]);
-
- glRecti(x, y, x + font_dims[0] + 6.0f, y + font_dims[1] + 4.0f);
-
- UI_ThemeColor(TH_TEXT);
- BLF_position(fontid, x + 2.0f, y + 2.0f, 0.0f);
- BLF_draw(fontid, numstr, sizeof(numstr));
-}
-
static void draw_keyframe(int frame, int cfra, int sfra, float framelen, int width)
{
int height = (frame == cfra) ? 22 : 10;
@@ -183,23 +163,11 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
/* cache background */
- glColor4ub(128, 128, 255, 64);
- glRecti(0, 0, ar->winx, 8 * UI_DPI_FAC);
+ ED_region_cache_draw_background(ar);
/* cached segments -- could be usefu lto debug caching strategies */
BKE_movieclip_get_cache_segments(clip, &sc->user, &totseg, &points);
- if (totseg) {
- glColor4ub(128, 128, 255, 128);
-
- for (a = 0; a < totseg; a++) {
- float x1, x2;
-
- x1 = (points[a * 2] - sfra) / (efra - sfra + 1) * ar->winx;
- x2 = (points[a * 2 + 1] - sfra + 1) / (efra - sfra + 1) * ar->winx;
-
- glRecti(x1, 0, x2, 8 * UI_DPI_FAC);
- }
- }
+ ED_region_cache_draw_cached_segments(ar, totseg, points, sfra, efra);
/* track */
if (act_track || act_plane_track) {
@@ -271,7 +239,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
UI_ThemeColor(TH_CFRAME);
glRecti(x, 0, x + ceilf(framelen), 8 * UI_DPI_FAC);
- clip_draw_curfra_label(sc->user.framenr, x, 8.0f * UI_DPI_FAC);
+ ED_region_cache_draw_curfra_label(sc->user.framenr, x, 8.0f * UI_DPI_FAC);
/* solver keyframes */
glColor4ub(175, 255, 0, 255);
diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h
index 811f8e2eaab..2a5d959bb84 100644
--- a/source/blender/editors/space_clip/clip_intern.h
+++ b/source/blender/editors/space_clip/clip_intern.h
@@ -72,7 +72,6 @@ void CLIP_OT_dopesheet_view_all(struct wmOperatorType *ot);
/* clip_draw.c */
void clip_draw_main(const struct bContext *C, struct SpaceClip *sc, struct ARegion *ar);
void clip_draw_grease_pencil(struct bContext *C, int onlyv2d);
-void clip_draw_curfra_label(const int framenr, const float x, const float y);
void clip_draw_cache_and_notes(const bContext *C, SpaceClip *sc, ARegion *ar);
/* clip_editor.c */
diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c
index fd994d5e1b3..e4392cb579d 100644
--- a/source/blender/editors/space_clip/clip_utils.c
+++ b/source/blender/editors/space_clip/clip_utils.c
@@ -319,7 +319,7 @@ void clip_draw_cfra(SpaceClip *sc, ARegion *ar, Scene *scene)
UI_view2d_getscale(v2d, &xscale, &yscale);
glScalef(1.0f / xscale, 1.0f, 1.0f);
- clip_draw_curfra_label(sc->user.framenr, (float)sc->user.framenr * xscale, 18);
+ ED_region_cache_draw_curfra_label(sc->user.framenr, (float)sc->user.framenr * xscale, 18);
/* restore view transform */
glScalef(xscale, 1.0, 1.0);