mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 01:50:42 -05:00
spans: Represent spans with floating point precision
Instead of using integers to represent spans we now use floats instead. This means we are no longer forced to iterate using non-normalized coordinates so we should hopefully be able to avoid numerous redundant unnormalize/normalize steps when using the spans api. Reviewed-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
parent
c7098e417d
commit
c11036cd13
@ -38,8 +38,7 @@ _cogl_span_iter_update (CoglSpanIter *iter)
|
||||
iter->span = &g_array_index (iter->array, CoglSpan, iter->index);
|
||||
|
||||
/* Offset next position by span size */
|
||||
iter->next_pos = iter->pos +
|
||||
(float)(iter->span->size - iter->span->waste);
|
||||
iter->next_pos = iter->pos + iter->span->size - iter->span->waste;
|
||||
|
||||
/* Check if span intersects the area to cover */
|
||||
if (iter->next_pos <= iter->cover_start ||
|
||||
|
@ -28,9 +28,9 @@
|
||||
|
||||
typedef struct _CoglSpan
|
||||
{
|
||||
int start;
|
||||
int size;
|
||||
int waste;
|
||||
float start;
|
||||
float size;
|
||||
float waste;
|
||||
} CoglSpan;
|
||||
|
||||
typedef struct _CoglSpanIter
|
||||
|
@ -246,8 +246,8 @@ _cogl_texture_2d_sliced_set_waste (CoglTexture2DSliced *tex_2ds,
|
||||
{
|
||||
src = (bmp_data + ((src_y + (int) y_iter->intersect_start - dst_y) *
|
||||
bmp_rowstride) +
|
||||
(src_x + x_span->start + x_span->size -
|
||||
x_span->waste - dst_x - 1) * bpp);
|
||||
(src_x + (int)x_span->start + (int)x_span->size -
|
||||
(int)x_span->waste - dst_x - 1) * bpp);
|
||||
|
||||
dst = waste_buf;
|
||||
|
||||
@ -295,8 +295,8 @@ _cogl_texture_2d_sliced_set_waste (CoglTexture2DSliced *tex_2ds,
|
||||
|
||||
src = (bmp_data + ((src_x + (int) x_iter->intersect_start - dst_x) *
|
||||
bpp) +
|
||||
(src_y + y_span->start + y_span->size - y_span->waste
|
||||
- dst_y - 1) * bmp_rowstride);
|
||||
(src_y + (int)y_span->start + (int)y_span->size -
|
||||
(int)y_span->waste - dst_y - 1) * bmp_rowstride);
|
||||
|
||||
dst = waste_buf;
|
||||
|
||||
@ -790,8 +790,8 @@ _cogl_texture_2d_sliced_slices_create (CoglContext *ctx,
|
||||
|
||||
COGL_NOTE (SLICING, "CREATE SLICE (%d,%d)\tsize (%d,%d)",
|
||||
x, y,
|
||||
x_span->size - x_span->waste,
|
||||
y_span->size - y_span->waste);
|
||||
(int)(x_span->size - x_span->waste),
|
||||
(int)(y_span->size - y_span->waste));
|
||||
|
||||
slice_textures[y * n_x_slices + x] =
|
||||
cogl_texture_2d_new_with_size (ctx, x_span->size, y_span->size,
|
||||
|
Loading…
Reference in New Issue
Block a user