Back to index

lightning-sunbird  0.9+nobinonly
icimage.h
Go to the documentation of this file.
00001 /*
00002  * Copyright © 2000 Keith Packard
00003  *
00004  * Permission to use, copy, modify, distribute, and sell this software and its
00005  * documentation for any purpose is hereby granted without fee, provided that
00006  * the above copyright notice appear in all copies and that both that
00007  * copyright notice and this permission notice appear in supporting
00008  * documentation, and that the name of Keith Packard not be used in
00009  * advertising or publicity pertaining to distribution of the software without
00010  * specific, written prior permission.  Keith Packard makes no
00011  * representations about the suitability of this software for any purpose.  It
00012  * is provided "as is" without express or implied warranty.
00013  *
00014  * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
00015  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
00016  * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
00017  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
00018  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
00019  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00020  * PERFORMANCE OF THIS SOFTWARE.
00021  */
00022 
00023 /* XXX: This whole file should be moved up into incint.h (and cleaned
00024    up considerably as well) */
00025 
00026 #ifndef _ICIMAGE_H_
00027 #define _ICIMAGE_H_
00028 
00029 /* #include "glyphstr.h" */
00030 /* #include "scrnintstr.h" */
00031 
00032 /* XXX: Hmmm... what's needed from here?
00033 #include "resource.h"
00034 */
00035 
00036 /*
00037 typedef struct _IndexFormat {
00038     VisualPtr     pVisual; 
00039     ColormapPtr          pColormap;
00040     int                  nvalues;
00041     xIndexValue          *pValues;
00042     void          *devPrivate;
00043 } IndexFormatRec;
00044 */
00045 
00046 /*
00047 typedef struct pixman_format {
00048     uint32_t      id;
00049     uint32_t      format;
00050     unsigned char   type;
00051     unsigned char   depth;
00052     DirectFormatRec direct;
00053     IndexFormatRec  index;
00054 } pixman_format_t;
00055 */
00056 
00057 struct pixman_image {
00058     FbPixels      *pixels;
00059     pixman_format_t      image_format;
00060     int                  format_code;
00061     int                  refcnt;
00062     
00063     unsigned int    repeat : 1;
00064     unsigned int    graphicsExposures : 1;
00065     unsigned int    subWindowMode : 1;
00066     unsigned int    polyEdge : 1;
00067     unsigned int    polyMode : 1;
00068     unsigned int    freeCompClip : 1;
00069     unsigned int    freeSourceClip : 1;
00070     unsigned int    clientClipType : 2;
00071     unsigned int    componentAlpha : 1;
00072     unsigned int    compositeClipSource : 1;
00073     unsigned int    unused : 21;
00074 
00075     struct pixman_image *alphaMap;
00076     FbPoint       alphaOrigin;
00077 
00078     FbPoint       clipOrigin;
00079     void         *clientClip;
00080 
00081     unsigned long   dither;
00082 
00083     unsigned long   stateChanges;
00084     unsigned long   serialNumber;
00085 
00086     pixman_region16_t           *pCompositeClip;
00087     pixman_region16_t           *pSourceClip;
00088     
00089     pixman_transform_t     *transform;
00090 
00091     pixman_filter_t      filter;
00092     pixman_fixed16_16_t    *filter_params;
00093     int                  filter_nparams;
00094 
00095     int                  owns_pixels;
00096 };
00097 
00098 #endif /* _ICIMAGE_H_ */
00099 
00100 #ifndef _IC_MIPICT_H_
00101 #define _IC_MIPICT_H_
00102 
00103 #define IC_MAX_INDEXED      256 /* XXX depth must be <= 8 */
00104 
00105 #if IC_MAX_INDEXED <= 256
00106 typedef uint8_t FbIndexType;
00107 #endif
00108 
00109 /* XXX: We're not supporting indexed operations, right? */
00110 typedef struct _FbIndexed {
00111     int       color;
00112     uint32_t  rgba[IC_MAX_INDEXED];
00113     FbIndexType      ent[32768];
00114 } FbIndexedRec, *FbIndexedPtr;
00115 
00116 #define FbCvtR8G8B8to15(s) ((((s) >> 3) & 0x001f) | \
00117                           (((s) >> 6) & 0x03e0) | \
00118                           (((s) >> 9) & 0x7c00))
00119 #define FbIndexToEnt15(icf,rgb15) ((icf)->ent[rgb15])
00120 #define FbIndexToEnt24(icf,rgb24) FbIndexToEnt15(icf,FbCvtR8G8B8to15(rgb24))
00121 
00122 #define FbIndexToEntY24(icf,rgb24) ((icf)->ent[CvtR8G8B8toY15(rgb24)])
00123 
00124 /*
00125 pixman_private int
00126 FbCreatePicture (PicturePtr pPicture);
00127 */
00128 
00129 pixman_private void
00130 pixman_image_init (pixman_image_t *image);
00131 
00132 pixman_private void
00133 pixman_image_destroyClip (pixman_image_t *image);
00134 
00135 /*
00136 pixman_private void
00137 FbValidatePicture (PicturePtr pPicture,
00138                  Mask       mask);
00139 */
00140 
00141 
00142 /* XXX: What should this be?
00143 pixman_private int
00144 FbClipPicture (pixman_region16_t    *region,
00145               pixman_image_t           *image,
00146               int16_t           xReg,
00147               int16_t           yReg,
00148               int16_t           xPict,
00149               int16_t           yPict);
00150 */
00151 
00152 pixman_private int
00153 FbComputeCompositeRegion (pixman_region16_t      *region,
00154                        pixman_image_t     *iSrc,
00155                        pixman_image_t     *iMask,
00156                        pixman_image_t     *iDst,
00157                        int16_t            xSrc,
00158                        int16_t            ySrc,
00159                        int16_t            xMask,
00160                        int16_t            yMask,
00161                        int16_t            xDst,
00162                        int16_t            yDst,
00163                        uint16_t    width,
00164                        uint16_t    height);
00165 
00166 int
00167 miIsSolidAlpha (pixman_image_t *src);
00168 
00169 /*
00170 pixman_private int
00171 FbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats);
00172 */
00173 
00174 /*
00175 pixman_private void
00176 FbGlyphs (pixman_operator_t op,
00177          PicturePtr  pSrc,
00178          PicturePtr  pDst,
00179          PictFormatPtr      maskFormat,
00180          int16_t            xSrc,
00181          int16_t            ySrc,
00182          int         nlist,
00183          GlyphListPtr       list,
00184          GlyphPtr    *glyphs);
00185 */
00186 
00187 /*
00188 pixman_private void
00189 pixman_compositeRects (pixman_operator_t  op,
00190                 PicturePtr  pDst,
00191                 xRenderColor  *color,
00192                 int         nRect,
00193                 xRectangle    *rects);
00194 */
00195 
00196 pixman_private pixman_image_t *
00197 FbCreateAlphaPicture (pixman_image_t      *dst,
00198                     pixman_format_t       *format,
00199                     uint16_t       width,
00200                     uint16_t       height);
00201 
00202 typedef void  (*CompositeFunc) (pixman_operator_t   op,
00203                               pixman_image_t    *iSrc,
00204                               pixman_image_t    *iMask,
00205                               pixman_image_t    *iDst,
00206                               int16_t      xSrc,
00207                               int16_t      ySrc,
00208                               int16_t      xMask,
00209                               int16_t      yMask,
00210                               int16_t      xDst,
00211                               int16_t      yDst,
00212                               uint16_t     width,
00213                               uint16_t     height);
00214 
00215 typedef struct _FbCompositeOperand FbCompositeOperand;
00216 
00217 typedef uint32_t (*pixman_compositeFetch)(FbCompositeOperand *op);
00218 typedef void (*pixman_compositeStore) (FbCompositeOperand *op, uint32_t value);
00219 
00220 typedef void (*pixman_compositeStep) (FbCompositeOperand *op);
00221 typedef void (*pixman_compositeSet) (FbCompositeOperand *op, int x, int y);
00222 
00223 struct _FbCompositeOperand {
00224     union {
00225        struct {
00226            pixman_bits_t           *top_line;
00227            int                     left_offset;
00228            
00229            int                     start_offset;
00230            pixman_bits_t           *line;
00231            uint32_t         offset;
00232            FbStride         stride;
00233            int                     bpp;
00234        } drawable;
00235        struct {
00236            int                     alpha_dx;
00237            int                     alpha_dy;
00238        } external;
00239        struct {
00240            int                     top_y;
00241            int                     left_x;
00242            int                     start_x;
00243            int                     x;
00244            int                     y;
00245            pixman_transform_t             *transform;
00246            pixman_filter_t         filter;
00247            int                         repeat;
00248            int                         width;
00249            int                         height;
00250        } transform;
00251     } u;
00252     pixman_compositeFetch   fetch;
00253     pixman_compositeFetch   fetcha;
00254     pixman_compositeStore   store;
00255     pixman_compositeStep    over;
00256     pixman_compositeStep    down;
00257     pixman_compositeSet     set;
00258 /* XXX: We're not supporting indexed operations, right?
00259     FbIndexedPtr     indexed;
00260 */
00261     pixman_region16_t              *dst_clip;
00262     pixman_region16_t              *src_clip;
00263 };
00264 
00265 typedef void (*FbCombineFunc) (FbCompositeOperand       *src,
00266                             FbCompositeOperand   *msk,
00267                             FbCompositeOperand   *dst);
00268 
00269 typedef struct _FbAccessMap {
00270     uint32_t         format_code;
00271     pixman_compositeFetch   fetch;
00272     pixman_compositeFetch   fetcha;
00273     pixman_compositeStore   store;
00274 } FbAccessMap;
00275 
00276 /* iccompose.c */
00277 
00278 typedef struct _FbCompSrc {
00279     uint32_t  value;
00280     uint32_t  alpha;
00281 } FbCompSrc;
00282 
00283 pixman_private int
00284 fbBuildCompositeOperand (pixman_image_t       *image,
00285                       FbCompositeOperand op[4],
00286                       int16_t                 x,
00287                       int16_t                 y,
00288                       int              transform,
00289                       int              alpha);
00290 
00291 pixman_private void
00292 pixman_compositeGeneral (pixman_operator_t       op,
00293                       pixman_image_t      *iSrc,
00294                       pixman_image_t      *iMask,
00295                       pixman_image_t      *iDst,
00296                       int16_t      xSrc,
00297                       int16_t      ySrc,
00298                       int16_t      xMask,
00299                       int16_t      yMask,
00300                       int16_t      xDst,
00301                       int16_t      yDst,
00302                       uint16_t     width,
00303                       uint16_t     height);
00304 
00305 #endif /* _IC_MIPICT_H_ */