зеркало из https://github.com/mozilla/gecko-dev.git
Pass through a region with NS_PAINT events, instead of the bounding rect. Also fix gCursorCache to be static. Bug 121264, r+sr=blizzard.
This commit is contained in:
Родитель
153afe1e0f
Коммит
dba07d8868
|
@ -59,6 +59,7 @@
|
|||
|
||||
#include "nsIPref.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsGfxCIID.h"
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsPIAccessNode.h"
|
||||
|
@ -227,7 +228,7 @@ static GtkIMContext *IM_get_input_context(MozDrawingarea *aArea);
|
|||
#define kWindowPositionSlop 20
|
||||
|
||||
// cursor cache
|
||||
GdkCursor *gCursorCache[eCursorCount];
|
||||
static GdkCursor *gCursorCache[eCursorCount];
|
||||
|
||||
#define ARRAY_LENGTH(a) (sizeof(a)/sizeof(a[0]))
|
||||
|
||||
|
@ -1147,48 +1148,37 @@ nsWindow::OnExposeEvent(GtkWidget *aWidget, GdkEventExpose *aEvent)
|
|||
|
||||
nsCOMPtr<nsIRenderingContext> rc = getter_AddRefs(GetRenderingContext());
|
||||
|
||||
// defining NS_PAINT_SEPARATELY is useful for debugging invalidation
|
||||
// problems since it limits repainting to the rects that were actually
|
||||
// invalidated.
|
||||
#undef NS_PAINT_SEPARATELY
|
||||
static NS_DEFINE_CID(kRegionCID, NS_REGION_CID);
|
||||
|
||||
nsCOMPtr<nsIRegion> updateRegion = do_CreateInstance(kRegionCID);
|
||||
if (!updateRegion)
|
||||
return FALSE;
|
||||
|
||||
updateRegion->Init();
|
||||
|
||||
#ifdef NS_PAINT_SEPARATELY
|
||||
GdkRectangle *rects;
|
||||
gint nrects;
|
||||
gdk_region_get_rectangles(aEvent->region, &rects, &nrects);
|
||||
LOGDRAW(("sending expose event [%p] %p 0x%lx (rects follow):\n",
|
||||
(void *)this, (void *)aEvent->window,
|
||||
GDK_WINDOW_XWINDOW(aEvent->window)));
|
||||
|
||||
for (GdkRectangle *r = rects, *r_end = rects + nrects; r < r_end; ++r) {
|
||||
|
||||
nsRect rect(r->x, r->y, r->width, r->height);
|
||||
#else
|
||||
// ok, send out the paint event
|
||||
// XXX figure out the region/rect stuff!
|
||||
nsRect rect(aEvent->area.x, aEvent->area.y,
|
||||
aEvent->area.width, aEvent->area.height);
|
||||
#endif
|
||||
|
||||
LOGDRAW(("sending expose event [%p] %p 0x%lx\n\t%d %d %d %d\n",
|
||||
(void *)this,
|
||||
(void *)aEvent->window,
|
||||
GDK_WINDOW_XWINDOW(aEvent->window),
|
||||
rect.x, rect.y, rect.width, rect.height));
|
||||
updateRegion->Union(r->x, r->y, r->width, r->height);
|
||||
LOGDRAW(("\t%d %d %d %d\n", r->x, r->y, r->width, r->height));
|
||||
}
|
||||
|
||||
nsPaintEvent event(NS_PAINT, this);
|
||||
event.point.x = rect.x;
|
||||
event.point.y = rect.y;
|
||||
event.rect = ▭
|
||||
// XXX fix this!
|
||||
event.region = nsnull;
|
||||
// XXX fix this!
|
||||
event.point.x = aEvent->area.x;
|
||||
event.point.y = aEvent->area.y;
|
||||
event.rect = nsnull;
|
||||
event.region = updateRegion;
|
||||
event.renderingContext = rc;
|
||||
|
||||
nsEventStatus status;
|
||||
DispatchEvent(&event, status);
|
||||
|
||||
#ifdef NS_PAINT_SEPARATELY
|
||||
}
|
||||
|
||||
g_free(rects);
|
||||
#endif
|
||||
|
||||
// check the return value!
|
||||
return TRUE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче