Move iterator initialization to the respective image files
[profile/ivi/pixman.git] / pixman / pixman-private.h
index d85868f..d42c114 100644 (file)
@@ -20,7 +20,6 @@
  * Images
  */
 typedef struct image_common image_common_t;
-typedef struct source_image source_image_t;
 typedef struct solid_fill solid_fill_t;
 typedef struct gradient gradient_t;
 typedef struct linear_gradient linear_gradient_t;
@@ -65,7 +64,6 @@ typedef enum
 {
     SOURCE_IMAGE_CLASS_UNKNOWN,
     SOURCE_IMAGE_CLASS_HORIZONTAL,
-    SOURCE_IMAGE_CLASS_VERTICAL,
 } source_image_class_t;
 
 typedef source_image_class_t (*classify_func_t) (pixman_image_t *image,
@@ -109,15 +107,9 @@ struct image_common
     pixman_format_code_t       extended_format_code;
 };
 
-struct source_image
-{
-    image_common_t common;
-    source_image_class_t class;
-};
-
 struct solid_fill
 {
-    source_image_t common;
+    image_common_t common;
     pixman_color_t color;
     
     uint32_t      color_32;
@@ -126,10 +118,9 @@ struct solid_fill
 
 struct gradient
 {
-    source_image_t          common;
+    image_common_t         common;
     int                     n_stops;
     pixman_gradient_stop_t *stops;
-    int                     stop_range;
 };
 
 struct linear_gradient
@@ -152,10 +143,11 @@ struct radial_gradient
 
     circle_t   c1;
     circle_t   c2;
-    double     cdx;
-    double     cdy;
-    double     dr;
-    double     A;
+
+    circle_t   delta;
+    double     a;
+    double     inva;
+    double     mindr;
 };
 
 struct conical_gradient
@@ -194,7 +186,6 @@ union pixman_image
     image_type_t       type;
     image_common_t     common;
     bits_image_t       bits;
-    source_image_t     source;
     gradient_t         gradient;
     linear_gradient_t  linear;
     conical_gradient_t conical;
@@ -202,10 +193,62 @@ union pixman_image
     solid_fill_t       solid;
 };
 
+typedef struct pixman_iter_t pixman_iter_t;
+typedef enum
+{
+    ITER_NARROW        = (1 << 0),
+} iter_flags_t;
+
+struct pixman_iter_t
+{
+    uint32_t *(* get_scanline) (pixman_iter_t *iter, const uint32_t *mask);
+    void      (* write_back)   (pixman_iter_t *iter);
+
+    pixman_image_t *    image;
+    uint32_t *          buffer;
+    int                 x, y;
+    int                 width;
+};
+
 void
 _pixman_bits_image_setup_accessors (bits_image_t *image);
 
 void
+_pixman_bits_image_src_iter_init (pixman_image_t *image,
+                                 pixman_iter_t *iter,
+                                 int x, int y, int width, int height,
+                                 uint8_t *buffer, iter_flags_t flags);
+void
+_pixman_bits_image_dest_iter_init (pixman_image_t *image,
+                                  pixman_iter_t *iter,
+                                  int x, int y, int width, int height,
+                                  uint8_t *buffer, iter_flags_t flags);
+
+void
+_pixman_solid_fill_iter_init (pixman_image_t *image,
+                             pixman_iter_t  *iter,
+                             int x, int y, int width, int height,
+                             uint8_t *buffer, iter_flags_t flags);
+
+void
+_pixman_linear_gradient_iter_init (pixman_image_t *image,
+                                  pixman_iter_t  *iter,
+                                  int x, int y, int width, int height,
+                                  uint8_t *buffer, iter_flags_t flags);
+
+void
+_pixman_radial_gradient_iter_init (pixman_image_t *image,
+                                  pixman_iter_t *iter,
+                                  int x, int y, int width, int height,
+                                  uint8_t *buffer, iter_flags_t flags);
+
+void
+_pixman_conical_gradient_iter_init (pixman_image_t *image,
+                                   pixman_iter_t *iter,
+                                   int x, int y, int width, int height,
+                                   uint8_t *buffer, iter_flags_t flags);
+
+void
 _pixman_image_get_scanline_generic_64  (pixman_image_t *image,
                                         int             x,
                                         int             y,
@@ -239,23 +282,6 @@ _pixman_image_get_scanline_64 (pixman_image_t *image,
                                uint32_t *      buffer,
                                const uint32_t *unused);
 
-void
-_pixman_image_store_scanline_32 (bits_image_t *  image,
-                                 int             x,
-                                 int             y,
-                                 int             width,
-                                 const uint32_t *buffer);
-
-/* Even though the type of buffer is uint32_t *, the function
- * actually expects a uint64_t *buffer.
- */
-void
-_pixman_image_store_scanline_64 (bits_image_t *  image,
-                                 int             x,
-                                 int             y,
-                                 int             width,
-                                 const uint32_t *buffer);
-
 pixman_image_t *
 _pixman_image_allocate (void);
 
@@ -535,6 +561,8 @@ _pixman_choose_implementation (void);
 /*
  * Utilities
  */
+uint32_t *
+_pixman_iter_get_scanline_noop (pixman_iter_t *iter, const uint32_t *mask);
 
 /* These "formats" all have depth 0, so they
  * will never clash with any real ones
@@ -554,24 +582,21 @@ _pixman_choose_implementation (void);
 #define FAST_PATH_NO_PAD_REPEAT                        (1 <<  3)
 #define FAST_PATH_NO_REFLECT_REPEAT            (1 <<  4)
 #define FAST_PATH_NO_ACCESSORS                 (1 <<  5)
-#define FAST_PATH_NARROW_FORMAT                (1 <<  6)
-#define FAST_PATH_COVERS_CLIP                  (1 <<  7)
+#define FAST_PATH_NARROW_FORMAT                        (1 <<  6)
 #define FAST_PATH_COMPONENT_ALPHA              (1 <<  8)
+#define FAST_PATH_SAMPLES_OPAQUE               (1 <<  7)
 #define FAST_PATH_UNIFIED_ALPHA                        (1 <<  9)
 #define FAST_PATH_SCALE_TRANSFORM              (1 << 10)
 #define FAST_PATH_NEAREST_FILTER               (1 << 11)
-#define FAST_PATH_SIMPLE_REPEAT                        (1 << 12)
+#define FAST_PATH_HAS_TRANSFORM                        (1 << 12)
 #define FAST_PATH_IS_OPAQUE                    (1 << 13)
-#define FAST_PATH_NEEDS_WORKAROUND             (1 << 14)
+#define FAST_PATH_NO_NORMAL_REPEAT             (1 << 14)
 #define FAST_PATH_NO_NONE_REPEAT               (1 << 15)
 #define FAST_PATH_SAMPLES_COVER_CLIP           (1 << 16)
 #define FAST_PATH_X_UNIT_POSITIVE              (1 << 17)
 #define FAST_PATH_AFFINE_TRANSFORM             (1 << 18)
 #define FAST_PATH_Y_UNIT_ZERO                  (1 << 19)
 #define FAST_PATH_BILINEAR_FILTER              (1 << 20)
-#define FAST_PATH_NO_NORMAL_REPEAT             (1 << 21)
-#define FAST_PATH_HAS_TRANSFORM                        (1 << 22)
-#define FAST_PATH_SAMPLES_OPAQUE               (1 << 23)
 
 #define FAST_PATH_PAD_REPEAT                                           \
     (FAST_PATH_NO_NONE_REPEAT          |                               \
@@ -593,29 +618,25 @@ _pixman_choose_implementation (void);
      FAST_PATH_NO_NORMAL_REPEAT                |                               \
      FAST_PATH_NO_PAD_REPEAT)
 
-#define _FAST_PATH_STANDARD_FLAGS                                      \
-    (FAST_PATH_ID_TRANSFORM            |                               \
-     FAST_PATH_NO_ALPHA_MAP            |                               \
-     FAST_PATH_NO_CONVOLUTION_FILTER   |                               \
-     FAST_PATH_NO_PAD_REPEAT           |                               \
-     FAST_PATH_NO_REFLECT_REPEAT       |                               \
+#define FAST_PATH_STANDARD_FLAGS                                       \
+    (FAST_PATH_NO_CONVOLUTION_FILTER   |                               \
      FAST_PATH_NO_ACCESSORS            |                               \
-     FAST_PATH_NARROW_FORMAT           |                               \
-     FAST_PATH_COVERS_CLIP)
-
-#define FAST_PATH_STD_SRC_FLAGS                                                \
-    _FAST_PATH_STANDARD_FLAGS
-#define FAST_PATH_STD_MASK_U_FLAGS                                     \
-    (_FAST_PATH_STANDARD_FLAGS         |                               \
-     FAST_PATH_UNIFIED_ALPHA)
-#define FAST_PATH_STD_MASK_CA_FLAGS                                    \
-    (_FAST_PATH_STANDARD_FLAGS         |                               \
-     FAST_PATH_COMPONENT_ALPHA)
+     FAST_PATH_NO_ALPHA_MAP            |                               \
+     FAST_PATH_NARROW_FORMAT)
+
 #define FAST_PATH_STD_DEST_FLAGS                                       \
     (FAST_PATH_NO_ACCESSORS            |                               \
      FAST_PATH_NO_ALPHA_MAP            |                               \
      FAST_PATH_NARROW_FORMAT)
 
+#define SOURCE_FLAGS(format)                                           \
+    (FAST_PATH_STANDARD_FLAGS |                                                \
+     ((PIXMAN_ ## format == PIXMAN_solid) ?                            \
+      0 : (FAST_PATH_SAMPLES_COVER_CLIP | FAST_PATH_ID_TRANSFORM)))
+
+#define MASK_FLAGS(format, extra)                                      \
+    ((PIXMAN_ ## format == PIXMAN_null) ? 0 : (SOURCE_FLAGS (format) | extra))
+
 #define FAST_PATH(op, src, src_flags, mask, mask_flags, dest, dest_flags, func) \
     PIXMAN_OP_ ## op,                                                  \
     PIXMAN_ ## src,                                                    \
@@ -628,19 +649,19 @@ _pixman_choose_implementation (void);
 
 #define PIXMAN_STD_FAST_PATH(op, src, mask, dest, func)                        \
     { FAST_PATH (                                                      \
-         op,                                                           \
-         src, FAST_PATH_STD_SRC_FLAGS,                                 \
-         mask, (PIXMAN_ ## mask) ? FAST_PATH_STD_MASK_U_FLAGS : 0,     \
-         dest, FAST_PATH_STD_DEST_FLAGS,                               \
-         func) }
+           op,                                                         \
+           src,  SOURCE_FLAGS (src),                                   \
+           mask, MASK_FLAGS (mask, FAST_PATH_UNIFIED_ALPHA),           \
+           dest, FAST_PATH_STD_DEST_FLAGS,                             \
+           func) }
 
 #define PIXMAN_STD_FAST_PATH_CA(op, src, mask, dest, func)             \
     { FAST_PATH (                                                      \
-         op,                                                           \
-         src, FAST_PATH_STD_SRC_FLAGS,                                 \
-         mask, FAST_PATH_STD_MASK_CA_FLAGS,                            \
-         dest, FAST_PATH_STD_DEST_FLAGS,                               \
-         func) }
+           op,                                                         \
+           src,  SOURCE_FLAGS (src),                                   \
+           mask, MASK_FLAGS (mask, FAST_PATH_COMPONENT_ALPHA),         \
+           dest, FAST_PATH_STD_DEST_FLAGS,                             \
+           func) }
 
 /* Memory allocation helpers */
 void *