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

« back to all changes in this revision

Viewing changes to composite/compalloc.c

Tags: 2:1.10.1-2
* Build xserver-xorg-core-udeb on hurd-i386.  Thanks, Samuel Thibault!
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright © 2006 Sun Microsystems, Inc.  All rights reserved.
 
2
 * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
3
3
 *
4
4
 * Permission is hereby granted, free of charge, to any person obtaining a
5
5
 * copy of this software and associated documentation files (the "Software"),
48
48
#include "compint.h"
49
49
 
50
50
static void
 
51
compScreenUpdate (ScreenPtr pScreen)
 
52
{
 
53
    compCheckTree (pScreen);
 
54
    compPaintChildrenToWindow (pScreen->root);
 
55
}
 
56
 
 
57
static void
 
58
compBlockHandler (int       i,
 
59
                  pointer   blockData,
 
60
                  pointer   pTimeout,
 
61
                  pointer   pReadmask)
 
62
{
 
63
    ScreenPtr       pScreen = screenInfo.screens[i];
 
64
    CompScreenPtr   cs = GetCompScreen (pScreen);
 
65
 
 
66
    pScreen->BlockHandler = cs->BlockHandler;
 
67
    compScreenUpdate (pScreen);
 
68
    (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
 
69
 
 
70
    /* Next damage will restore the block handler */
 
71
    cs->BlockHandler = NULL;
 
72
}
 
73
 
 
74
static void
51
75
compReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure)
52
76
{
53
77
    WindowPtr       pWin = (WindowPtr) closure;
55
79
    CompScreenPtr   cs = GetCompScreen (pScreen);
56
80
    CompWindowPtr   cw = GetCompWindow (pWin);
57
81
 
58
 
    cs->damaged = TRUE;
 
82
    if (!cs->BlockHandler) {
 
83
        cs->BlockHandler = pScreen->BlockHandler;
 
84
        pScreen->BlockHandler = compBlockHandler;
 
85
    }
59
86
    cw->damaged = TRUE;
 
87
 
 
88
    /* Mark the ancestors */
 
89
    pWin = pWin->parent;
 
90
    while (pWin) {
 
91
        if (pWin->damagedDescendants)
 
92
            break;
 
93
        pWin->damagedDescendants = TRUE;
 
94
        pWin = pWin->parent;
 
95
    }
60
96
}
61
97
 
62
98
static void
472
508
    return Success;
473
509
}
474
510
 
 
511
static int
 
512
bgNoneVisitWindow(WindowPtr pWin, void *null)
 
513
{
 
514
    if (pWin->backgroundState != BackgroundPixmap)
 
515
        return WT_WALKCHILDREN;
 
516
    if (pWin->background.pixmap != None)
 
517
        return WT_WALKCHILDREN;
 
518
 
 
519
    return WT_STOPWALKING;
 
520
}
 
521
 
475
522
static PixmapPtr
476
 
compNewPixmap (WindowPtr pWin, int x, int y, int w, int h)
 
523
compNewPixmap (WindowPtr pWin, int x, int y, int w, int h, Bool map)
477
524
{
478
525
    ScreenPtr       pScreen = pWin->drawable.pScreen;
479
526
    WindowPtr       pParent = pWin->parent;
487
534
    
488
535
    pPixmap->screen_x = x;
489
536
    pPixmap->screen_y = y;
490
 
    
 
537
 
 
538
    /* resize allocations will update later in compCopyWindow, not here */
 
539
    if (!map)
 
540
        return pPixmap;
 
541
 
 
542
    /*
 
543
     * If there's no bg=None in the tree, we're done.
 
544
     *
 
545
     * We could optimize this more by collection the regions of all the
 
546
     * bg=None subwindows and feeding that in as the clip for the
 
547
     * CopyArea below, but since window trees are shallow these days it
 
548
     * might not be worth the effort.
 
549
     */
 
550
    if (TraverseTree(pWin, bgNoneVisitWindow, NULL) == WT_NOMATCH)
 
551
        return pPixmap;
 
552
 
 
553
    /*
 
554
     * Copy bits from the parent into the new pixmap so that it will
 
555
     * have "reasonable" contents in case for background None areas.
 
556
     */
491
557
    if (pParent->drawable.depth == pWin->drawable.depth)
492
558
    {
493
559
        GCPtr   pGC = GetScratchGC (pWin->drawable.depth, pScreen);
494
560
        
495
 
        /*
496
 
         * Copy bits from the parent into the new pixmap so that it will
497
 
         * have "reasonable" contents in case for background None areas.
498
 
         */
499
561
        if (pGC)
500
562
        {
501
563
            ChangeGCVal val;
558
620
    int             y = pWin->drawable.y - bw;
559
621
    int             w = pWin->drawable.width + (bw << 1);
560
622
    int             h = pWin->drawable.height + (bw << 1);
561
 
    PixmapPtr       pPixmap = compNewPixmap (pWin, x, y, w, h);
 
623
    PixmapPtr       pPixmap = compNewPixmap (pWin, x, y, w, h, TRUE);
562
624
    CompWindowPtr   cw = GetCompWindow (pWin);
563
625
 
564
626
    if (!pPixmap)
632
694
    pix_h = h + (bw << 1);
633
695
    if (pix_w != pOld->drawable.width || pix_h != pOld->drawable.height)
634
696
    {
635
 
        pNew = compNewPixmap (pWin, pix_x, pix_y, pix_w, pix_h);
 
697
        pNew = compNewPixmap (pWin, pix_x, pix_y, pix_w, pix_h, FALSE);
636
698
        if (!pNew)
637
699
            return FALSE;
638
700
        cw->pOldPixmap = pOld;