[Spice-devel] [PATCH 14/18] worker: move spice_bitmap_get_line
Fabiano Fidêncio
fabiano at fidencio.org
Fri Nov 20 08:25:04 PST 2015
Perhaps "add spice_bitmap_get_line()" would be a better commit message.
But why is this added? where is it going to be used? If it was really
supposed to be moved ... moved from where?
On Fri, Nov 20, 2015 at 12:17 PM, Frediano Ziglio <fziglio at redhat.com> wrote:
> From: Marc-André Lureau <marcandre.lureau at gmail.com>
>
> ---
> server/spice_bitmap_utils.c | 27 +++++++++++++++++++++++++++
> server/spice_bitmap_utils.h | 3 +++
> 2 files changed, 30 insertions(+)
>
> diff --git a/server/spice_bitmap_utils.c b/server/spice_bitmap_utils.c
> index ae3fc8b..3b992a7 100644
> --- a/server/spice_bitmap_utils.c
> +++ b/server/spice_bitmap_utils.c
> @@ -186,3 +186,30 @@ void dump_bitmap(SpiceBitmap *bitmap)
> }
> fclose(f);
> }
> +
> +uint8_t *spice_bitmap_get_line(const SpiceBitmap *image, size_t *offset,
> + int *chunk_nr, int stride)
> +{
> + SpiceChunks *chunks = image->data;
> + uint8_t *ret;
> + SpiceChunk *chunk;
> +
> + chunk = &chunks->chunk[*chunk_nr];
> +
> + if (*offset == chunk->len) {
> + if (*chunk_nr == chunks->num_chunks - 1) {
> + return NULL; /* Last chunk */
> + }
> + *offset = 0;
> + (*chunk_nr)++;
> + chunk = &chunks->chunk[*chunk_nr];
> + }
> +
> + if (chunk->len - *offset < stride) {
> + spice_warning("bad chunk alignment");
> + return NULL;
> + }
> + ret = chunk->data + *offset;
> + *offset += stride;
> + return ret;
> +}
> diff --git a/server/spice_bitmap_utils.h b/server/spice_bitmap_utils.h
> index 69860e5..9d3a5ae 100644
> --- a/server/spice_bitmap_utils.h
> +++ b/server/spice_bitmap_utils.h
> @@ -5,4 +5,7 @@ void dump_bitmap(SpiceBitmap *bitmap);
>
> int spice_bitmap_from_surface_type(uint32_t surface_format);
>
> +uint8_t *spice_bitmap_get_line(const SpiceBitmap *image, size_t *offset,
> + int *chunk_nr, int stride);
> +
> #endif
> --
> 2.4.3
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
NACK for now ...
--
Fabiano Fidêncio
More information about the Spice-devel
mailing list