~ubuntu-branches/ubuntu/edgy/xorg-server/edgy-updates

« back to all changes in this revision

Viewing changes to render/picture.c

  • Committer: Bazaar Package Importer
  • Author(s): Rodrigo Parra Novo
  • Date: 2006-07-25 20:06:28 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060725200628-gjmmd9gxfxdc4ejs
Tags: 1:1.1.1-0ubuntu1
* New Upstream version
* Changed Build-Depends from mesa-swrast-source to mesa-swx11-source,
  following Debian package nomenclature
* Re-did 12_security_policy_in_etc.diff for 1.1.1
* Dropped 15_security_allocate_local.diff (applied upstream)
* Dropped 16_SECURITY_setuid.diff (applied upstream)
* Dropped 000_ubuntu_fix_read_kernel_mapping.patch (applied upstream)
* Dropped 002_ubuntu_fix_for_certain_intel_chipsets.patch (applied upstream)
* Updated versioned Build-Depends on mesa-swx11-source to version
  6.5.0.cvs.20060725-0ubuntu1
* Added arrayobj.c, arrayobj.h, bitset.h & rbadaptors.h to
  GL/symlink-mesa.sh (linked from mesa-swx11-source)
* Added arrayobj.c to default build target on GL/mesa/main

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
#include "servermd.h"
43
43
#include "picturestr.h"
44
44
 
45
 
int             PictureScreenPrivateIndex = -1;
 
45
_X_EXPORT int   PictureScreenPrivateIndex = -1;
46
46
int             PictureWindowPrivateIndex;
47
47
int             PictureGeneration;
48
48
RESTYPE         PictureType;
136
136
    for (n = 0; n < ps->nformats; n++)
137
137
        if (ps->formats[n].type == PictTypeIndexed)
138
138
            (*ps->CloseIndexed) (pScreen, &ps->formats[n]);
 
139
    GlyphUninit (pScreen);
139
140
    SetPictureScreen(pScreen, 0);
140
141
    if (ps->PicturePrivateSizes)
141
142
        xfree (ps->PicturePrivateSizes);
233
234
    formats[nformats].format = PICT_a1;
234
235
    formats[nformats].depth = 1;
235
236
    nformats++;
236
 
    formats[nformats].format = PICT_a8;
 
237
    formats[nformats].format = PICT_FORMAT(BitsPerPixel(8),
 
238
                                           PICT_TYPE_A,
 
239
                                           8, 0, 0, 0);
237
240
    formats[nformats].depth = 8;
238
241
    nformats++;
239
 
    formats[nformats].format = PICT_a4;
 
242
    formats[nformats].format = PICT_FORMAT(BitsPerPixel(4),
 
243
                                           PICT_TYPE_A,
 
244
                                           4, 0, 0, 0);
240
245
    formats[nformats].depth = 4;
241
246
    nformats++;
242
247
    formats[nformats].format = PICT_a8r8g8b8;
493
498
 
494
499
    for (s = 0; s < screenInfo.numScreens; s++)
495
500
    {
 
501
        if (!GlyphFinishInit (screenInfo.screens[s]))
 
502
            return FALSE;
496
503
        if (!PictureInitIndexedFormats (screenInfo.screens[s]))
497
504
            return FALSE;
498
505
        (void) AnimCurInit (screenInfo.screens[s]);
501
508
    return TRUE;
502
509
}
503
510
 
504
 
Bool
 
511
_X_EXPORT Bool
505
512
PictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel)
506
513
{
507
514
    PictureScreenPtr    ps = GetPictureScreenIfSet(pScreen);
513
520
    
514
521
}
515
522
 
516
 
int
 
523
_X_EXPORT int
517
524
PictureGetSubpixelOrder (ScreenPtr pScreen)
518
525
{
519
526
    PictureScreenPtr    ps = GetPictureScreenIfSet(pScreen);
613
620
        return PictureCmapPolicyInvalid;
614
621
}
615
622
 
616
 
Bool
 
623
_X_EXPORT Bool
617
624
PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
618
625
{
619
626
    PictureScreenPtr    ps;
1210
1217
                            error = BadPixmap;
1211
1218
                            break;
1212
1219
                        }
1213
 
                        if (pAlpha->pDrawable->type != DRAWABLE_PIXMAP)
 
1220
                        if (pAlpha->pDrawable == NULL ||
 
1221
                            pAlpha->pDrawable->type != DRAWABLE_PIXMAP)
1214
1222
                        {
1215
1223
                            client->errorValue = pid;
1216
1224
                            error = BadMatch;
1486
1494
    }
1487
1495
    pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT;
1488
1496
 
 
1497
    if (pPicture->pDrawable != NULL) {
 
1498
        int result;
 
1499
        PictureScreenPtr ps = GetPictureScreen(pPicture->pDrawable->pScreen);
 
1500
 
 
1501
        result = (*ps->ChangePictureTransform) (pPicture, transform);
 
1502
 
 
1503
        return result;
 
1504
    }
 
1505
 
1489
1506
    return Success;
1490
1507
}
1491
1508
 
1651
1668
    return Success;
1652
1669
}
1653
1670
 
 
1671
/**
 
1672
 * ReduceCompositeOp is used to choose simpler ops for cases where alpha
 
1673
 * channels are always one and so math on the alpha channel per pixel becomes
 
1674
 * unnecessary.  It may also avoid destination reads sometimes if apps aren't
 
1675
 * being careful to avoid these cases.
 
1676
 */
 
1677
static Bool
 
1678
ReduceCompositeOp (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst)
 
1679
{
 
1680
    Bool no_src_alpha, no_dst_alpha;
 
1681
 
 
1682
    no_src_alpha = PICT_FORMAT_COLOR(pSrc->format) &&
 
1683
                   PICT_FORMAT_A(pSrc->format) == 0 &&
 
1684
                   pSrc->alphaMap == NULL &&
 
1685
                   pMask == NULL;
 
1686
    no_dst_alpha = PICT_FORMAT_COLOR(pDst->format) &&
 
1687
                   PICT_FORMAT_A(pDst->format) == 0 &&
 
1688
                   pDst->alphaMap == NULL;
 
1689
 
 
1690
    /* TODO, maybe: Conjoint and Disjoint op reductions? */
 
1691
 
 
1692
    /* Deal with simplifications where the source alpha is always 1. */
 
1693
    if (no_src_alpha)
 
1694
    {
 
1695
        switch (op) {
 
1696
        case PictOpOver:
 
1697
            op = PictOpSrc;
 
1698
            break;
 
1699
        case PictOpInReverse:
 
1700
            op = PictOpDst;
 
1701
            break;
 
1702
        case PictOpOutReverse:
 
1703
            op = PictOpClear;
 
1704
            break;
 
1705
        case PictOpAtop:
 
1706
            op = PictOpIn;
 
1707
            break;
 
1708
        case PictOpAtopReverse:
 
1709
            op = PictOpOverReverse;
 
1710
            break;
 
1711
        case PictOpXor:
 
1712
            op = PictOpOut;
 
1713
            break;
 
1714
        default:
 
1715
            break;
 
1716
        }
 
1717
    }
 
1718
 
 
1719
    /* Deal with simplifications when the destination alpha is always 1 */
 
1720
    if (no_dst_alpha)
 
1721
    {
 
1722
        switch (op) {
 
1723
        case PictOpOverReverse:
 
1724
            op = PictOpDst;
 
1725
            break;
 
1726
        case PictOpIn:
 
1727
            op = PictOpSrc;
 
1728
            break;
 
1729
        case PictOpOut:
 
1730
            op = PictOpClear;
 
1731
            break;
 
1732
        case PictOpAtop:
 
1733
            op = PictOpOver;
 
1734
            break;
 
1735
        case PictOpXor:
 
1736
            op = PictOpOutReverse;
 
1737
            break;
 
1738
        default:
 
1739
            break;
 
1740
        }
 
1741
    }
 
1742
 
 
1743
    /* Reduce some con/disjoint ops to the basic names. */
 
1744
    switch (op) {
 
1745
    case PictOpDisjointClear:
 
1746
    case PictOpConjointClear:
 
1747
        op = PictOpClear;
 
1748
        break;
 
1749
    case PictOpDisjointSrc:
 
1750
    case PictOpConjointSrc:
 
1751
        op = PictOpSrc;
 
1752
        break;
 
1753
    case PictOpDisjointDst:
 
1754
    case PictOpConjointDst:
 
1755
        op = PictOpDst;
 
1756
        break;
 
1757
    default:
 
1758
        break;
 
1759
    }
 
1760
 
 
1761
    return op;
 
1762
}
 
1763
 
1654
1764
void
1655
1765
CompositePicture (CARD8         op,
1656
1766
                  PicturePtr    pSrc,
1671
1781
    if (pMask)
1672
1782
        ValidatePicture (pMask);
1673
1783
    ValidatePicture (pDst);
 
1784
 
 
1785
    op = ReduceCompositeOp (op, pSrc, pMask, pDst);
 
1786
    if (op == PictOpDst)
 
1787
        return;
 
1788
 
1674
1789
    (*ps->Composite) (op,
1675
1790
                       pSrc,
1676
1791
                       pMask,
1800
1915
#define MAX_FIXED_48_16     ((xFixed_48_16) 0x7fffffff)
1801
1916
#define MIN_FIXED_48_16     (-((xFixed_48_16) 1 << 31))
1802
1917
 
1803
 
Bool
 
1918
_X_EXPORT Bool
1804
1919
PictureTransformPoint3d (PictTransformPtr transform,
1805
1920
                         PictVectorPtr  vector)
1806
1921
{
1829
1944
}
1830
1945
 
1831
1946
 
1832
 
Bool
 
1947
_X_EXPORT Bool
1833
1948
PictureTransformPoint (PictTransformPtr transform,
1834
1949
                       PictVectorPtr    vector)
1835
1950
{