[Spice-commits] 3 commits - common/canvas_base.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Apr 24 16:19:08 UTC 2020
common/canvas_base.c | 118 ---------------------------------------------------
1 file changed, 1 insertion(+), 117 deletions(-)
New commits:
commit 4c6b360f6baf92eb6718a2dc5b52a0cc2fb0e6a3
Author: Frediano Ziglio <freddy77 at gmail.com>
Date: Fri Apr 24 07:30:34 2020 +0100
canvas_base: Remove canvas_draw_blend/canvas_draw_copy duplication
The 2 functions are exactly the same.
Signed-off-by: Frediano Ziglio <freddy77 at gmail.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>
diff --git a/common/canvas_base.c b/common/canvas_base.c
index 7f3a6e8..07b8dee 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -2484,126 +2484,6 @@ static void canvas_draw_opaque(SpiceCanvas *spice_canvas, SpiceRect *bbox, Spice
pixman_region32_fini(&dest_region);
}
-static void canvas_draw_blend(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *copy)
-{
- CanvasBase *canvas = (CanvasBase *)spice_canvas;
- pixman_region32_t dest_region;
- SpiceCanvas *surface_canvas;
- pixman_image_t *src_image;
- SpiceROP rop;
-
- pixman_region32_init_rect(&dest_region,
- bbox->left, bbox->top,
- bbox->right - bbox->left,
- bbox->bottom - bbox->top);
-
- canvas_clip_pixman(canvas, &dest_region, clip);
- canvas_mask_pixman(canvas, &dest_region, ©->mask,
- bbox->left, bbox->top);
-
- rop = ropd_descriptor_to_rop(copy->rop_descriptor,
- ROP_INPUT_SRC,
- ROP_INPUT_DEST);
-
- if (rop == SPICE_ROP_NOOP || !pixman_region32_not_empty(&dest_region)) {
- canvas_touch_image(canvas, copy->src_bitmap);
- pixman_region32_fini(&dest_region);
- return;
- }
-
- surface_canvas = canvas_get_surface(canvas, copy->src_bitmap);
- if (surface_canvas) {
- if (rect_is_same_size(bbox, ©->src_area)) {
- if (rop == SPICE_ROP_COPY) {
- spice_canvas->ops->blit_image_from_surface(spice_canvas, &dest_region,
- surface_canvas,
- bbox->left - copy->src_area.left,
- bbox->top - copy->src_area.top);
- } else {
- spice_canvas->ops->blit_image_rop_from_surface(spice_canvas, &dest_region,
- surface_canvas,
- bbox->left - copy->src_area.left,
- bbox->top - copy->src_area.top,
- rop);
- }
- } else {
- if (rop == SPICE_ROP_COPY) {
- spice_canvas->ops->scale_image_from_surface(spice_canvas, &dest_region,
- surface_canvas,
- copy->src_area.left,
- copy->src_area.top,
- copy->src_area.right - copy->src_area.left,
- copy->src_area.bottom - copy->src_area.top,
- bbox->left,
- bbox->top,
- bbox->right - bbox->left,
- bbox->bottom - bbox->top,
- copy->scale_mode);
- } else {
- spice_canvas->ops->scale_image_rop_from_surface(spice_canvas, &dest_region,
- surface_canvas,
- copy->src_area.left,
- copy->src_area.top,
- copy->src_area.right - copy->src_area.left,
- copy->src_area.bottom - copy->src_area.top,
- bbox->left,
- bbox->top,
- bbox->right - bbox->left,
- bbox->bottom - bbox->top,
- copy->scale_mode,
- rop);
- }
- }
- } else {
- src_image = canvas_get_image(canvas, copy->src_bitmap, FALSE);
- spice_return_if_fail(src_image != NULL);
-
- if (rect_is_same_size(bbox, ©->src_area)) {
- if (rop == SPICE_ROP_COPY) {
- spice_canvas->ops->blit_image(spice_canvas, &dest_region,
- src_image,
- bbox->left - copy->src_area.left,
- bbox->top - copy->src_area.top);
- } else {
- spice_canvas->ops->blit_image_rop(spice_canvas, &dest_region,
- src_image,
- bbox->left - copy->src_area.left,
- bbox->top - copy->src_area.top,
- rop);
- }
- } else {
- if (rop == SPICE_ROP_COPY) {
- spice_canvas->ops->scale_image(spice_canvas, &dest_region,
- src_image,
- copy->src_area.left,
- copy->src_area.top,
- copy->src_area.right - copy->src_area.left,
- copy->src_area.bottom - copy->src_area.top,
- bbox->left,
- bbox->top,
- bbox->right - bbox->left,
- bbox->bottom - bbox->top,
- copy->scale_mode);
- } else {
- spice_canvas->ops->scale_image_rop(spice_canvas, &dest_region,
- src_image,
- copy->src_area.left,
- copy->src_area.top,
- copy->src_area.right - copy->src_area.left,
- copy->src_area.bottom - copy->src_area.top,
- bbox->left,
- bbox->top,
- bbox->right - bbox->left,
- bbox->bottom - bbox->top,
- copy->scale_mode,
- rop);
- }
- }
- pixman_image_unref(src_image);
- }
- pixman_region32_fini(&dest_region);
-}
-
static void canvas_draw_blackness(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness)
{
CanvasBase *canvas = (CanvasBase *)spice_canvas;
@@ -3427,7 +3307,7 @@ inline static void canvas_base_init_ops(SpiceCanvasOps *ops)
ops->draw_copy = canvas_draw_copy;
ops->draw_opaque = canvas_draw_opaque;
ops->copy_bits = canvas_copy_bits;
- ops->draw_blend = canvas_draw_blend;
+ ops->draw_blend = canvas_draw_copy; // copy and blend are the same
ops->draw_blackness = canvas_draw_blackness;
ops->draw_whiteness = canvas_draw_whiteness;
ops->draw_invers = canvas_draw_invers;
commit 3caedf3bc28b34bd4e04e65ae7fcf0d7302cd07e
Author: Frediano Ziglio <freddy77 at gmail.com>
Date: Fri Apr 24 06:57:43 2020 +0100
canvas_base: Rename blend to copy for canvas_draw_blend argument
SpiceCopy and SpiceBlend are typedefs of the same structure.
This to prove that canvas_draw_blend and canvas_draw_copy do
exactly the same thing.
Signed-off-by: Frediano Ziglio <freddy77 at gmail.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>
diff --git a/common/canvas_base.c b/common/canvas_base.c
index 838c1ac..7f3a6e8 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -2484,7 +2484,7 @@ static void canvas_draw_opaque(SpiceCanvas *spice_canvas, SpiceRect *bbox, Spice
pixman_region32_fini(&dest_region);
}
-static void canvas_draw_blend(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend)
+static void canvas_draw_blend(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *copy)
{
CanvasBase *canvas = (CanvasBase *)spice_canvas;
pixman_region32_t dest_region;
@@ -2498,104 +2498,104 @@ static void canvas_draw_blend(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceC
bbox->bottom - bbox->top);
canvas_clip_pixman(canvas, &dest_region, clip);
- canvas_mask_pixman(canvas, &dest_region, &blend->mask,
+ canvas_mask_pixman(canvas, &dest_region, ©->mask,
bbox->left, bbox->top);
- rop = ropd_descriptor_to_rop(blend->rop_descriptor,
+ rop = ropd_descriptor_to_rop(copy->rop_descriptor,
ROP_INPUT_SRC,
ROP_INPUT_DEST);
if (rop == SPICE_ROP_NOOP || !pixman_region32_not_empty(&dest_region)) {
- canvas_touch_image(canvas, blend->src_bitmap);
+ canvas_touch_image(canvas, copy->src_bitmap);
pixman_region32_fini(&dest_region);
return;
}
- surface_canvas = canvas_get_surface(canvas, blend->src_bitmap);
+ surface_canvas = canvas_get_surface(canvas, copy->src_bitmap);
if (surface_canvas) {
- if (rect_is_same_size(bbox, &blend->src_area)) {
+ if (rect_is_same_size(bbox, ©->src_area)) {
if (rop == SPICE_ROP_COPY) {
spice_canvas->ops->blit_image_from_surface(spice_canvas, &dest_region,
surface_canvas,
- bbox->left - blend->src_area.left,
- bbox->top - blend->src_area.top);
+ bbox->left - copy->src_area.left,
+ bbox->top - copy->src_area.top);
} else {
spice_canvas->ops->blit_image_rop_from_surface(spice_canvas, &dest_region,
surface_canvas,
- bbox->left - blend->src_area.left,
- bbox->top - blend->src_area.top,
+ bbox->left - copy->src_area.left,
+ bbox->top - copy->src_area.top,
rop);
}
} else {
if (rop == SPICE_ROP_COPY) {
spice_canvas->ops->scale_image_from_surface(spice_canvas, &dest_region,
surface_canvas,
- blend->src_area.left,
- blend->src_area.top,
- blend->src_area.right - blend->src_area.left,
- blend->src_area.bottom - blend->src_area.top,
+ copy->src_area.left,
+ copy->src_area.top,
+ copy->src_area.right - copy->src_area.left,
+ copy->src_area.bottom - copy->src_area.top,
bbox->left,
bbox->top,
bbox->right - bbox->left,
bbox->bottom - bbox->top,
- blend->scale_mode);
+ copy->scale_mode);
} else {
spice_canvas->ops->scale_image_rop_from_surface(spice_canvas, &dest_region,
surface_canvas,
- blend->src_area.left,
- blend->src_area.top,
- blend->src_area.right - blend->src_area.left,
- blend->src_area.bottom - blend->src_area.top,
+ copy->src_area.left,
+ copy->src_area.top,
+ copy->src_area.right - copy->src_area.left,
+ copy->src_area.bottom - copy->src_area.top,
bbox->left,
bbox->top,
bbox->right - bbox->left,
bbox->bottom - bbox->top,
- blend->scale_mode,
+ copy->scale_mode,
rop);
}
}
} else {
- src_image = canvas_get_image(canvas, blend->src_bitmap, FALSE);
+ src_image = canvas_get_image(canvas, copy->src_bitmap, FALSE);
spice_return_if_fail(src_image != NULL);
- if (rect_is_same_size(bbox, &blend->src_area)) {
+ if (rect_is_same_size(bbox, ©->src_area)) {
if (rop == SPICE_ROP_COPY) {
spice_canvas->ops->blit_image(spice_canvas, &dest_region,
src_image,
- bbox->left - blend->src_area.left,
- bbox->top - blend->src_area.top);
+ bbox->left - copy->src_area.left,
+ bbox->top - copy->src_area.top);
} else {
spice_canvas->ops->blit_image_rop(spice_canvas, &dest_region,
src_image,
- bbox->left - blend->src_area.left,
- bbox->top - blend->src_area.top,
+ bbox->left - copy->src_area.left,
+ bbox->top - copy->src_area.top,
rop);
}
} else {
if (rop == SPICE_ROP_COPY) {
spice_canvas->ops->scale_image(spice_canvas, &dest_region,
src_image,
- blend->src_area.left,
- blend->src_area.top,
- blend->src_area.right - blend->src_area.left,
- blend->src_area.bottom - blend->src_area.top,
+ copy->src_area.left,
+ copy->src_area.top,
+ copy->src_area.right - copy->src_area.left,
+ copy->src_area.bottom - copy->src_area.top,
bbox->left,
bbox->top,
bbox->right - bbox->left,
bbox->bottom - bbox->top,
- blend->scale_mode);
+ copy->scale_mode);
} else {
spice_canvas->ops->scale_image_rop(spice_canvas, &dest_region,
src_image,
- blend->src_area.left,
- blend->src_area.top,
- blend->src_area.right - blend->src_area.left,
- blend->src_area.bottom - blend->src_area.top,
+ copy->src_area.left,
+ copy->src_area.top,
+ copy->src_area.right - copy->src_area.left,
+ copy->src_area.bottom - copy->src_area.top,
bbox->left,
bbox->top,
bbox->right - bbox->left,
bbox->bottom - bbox->top,
- blend->scale_mode,
+ copy->scale_mode,
rop);
}
}
commit a971c59166f473b2e5802b51935a28ac02702fdc
Author: Frediano Ziglio <freddy77 at gmail.com>
Date: Fri Apr 24 06:55:52 2020 +0100
canvas_base: Format canvas_draw_blend similarly to canvas_draw_copy
Just minor style changes.
Signed-off-by: Frediano Ziglio <freddy77 at gmail.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>
diff --git a/common/canvas_base.c b/common/canvas_base.c
index 3a1c83f..838c1ac 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -2487,9 +2487,9 @@ static void canvas_draw_opaque(SpiceCanvas *spice_canvas, SpiceRect *bbox, Spice
static void canvas_draw_blend(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend)
{
CanvasBase *canvas = (CanvasBase *)spice_canvas;
+ pixman_region32_t dest_region;
SpiceCanvas *surface_canvas;
pixman_image_t *src_image;
- pixman_region32_t dest_region;
SpiceROP rop;
pixman_region32_init_rect(&dest_region,
@@ -2514,17 +2514,18 @@ static void canvas_draw_blend(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceC
surface_canvas = canvas_get_surface(canvas, blend->src_bitmap);
if (surface_canvas) {
if (rect_is_same_size(bbox, &blend->src_area)) {
- if (rop == SPICE_ROP_COPY)
+ if (rop == SPICE_ROP_COPY) {
spice_canvas->ops->blit_image_from_surface(spice_canvas, &dest_region,
surface_canvas,
bbox->left - blend->src_area.left,
bbox->top - blend->src_area.top);
- else
+ } else {
spice_canvas->ops->blit_image_rop_from_surface(spice_canvas, &dest_region,
surface_canvas,
bbox->left - blend->src_area.left,
bbox->top - blend->src_area.top,
rop);
+ }
} else {
if (rop == SPICE_ROP_COPY) {
spice_canvas->ops->scale_image_from_surface(spice_canvas, &dest_region,
@@ -2549,7 +2550,8 @@ static void canvas_draw_blend(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceC
bbox->top,
bbox->right - bbox->left,
bbox->bottom - bbox->top,
- blend->scale_mode, rop);
+ blend->scale_mode,
+ rop);
}
}
} else {
@@ -2557,17 +2559,18 @@ static void canvas_draw_blend(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceC
spice_return_if_fail(src_image != NULL);
if (rect_is_same_size(bbox, &blend->src_area)) {
- if (rop == SPICE_ROP_COPY)
+ if (rop == SPICE_ROP_COPY) {
spice_canvas->ops->blit_image(spice_canvas, &dest_region,
src_image,
bbox->left - blend->src_area.left,
bbox->top - blend->src_area.top);
- else
+ } else {
spice_canvas->ops->blit_image_rop(spice_canvas, &dest_region,
src_image,
bbox->left - blend->src_area.left,
bbox->top - blend->src_area.top,
rop);
+ }
} else {
if (rop == SPICE_ROP_COPY) {
spice_canvas->ops->scale_image(spice_canvas, &dest_region,
@@ -2592,7 +2595,8 @@ static void canvas_draw_blend(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceC
bbox->top,
bbox->right - bbox->left,
bbox->bottom - bbox->top,
- blend->scale_mode, rop);
+ blend->scale_mode,
+ rop);
}
}
pixman_image_unref(src_image);
More information about the Spice-commits
mailing list