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>2013-12-13 14:22:08 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-12-13 14:30:00 +0400
commitce893552c359d11cfa93709f239a3c93f4cdb244 (patch)
treed9474f190006e89547044c241081f320c44c3a36 /source/blender/gpu
parent7eab49f8d923ed3992dff1236e30a62f2d70f460 (diff)
Image cache rewrite to using generic movie cache
Summary: Behaves very much the same as cache for Movie Clip datablock: - Image now have `MovieCache *cache` field which replaced legacy `ListBase ibufs`. This allows image datablock to easily keep of image buffers which are owned by itself. This field isn't saved to the file and getting restored on undo steps. However, cache limit is global for movies, sequences and image datablocks now. So overall cached image buffers size will not go above cache limit size in user preferences. - Image buffers which are marked as BITMAPDIRTY will never be freed from the cache. - Added utility function to iterate over image buffers saved in movie cache. - Movie cache cleanup check callback now have ImBuf argument which can be used in a condition of cleanup. - Added some utility functions which replaces legacy ibufs iterations with image cache iteration which happens from inside a lock. - Fixed `image_mem_size()` which was only counting one of the buffers if both float and byte buffer present. Additional notes: - `BKE_image_get_first_ibuf()` is rather stupid, but direct access to ibufs->first was also the same stupid idea. Would consider avoid this function is another project. - There are some places which doesn't look threadsafe, but they already were not so much threadsafe anyway before. So think not a big deal with solving this later. Finally solves infinite memory usage by image sequences! :) Reviewers: brecht, campbellbarton Reviewed By: brecht CC: sebastian_k Differential Revision: http://developer.blender.org/D95
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/intern/gpu_draw.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 0dba2cd50e8..ee59cf418bf 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -93,6 +93,7 @@ void GPU_render_text(MTFace *tface, int mode,
{
if ((mode & GEMAT_TEXT) && (textlen>0) && tface->tpage) {
Image* ima = (Image *)tface->tpage;
+ ImBuf *first_ibuf;
int index, character;
float centerx, centery, sizex, sizey, transx, transy, movex, movey, advance;
float advance_tab;
@@ -117,7 +118,8 @@ void GPU_render_text(MTFace *tface, int mode,
glPushMatrix();
/* get the tab width */
- matrixGlyph((ImBuf *)ima->ibufs.first, ' ', & centerx, &centery,
+ first_ibuf = BKE_image_get_first_ibuf(ima);
+ matrixGlyph(first_ibuf, ' ', &centerx, &centery,
&sizex, &sizey, &transx, &transy, &movex, &movey, &advance);
advance_tab= advance * 4; /* tab width could also be an option */
@@ -143,7 +145,7 @@ void GPU_render_text(MTFace *tface, int mode,
// space starts at offset 1
// character = character - ' ' + 1;
- matrixGlyph((ImBuf *)ima->ibufs.first, character, & centerx, &centery,
+ matrixGlyph(first_ibuf, character, & centerx, &centery,
&sizex, &sizey, &transx, &transy, &movex, &movey, &advance);
uv[0][0] = (tface->uv[0][0] - centerx) * sizex + transx;
@@ -184,6 +186,8 @@ void GPU_render_text(MTFace *tface, int mode,
line_start -= advance; /* so we can go back to the start of the line */
}
glPopMatrix();
+
+ IMB_freeImBuf(first_ibuf);
}
}