mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
unif 0 synchronous drawing on linux and add some checks to make sure we are visible and don't dump paint events when we are going to ignore them r=akkana
This commit is contained in:
parent
7ac62b03ca
commit
3414502b7d
@ -750,14 +750,14 @@ NS_IMETHODIMP nsWidget::Invalidate(PRBool aIsSynchronous)
|
||||
}
|
||||
#endif // NS_DEBUG
|
||||
|
||||
mUpdateArea->SetTo(0, 0, mBounds.width, mBounds.height);
|
||||
|
||||
if (aIsSynchronous) {
|
||||
::gtk_widget_draw(mWidget, (GdkRectangle *) NULL);
|
||||
} else {
|
||||
::gtk_widget_queue_draw(mWidget);
|
||||
}
|
||||
|
||||
mUpdateArea->SetTo(mBounds.x, mBounds.y, mBounds.width, mBounds.height);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -786,7 +786,6 @@ NS_IMETHODIMP nsWidget::Invalidate(const nsRect & aRect, PRBool aIsSynchronous)
|
||||
}
|
||||
#endif // NS_DEBUG
|
||||
|
||||
#if 0
|
||||
if (aIsSynchronous)
|
||||
{
|
||||
GdkRectangle nRect;
|
||||
@ -796,15 +795,11 @@ NS_IMETHODIMP nsWidget::Invalidate(const nsRect & aRect, PRBool aIsSynchronous)
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
|
||||
gtk_widget_queue_draw_area(mWidget,
|
||||
aRect.x, aRect.y,
|
||||
aRect.width, aRect.height);
|
||||
|
||||
#if 0
|
||||
}
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -813,6 +808,12 @@ NS_IMETHODIMP nsWidget::InvalidateRegion(const nsIRegion *aRegion, PRBool aIsSyn
|
||||
{
|
||||
nsRegionRectSet *regionRectSet = nsnull;
|
||||
|
||||
if (!GTK_IS_WIDGET(mWidget))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!GTK_WIDGET_REALIZED(mWidget) || !GTK_WIDGET_VISIBLE(mWidget))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
mUpdateArea->Union(*aRegion);
|
||||
|
||||
if (NS_FAILED(mUpdateArea->GetRects(®ionRectSet)))
|
||||
@ -831,9 +832,34 @@ NS_IMETHODIMP nsWidget::InvalidateRegion(const nsIRegion *aRegion, PRBool aIsSyn
|
||||
{
|
||||
nsRegionRect *r = &(regionRectSet->mRects[i]);
|
||||
|
||||
gtk_widget_queue_draw_area(mWidget,
|
||||
r->x, r->y,
|
||||
r->width, r->height);
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
if (CAPS_LOCK_IS_ON)
|
||||
{
|
||||
nsRect rect(r->x, r->y, r->width, r->height);
|
||||
debug_DumpInvalidate(stdout,
|
||||
this,
|
||||
&rect,
|
||||
aIsSynchronous,
|
||||
debug_GetName(mWidget),
|
||||
debug_GetRenderXID(mWidget));
|
||||
}
|
||||
#endif // NS_DEBUG
|
||||
|
||||
|
||||
if (aIsSynchronous)
|
||||
{
|
||||
GdkRectangle nRect;
|
||||
nRect.x = r->x;
|
||||
nRect.y = r->y;
|
||||
nRect.width = r->width;
|
||||
nRect.height = r->height;
|
||||
gtk_widget_draw(mWidget, &nRect);
|
||||
} else {
|
||||
gtk_widget_queue_draw_area(mWidget,
|
||||
r->x, r->y,
|
||||
r->width, r->height);
|
||||
}
|
||||
}
|
||||
|
||||
// drop the const.. whats the right thing to do here?
|
||||
@ -847,23 +873,17 @@ NS_IMETHODIMP nsWidget::Update(void)
|
||||
{
|
||||
if (!mWidget)
|
||||
return NS_OK;
|
||||
#if 0
|
||||
if (mUpdateArea->width && mUpdateArea->height) {
|
||||
if (!mIsDestroying) {
|
||||
Invalidate(mUpdateArea, PR_TRUE);
|
||||
|
||||
mUpdateArea.SetRect(0, 0, 0, 0);
|
||||
return NS_OK;
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// g_print("nsWidget::Update(this=%p): avoided update of empty area\n", this);
|
||||
}
|
||||
#endif
|
||||
return NS_OK;
|
||||
if (!GTK_IS_WIDGET(mWidget))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!GTK_WIDGET_REALIZED(mWidget) || !GTK_WIDGET_VISIBLE(mWidget))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// printf("nsWidget::Update()\n");
|
||||
|
||||
// this will Union() again, but so what?
|
||||
return InvalidateRegion(mUpdateArea, PR_TRUE);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
@ -426,18 +426,6 @@ PRBool nsWindow::OnExpose(nsPaintEvent &event)
|
||||
{
|
||||
event.renderingContext = nsnull;
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
if (CAPS_LOCK_IS_ON)
|
||||
{
|
||||
debug_DumpPaintEvent(stdout,
|
||||
this,
|
||||
&event,
|
||||
debug_GetName(mWidget),
|
||||
(PRInt32) debug_GetRenderXID(mWidget));
|
||||
}
|
||||
#endif // NS_DEBUG
|
||||
|
||||
|
||||
// expose.. we didn't get an Invalidate, so we should up the count here
|
||||
mUpdateArea->Union(event.rect->x, event.rect->y, event.rect->width, event.rect->height);
|
||||
|
||||
@ -462,6 +450,17 @@ PRBool nsWindow::OnExpose(nsPaintEvent &event)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// print out stuff here incase the event got dropped on the floor above
|
||||
#ifdef NS_DEBUG
|
||||
if (CAPS_LOCK_IS_ON)
|
||||
{
|
||||
debug_DumpPaintEvent(stdout,
|
||||
this,
|
||||
&event,
|
||||
debug_GetName(mWidget),
|
||||
(PRInt32) debug_GetRenderXID(mWidget));
|
||||
}
|
||||
#endif // NS_DEBUG
|
||||
|
||||
event.renderingContext = GetRenderingContext();
|
||||
if (event.renderingContext)
|
||||
|
Loading…
Reference in New Issue
Block a user