utils.[ch]: Add pixel_checker_get_masks()
authorSøren Sandmann Pedersen <ssp@redhat.com>
Tue, 22 Jan 2013 12:36:19 +0000 (07:36 -0500)
committerSøren Sandmann Pedersen <ssp@redhat.com>
Wed, 13 Feb 2013 07:18:01 +0000 (02:18 -0500)
This function returns the a, r, g, and b masks corresponding to the
pixel checker's format.

test/utils.c
test/utils.h

index eed247629a019b5ea702b564710a7b2902007182..9a8decfab6c86d7f2698e48676de57fd9f0eda4e 100644 (file)
@@ -1421,6 +1421,23 @@ pixel_checker_split_pixel (const pixel_checker_t *checker, uint32_t pixel,
     *b = (pixel & checker->bm) >> checker->bs;
 }
 
+void
+pixel_checker_get_masks (const pixel_checker_t *checker,
+                         uint32_t              *am,
+                         uint32_t              *rm,
+                         uint32_t              *gm,
+                         uint32_t              *bm)
+{
+    if (am)
+        *am = checker->am;
+    if (rm)
+        *rm = checker->rm;
+    if (gm)
+        *gm = checker->gm;
+    if (bm)
+        *bm = checker->bm;
+}
+
 void
 pixel_checker_convert_pixel_to_color (const pixel_checker_t *checker,
                                       uint32_t pixel, color_t *color)
index f6dc1939ced9d74752aabf3467fa9d7a55d2d692..c2781516fbe21b8d8d9b673c7389545777121d8c 100644 (file)
@@ -229,3 +229,10 @@ pixel_checker_check (const pixel_checker_t *checker,
 void
 pixel_checker_convert_pixel_to_color (const pixel_checker_t *checker,
                                       uint32_t pixel, color_t *color);
+
+void
+pixel_checker_get_masks (const pixel_checker_t *checker,
+                         uint32_t              *am,
+                         uint32_t              *rm,
+                         uint32_t              *gm,
+                         uint32_t              *bm);