a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/*
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Copyright © 2000 SuSE, Inc.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Permission to use, copy, modify, distribute, and sell this software and its
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * documentation for any purpose is hereby granted without fee, provided that
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * the above copyright notice appear in all copies and that both that
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * copyright notice and this permission notice appear in supporting
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * documentation, and that the name of SuSE not be used in advertising or
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * publicity pertaining to distribution of the software without specific,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * written prior permission. SuSE makes no representations about the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * suitability of this software for any purpose. It is provided "as is"
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * without express or implied warranty.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Author: Keith Packard, SuSE, Inc.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#ifndef _PICTURE_H_
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define _PICTURE_H_
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#include "privates.h"
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#include <pixman.h>
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsynctypedef struct _DirectFormat *DirectFormatPtr;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsynctypedef struct _PictFormat *PictFormatPtr;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsynctypedef struct _Picture *PicturePtr;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/*
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * While the protocol is generous in format support, the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * sample implementation allows only packed RGB and GBR
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * representations for data to simplify software rendering,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define PICT_FORMAT(bpp,type,a,r,g,b) PIXMAN_FORMAT(bpp, type, a, r, g, b)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/*
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * gray/color formats use a visual index instead of argb
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define PICT_VISFORMAT(bpp,type,vi) (((bpp) << 24) | \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync ((type) << 16) | \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync ((vi)))
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define PICT_FORMAT_BPP(f) PIXMAN_FORMAT_BPP(f)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define PICT_FORMAT_TYPE(f) PIXMAN_FORMAT_TYPE(f)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define PICT_FORMAT_A(f) PIXMAN_FORMAT_A(f)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define PICT_FORMAT_R(f) PIXMAN_FORMAT_R(f)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define PICT_FORMAT_G(f) PIXMAN_FORMAT_G(f)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define PICT_FORMAT_B(f) PIXMAN_FORMAT_B(f)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define PICT_FORMAT_RGB(f) PIXMAN_FORMAT_RGB(f)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define PICT_FORMAT_VIS(f) PIXMAN_FORMAT_VIS(f)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define PICT_TYPE_OTHER PIXMAN_TYPE_OTHER
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define PICT_TYPE_A PIXMAN_TYPE_A
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define PICT_TYPE_ARGB PIXMAN_TYPE_ARGB
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define PICT_TYPE_ABGR PIXMAN_TYPE_ABGR
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define PICT_TYPE_COLOR PIXMAN_TYPE_COLOR
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define PICT_TYPE_GRAY PIXMAN_TYPE_GRAY
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define PICT_TYPE_BGRA PIXMAN_TYPE_BGRA
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define PICT_FORMAT_COLOR(f) PIXMAN_FORMAT_COLOR(f)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* 32bpp formats */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsynctypedef enum _PictFormatShort {
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_a2r10g10b10 = PIXMAN_a2r10g10b10,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_x2r10g10b10 = PIXMAN_x2r10g10b10,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_a2b10g10r10 = PIXMAN_a2b10g10r10,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_x2b10g10r10 = PIXMAN_x2b10g10r10,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_a8r8g8b8 = PIXMAN_a8r8g8b8,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_x8r8g8b8 = PIXMAN_x8r8g8b8,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_a8b8g8r8 = PIXMAN_a8b8g8r8,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_x8b8g8r8 = PIXMAN_x8b8g8r8,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_b8g8r8a8 = PIXMAN_b8g8r8a8,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_b8g8r8x8 = PIXMAN_b8g8r8x8,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* 24bpp formats */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_r8g8b8 = PIXMAN_r8g8b8,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_b8g8r8 = PIXMAN_b8g8r8,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* 16bpp formats */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_r5g6b5 = PIXMAN_r5g6b5,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_b5g6r5 = PIXMAN_b5g6r5,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_a1r5g5b5 = PIXMAN_a1r5g5b5,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_x1r5g5b5 = PIXMAN_x1r5g5b5,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_a1b5g5r5 = PIXMAN_a1b5g5r5,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_x1b5g5r5 = PIXMAN_x1b5g5r5,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_a4r4g4b4 = PIXMAN_a4r4g4b4,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_x4r4g4b4 = PIXMAN_x4r4g4b4,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_a4b4g4r4 = PIXMAN_a4b4g4r4,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_x4b4g4r4 = PIXMAN_x4b4g4r4,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* 8bpp formats */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_a8 = PIXMAN_a8,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_r3g3b2 = PIXMAN_r3g3b2,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_b2g3r3 = PIXMAN_b2g3r3,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_a2r2g2b2 = PIXMAN_a2r2g2b2,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_a2b2g2r2 = PIXMAN_a2b2g2r2,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_c8 = PIXMAN_c8,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_g8 = PIXMAN_g8,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_x4a4 = PIXMAN_x4a4,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_x4c4 = PIXMAN_x4c4,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_x4g4 = PIXMAN_x4g4,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* 4bpp formats */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_a4 = PIXMAN_a4,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_r1g2b1 = PIXMAN_r1g2b1,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_b1g2r1 = PIXMAN_b1g2r1,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_a1r1g1b1 = PIXMAN_a1r1g1b1,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_a1b1g1r1 = PIXMAN_a1b1g1r1,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_c4 = PIXMAN_c4,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_g4 = PIXMAN_g4,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* 1bpp formats */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_a1 = PIXMAN_a1,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync PICT_g1 = PIXMAN_g1
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync} PictFormatShort;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/*
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * For dynamic indexed visuals (GrayScale and PseudoColor), these control the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * selection of colors allocated for drawing to Pictures. The default
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * policy depends on the size of the colormap:
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Size Default Policy
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * ----------------------------
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * < 64 PolicyMono
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * < 256 PolicyGray
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * 256 PolicyColor (only on PseudoColor)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * The actual allocation code lives in miindex.c, and so is
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * austensibly server dependent, but that code does:
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * PolicyMono Allocate no additional colors, use black and white
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * PolicyGray Allocate 13 gray levels (11 cells used)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * PolicyColor Allocate a 4x4x4 cube and 13 gray levels (71 cells used)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * PolicyAll Allocate as big a cube as possible, fill with gray (all)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Here's a picture to help understand how many colors are
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * actually allocated (this is just the gray ramp):
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * gray level
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * all 0000 1555 2aaa 4000 5555 6aaa 8000 9555 aaaa bfff d555 eaaa ffff
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * b/w 0000 ffff
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * 4x4x4 5555 aaaa
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * extra 1555 2aaa 4000 6aaa 8000 9555 bfff d555 eaaa
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * The default colormap supplies two gray levels (black/white), the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * 4x4x4 cube allocates another two and nine more are allocated to fill
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * in the 13 levels. When the 4x4x4 cube is not allocated, a total of
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * 11 cells are allocated.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define PictureCmapPolicyInvalid -1
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define PictureCmapPolicyDefault 0
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define PictureCmapPolicyMono 1
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define PictureCmapPolicyGray 2
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define PictureCmapPolicyColor 3
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define PictureCmapPolicyAll 4
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT int PictureCmapPolicy;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT int PictureParseCmapPolicy(const char *name);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT int RenderErrBase;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* Fixed point updates from Carl Worth, USC, Information Sciences Institute */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsynctypedef pixman_fixed_32_32_t xFixed_32_32;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsynctypedef pixman_fixed_48_16_t xFixed_48_16;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define MAX_FIXED_48_16 pixman_max_fixed_48_16
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define MIN_FIXED_48_16 pixman_min_fixed_48_16
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsynctypedef pixman_fixed_1_31_t xFixed_1_31;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsynctypedef pixman_fixed_1_16_t xFixed_1_16;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsynctypedef pixman_fixed_16_16_t xFixed_16_16;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/*
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * An unadorned "xFixed" is the same as xFixed_16_16,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * (since it's quite common in the code)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsynctypedef pixman_fixed_t xFixed;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define XFIXED_BITS 16
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define xFixedToInt(f) pixman_fixed_to_int(f)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define IntToxFixed(i) pixman_int_to_fixed(i)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define xFixedE pixman_fixed_e
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define xFixed1 pixman_fixed_1
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define xFixed1MinusE pixman_fixed_1_minus_e
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define xFixedFrac(f) pixman_fixed_frac(f)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define xFixedFloor(f) pixman_fixed_floor(f)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define xFixedCeil(f) pixman_fixed_ceil(f)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define xFixedFraction(f) pixman_fixed_fraction(f)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define xFixedMod2(f) pixman_fixed_mod2(f)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* whether 't' is a well defined not obviously empty trapezoid */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define xTrapezoidValid(t) ((t)->left.p1.y != (t)->left.p2.y && \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync (t)->right.p1.y != (t)->right.p2.y && \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync (int) ((t)->bottom - (t)->top) > 0)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/*
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Standard NTSC luminance conversions:
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * y = r * 0.299 + g * 0.587 + b * 0.114
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Approximate this for a bit more speed:
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * y = (r * 153 + g * 301 + b * 58) / 512
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * This gives 17 bits of luminance; to get 15 bits, lop the low two
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define CvtR8G8B8toY15(s) (((((s) >> 16) & 0xff) * 153 + \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync (((s) >> 8) & 0xff) * 301 + \
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync (((s) ) & 0xff) * 58) >> 2)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#endif /* _PICTURE_H_ */