]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Add new functions for filling fb within clip rect
authorCharlie Brej <cbrej@cs.man.ac.uk>
Sat, 20 Sep 2008 22:25:57 +0000 (18:25 -0400)
committerRay Strode <rstrode@redhat.com>
Sat, 20 Sep 2008 22:25:57 +0000 (18:25 -0400)
src/libply/ply-frame-buffer.c
src/libply/ply-frame-buffer.h

index 4f0cfb4788479599f556f237f96352c8eedc70d4..03bbd2bdca96a53e87c33476f68993b2d1b5a61c 100644 (file)
@@ -922,8 +922,9 @@ ply_frame_buffer_fill_with_hex_color (ply_frame_buffer_t      *buffer,
 }
 
 bool 
-ply_frame_buffer_fill_with_argb32_data_at_opacity (ply_frame_buffer_t      *buffer,
+ply_frame_buffer_fill_with_argb32_data_at_opacity_with_clip (ply_frame_buffer_t      *buffer,
                                                    ply_frame_buffer_area_t *area,
+                                                   ply_frame_buffer_area_t *clip,
                                                    unsigned long            x,
                                                    unsigned long            y,
                                                    uint32_t                *data,
@@ -941,6 +942,14 @@ ply_frame_buffer_fill_with_argb32_data_at_opacity (ply_frame_buffer_t      *buff
 
   ply_frame_buffer_area_intersect (area, &buffer->area, &cropped_area);
 
+  if (clip)
+    ply_frame_buffer_area_intersect (&cropped_area, clip, &cropped_area);
+
+  if (cropped_area.width == 0 || cropped_area.height == 0)
+    return true;
+
+  x += cropped_area.x - area->x;
+  y += cropped_area.y - area->y;
   opacity_as_byte = (uint8_t) (opacity * 255.0);
 
   for (row = y; row < y + cropped_area.height; row++)
@@ -967,6 +976,18 @@ ply_frame_buffer_fill_with_argb32_data_at_opacity (ply_frame_buffer_t      *buff
   return ply_frame_buffer_flush (buffer);
 }
 
+bool 
+ply_frame_buffer_fill_with_argb32_data_at_opacity (ply_frame_buffer_t      *buffer,
+                                                   ply_frame_buffer_area_t *area,
+                                                   unsigned long            x,
+                                                   unsigned long            y,
+                                                   uint32_t                *data,
+                                                   double                   opacity)
+{
+  return ply_frame_buffer_fill_with_argb32_data_at_opacity_with_clip (buffer, area, NULL,
+                                                            x, y, data, opacity);
+}
+  
 bool 
 ply_frame_buffer_fill_with_argb32_data (ply_frame_buffer_t     *buffer,
                                         ply_frame_buffer_area_t *area,
@@ -974,7 +995,19 @@ ply_frame_buffer_fill_with_argb32_data (ply_frame_buffer_t     *buffer,
                                         unsigned long       y,
                                         uint32_t           *data)
 {
-  return ply_frame_buffer_fill_with_argb32_data_at_opacity (buffer, area,
+  return ply_frame_buffer_fill_with_argb32_data_at_opacity_with_clip (buffer, area, NULL,
+                                                            x, y, data, 1.0);
+}
+
+bool 
+ply_frame_buffer_fill_with_argb32_data_with_clip (ply_frame_buffer_t     *buffer,
+                                        ply_frame_buffer_area_t *area,
+                                        ply_frame_buffer_area_t *clip,
+                                        unsigned long       x,
+                                        unsigned long       y,
+                                        uint32_t           *data)
+{
+  return ply_frame_buffer_fill_with_argb32_data_at_opacity_with_clip (buffer, area, clip,
                                                             x, y, data, 1.0);
 }
 
index dcaf873aa052b0e5f4b7a61f91dddef3032edf66..d30e4ef4a1f6902589c38183cb1bab7212e1906a 100644 (file)
@@ -89,6 +89,20 @@ bool ply_frame_buffer_fill_with_argb32_data_at_opacity (ply_frame_buffer_t
                                                         uint32_t                *data,
                                                         double                   opacity);
 
+bool ply_frame_buffer_fill_with_argb32_data_with_clip (ply_frame_buffer_t      *buffer,
+                                                       ply_frame_buffer_area_t  *area,
+                                                       ply_frame_buffer_area_t  *clip,
+                                                       unsigned long        x,
+                                                       unsigned long        y,
+                                                       uint32_t            *data);
+bool ply_frame_buffer_fill_with_argb32_data_at_opacity_with_clip (ply_frame_buffer_t      *buffer,
+                                                                  ply_frame_buffer_area_t *area,
+                                                                  ply_frame_buffer_area_t *clip,
+                                                                  unsigned long            x,
+                                                                  unsigned long            y,
+                                                                  uint32_t                *data,
+                                                                  double                   opacity);
+
 const char *ply_frame_buffer_get_bytes (ply_frame_buffer_t *buffer);