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/screen
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/screen')
-rw-r--r--source/blender/editors/screen/area.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 1efd3cc8ace..907f5fe4117 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -2007,3 +2007,49 @@ void ED_region_visible_rect(ARegion *ar, rcti *rect)
BLI_rcti_translate(rect, -ar->winrct.xmin, -ar->winrct.ymin);
}
+/* Cache display helpers */
+
+void ED_region_cache_draw_background(const ARegion *ar)
+{
+ glColor4ub(128, 128, 255, 64);
+ glRecti(0, 0, ar->winx, 8 * UI_DPI_FAC);
+}
+
+void ED_region_cache_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));
+}
+
+void ED_region_cache_draw_cached_segments(const ARegion *ar, const int num_segments, const int *points, const int sfra, const int efra)
+{
+ if (num_segments) {
+ int a;
+
+ glColor4ub(128, 128, 255, 128);
+
+ for (a = 0; a < num_segments; a++) {
+ float x1, x2;
+
+ x1 = (float)(points[a * 2] - sfra) / (efra - sfra + 1) * ar->winx;
+ x2 = (float)(points[a * 2 + 1] - sfra + 1) / (efra - sfra + 1) * ar->winx;
+
+ glRecti(x1, 0, x2, 8 * UI_DPI_FAC);
+ }
+ }
+}
+