From patchwork Wed Jun 1 07:02:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Anholt X-Patchwork-Id: 841382 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p51IUgfU001021 for ; Wed, 1 Jun 2011 18:31:02 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 756F89EB4C for ; Wed, 1 Jun 2011 11:30:42 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from annarchy.freedesktop.org (annarchy.freedesktop.org [131.252.210.176]) by gabe.freedesktop.org (Postfix) with ESMTP id 6B5FB9E7C8; Wed, 1 Jun 2011 11:28:31 -0700 (PDT) Received: from pollan.anholt.net (annarchy.freedesktop.org [127.0.0.1]) by annarchy.freedesktop.org (Postfix) with ESMTP id 40CF113004F; Wed, 1 Jun 2011 11:28:31 -0700 (PDT) Received: by pollan.anholt.net (Postfix, from userid 1000) id 917204016C6; Wed, 1 Jun 2011 00:02:57 -0700 (PDT) From: Eric Anholt To: intel-gfx@lists.freedesktop.org Date: Wed, 1 Jun 2011 00:02:56 -0700 Message-Id: <1306911776-18301-4-git-send-email-eric@anholt.net> X-Mailer: git-send-email 1.7.5.1 In-Reply-To: <1306911776-18301-1-git-send-email-eric@anholt.net> References: <1306911776-18301-1-git-send-email-eric@anholt.net> Subject: [Intel-gfx] [PATCH 3/3] uxa: Simplify uxa_poly_fill_rect by only clipping once. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 01 Jun 2011 18:31:04 +0000 (UTC) --- uxa/uxa-accel.c | 87 +++++++++++++++++-------------------------------------- 1 files changed, 27 insertions(+), 60 deletions(-) diff --git a/uxa/uxa-accel.c b/uxa/uxa-accel.c index 8f6da63..dd83542 100644 --- a/uxa/uxa-accel.c +++ b/uxa/uxa-accel.c @@ -785,10 +785,7 @@ uxa_poly_fill_rect(DrawablePtr pDrawable, RegionPtr pClip = fbGetCompositeClip(pGC); PixmapPtr pPixmap; register BoxPtr pbox; - BoxPtr pextent; - int extentX1, extentX2, extentY1, extentY2; int fullX1, fullX2, fullY1, fullY2; - int partX1, partX2, partY1, partY2; int xoff, yoff; int xorg, yorg; int n; @@ -850,11 +847,6 @@ fallback: xorg = pDrawable->x; yorg = pDrawable->y; - pextent = REGION_EXTENTS(pGC->pScreen, pClip); - extentX1 = pextent->x1; - extentY1 = pextent->y1; - extentX2 = pextent->x2; - extentY2 = pextent->y2; while (nrect--) { fullX1 = prect->x + xorg; fullY1 = prect->y + yorg; @@ -862,62 +854,37 @@ fallback: fullY2 = fullY1 + (int)prect->height; prect++; - if (fullX1 < extentX1) - fullX1 = extentX1; - - if (fullY1 < extentY1) - fullY1 = extentY1; + n = REGION_NUM_RECTS(pClip); + pbox = REGION_RECTS(pClip); + /* + * clip the rectangle to each box in the clip region + * this is logically equivalent to calling Intersect(), + * but rectangles may overlap each other here. + */ + while (n--) { + int x1 = fullX1; + int x2 = fullX2; + int y1 = fullY1; + int y2 = fullY2; - if (fullX2 > extentX2) - fullX2 = extentX2; + if (pbox->x1 > x1) + x1 = pbox->x1; + if (pbox->x2 < x2) + x2 = pbox->x2; + if (pbox->y1 > y1) + y1 = pbox->y1; + if (pbox->y2 < y2) + y2 = pbox->y2; + pbox++; - if (fullY2 > extentY2) - fullY2 = extentY2; + if (x1 >= x2 || y1 >= y2) + continue; - if ((fullX1 >= fullX2) || (fullY1 >= fullY2)) - continue; - n = REGION_NUM_RECTS(pClip); - if (n == 1) { (*uxa_screen->info->solid) (pPixmap, - fullX1 + xoff, - fullY1 + yoff, - fullX2 + xoff, - fullY2 + yoff); - } else { - pbox = REGION_RECTS(pClip); - /* - * clip the rectangle to each box in the clip region - * this is logically equivalent to calling Intersect(), - * but rectangles may overlap each other here. - */ - while (n--) { - partX1 = pbox->x1; - if (partX1 < fullX1) - partX1 = fullX1; - partY1 = pbox->y1; - if (partY1 < fullY1) - partY1 = fullY1; - partX2 = pbox->x2; - if (partX2 > fullX2) - partX2 = fullX2; - partY2 = pbox->y2; - if (partY2 > fullY2) - partY2 = fullY2; - - pbox++; - - if (partX1 < partX2 && partY1 < partY2) { - (*uxa_screen->info->solid) (pPixmap, - partX1 + - xoff, - partY1 + - yoff, - partX2 + - xoff, - partY2 + - yoff); - } - } + x1 + xoff, + y1 + yoff, + x2 + xoff, + y2 + yoff); } } (*uxa_screen->info->done_solid) (pPixmap);