зеркало из https://github.com/mozilla/gecko-dev.git
bug 362015. r=vlad. makes us use a region for drawing to avoid painting too much.
This commit is contained in:
Родитель
b0e90c0c2c
Коммит
ee85b33908
|
@ -2515,33 +2515,43 @@ NSEvent* globalDragEvent = nil;
|
|||
|
||||
nsRefPtr<gfxContext> targetContext = new gfxContext(targetSurface);
|
||||
|
||||
nsCOMPtr<nsIRenderingContext> rc;
|
||||
mGeckoChild->GetDeviceContext()->CreateRenderingContextInstance(*getter_AddRefs(rc));
|
||||
rc->Init(mGeckoChild->GetDeviceContext(), targetContext);
|
||||
|
||||
/* clip and build a region */
|
||||
nsCOMPtr<nsIRegion> rgn(do_CreateInstance(kRegionCID));
|
||||
if (rgn)
|
||||
rgn->Init();
|
||||
|
||||
const NSRect *rects;
|
||||
int count, i;
|
||||
[self getRectsBeingDrawn:&rects count:&count];
|
||||
for (i = 0; i < count; ++i) {
|
||||
targetContext->Rectangle(gfxRect(rects[i].origin.x, rects[i].origin.y,
|
||||
rects[i].size.width, rects[i].size.height));
|
||||
const NSRect& r = rects[i];
|
||||
|
||||
/* add to the region */
|
||||
if (rgn)
|
||||
rgn->Union(r.origin.x, r.origin.y, r.size.width, r.size.height);
|
||||
|
||||
/* to the context for clipping */
|
||||
targetContext->Rectangle(gfxRect(r.origin.x, r.origin.y, r.size.width, r.size.height));
|
||||
}
|
||||
targetContext->Clip();
|
||||
|
||||
nsCOMPtr<nsIRenderingContext> rc;
|
||||
mGeckoChild->GetDeviceContext()->CreateRenderingContextInstance(*getter_AddRefs(rc));
|
||||
rc->Init (mGeckoChild->GetDeviceContext(), targetContext);
|
||||
|
||||
nsRect r, tr;
|
||||
NSRectToGeckoRect(aRect, r);
|
||||
tr = r;
|
||||
|
||||
mGeckoChild->LocalToWindowCoordinate(tr);
|
||||
//targetContext->Translate(gfxPoint(tr.x, tr.y));
|
||||
/* bounding box of the dirty area */
|
||||
nsRect fullRect;
|
||||
NSRectToGeckoRect(aRect, fullRect);
|
||||
|
||||
nsPaintEvent paintEvent(PR_TRUE, NS_PAINT, mGeckoChild);
|
||||
paintEvent.renderingContext = rc;
|
||||
paintEvent.rect = &r;
|
||||
paintEvent.rect = &fullRect;
|
||||
paintEvent.region = rgn;
|
||||
|
||||
mGeckoChild->DispatchWindowEvent(paintEvent);
|
||||
|
||||
paintEvent.renderingContext = nsnull;
|
||||
paintEvent.region = nsnull;
|
||||
|
||||
targetContext = nsnull;
|
||||
targetSurface = nsnull;
|
||||
|
@ -2565,7 +2575,7 @@ NSEvent* globalDragEvent = nil;
|
|||
#endif
|
||||
|
||||
#else
|
||||
|
||||
/* non-MOZ_CAIRO_GFX */
|
||||
nsCOMPtr<nsIRegion> rgn(do_CreateInstance(kRegionCID));
|
||||
if (rgn) {
|
||||
rgn->Init();
|
||||
|
|
Загрузка…
Ссылка в новой задаче