b=368852, cocoa native theme code needs to flush cairo clip before drawing, r=stuart

This commit is contained in:
vladimir%pobox.com 2007-01-31 18:43:34 +00:00
Родитель d7a211a685
Коммит 14811877e1
3 изменённых файлов: 21 добавлений и 7 удалений

Просмотреть файл

@ -211,7 +211,7 @@ nsThebesRenderingContext::GetDrawingSurface(nsIDrawingSurface **aSurface)
NS_IMETHODIMP
nsThebesRenderingContext::PushTranslation(PushedTranslation* aState)
{
//PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::PushTranslation\n", this));
PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::PushTranslation\n", this));
// XXX this is slow!
PushState();
@ -221,7 +221,7 @@ nsThebesRenderingContext::PushTranslation(PushedTranslation* aState)
NS_IMETHODIMP
nsThebesRenderingContext::PopTranslation(PushedTranslation* aState)
{
//PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::PopTranslation\n", this));
PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::PopTranslation\n", this));
// XXX this is slow!
PopState();
@ -231,6 +231,8 @@ nsThebesRenderingContext::PopTranslation(PushedTranslation* aState)
NS_IMETHODIMP
nsThebesRenderingContext::SetTranslation(nscoord aX, nscoord aY)
{
PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::SetTranslation %d %d\n", this, aX, aY));
gfxMatrix newMat(mThebes->CurrentMatrix());
newMat.x0 = aX;
newMat.y0 = aY;
@ -257,7 +259,7 @@ nsThebesRenderingContext::GetHints(PRUint32& aResult)
NS_IMETHODIMP
nsThebesRenderingContext::PushState()
{
//PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::PushState\n", this));
PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::PushState\n", this));
mThebes->Save();
return NS_OK;
@ -266,7 +268,7 @@ nsThebesRenderingContext::PushState()
NS_IMETHODIMP
nsThebesRenderingContext::PopState()
{
//PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::PopState\n", this));
PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::PopState\n", this));
mThebes->Restore();
return NS_OK;

Просмотреть файл

@ -2100,6 +2100,7 @@ NSEvent* globalDragEvent = nil;
return;
CGContextRef cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
nsRect geckoBounds;
mGeckoChild->GetBounds(geckoBounds);
@ -2165,14 +2166,17 @@ NSEvent* globalDragEvent = nil;
// beyond this drawRect message handler)
#ifdef DEBUG_UPDATE
fprintf (stderr, " window coords: [%d %d %d %d]\n", tr.x, tr.y, tr.width, tr.height);
fprintf (stderr, " window coords: [%d %d %d %d]\n", fullRect.x, fullRect.y, fullRect.width, fullRect.height);
fprintf (stderr, "---- update done ----\n");
#if 0
CGContextSetRGBStrokeColor (cgContext,
((((unsigned long)self) & 0xff)) / 255.0,
((((unsigned long)self) & 0xff00) >> 8) / 255.0,
((((unsigned long)self) & 0xff0000) >> 16) / 255.0,
0.5);
#endif
CGContextSetRGBStrokeColor (cgContext, 1, 0, 0, 0.8);
CGContextSetLineWidth (cgContext, 4.0);
CGContextStrokeRect (cgContext,
CGRectMake(aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height));

Просмотреть файл

@ -280,6 +280,8 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame
if (!thebesCtx)
return NS_ERROR_FAILURE;
thebesCtx->UpdateSurfaceClip();
double offsetX = 0.0, offsetY = 0.0;
nsRefPtr<gfxASurface> thebesSurface = thebesCtx->CurrentSurface(&offsetX, &offsetY);
if (thebesSurface->GetType() != gfxASurface::SurfaceTypeQuartz2) {
@ -327,13 +329,13 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame
#if 0
if (1 /*aWidgetType == NS_THEME_TEXTFIELD*/) {
fprintf(stderr, "Native theme drawing widget %d [%p] dis:%d in rect [%d %d %d %d]\n",
aWidgetType, aFrame, IsDisabled(aFrame), aRect.x, aRect.y, aRect.width, aRect.height);
fprintf (stderr, "Native theme xform[0]: [%f %f %f %f %f %f]\n",
mm0.a, mm0.b, mm0.c, mm0.d, mm0.tx, mm0.ty);
CGAffineTransform mm = CGContextGetCTM(cgContext);
fprintf(stderr, "Native theme xform[1]: [%f %f %f %f %f %f]\n",
mm.a, mm.b, mm.c, mm.d, mm.tx, mm.ty);
fprintf(stderr, "Native theme drawing widget %d in rect [%d %d %d %d]\n",
aWidgetType, aRect.x, aRect.y, aRect.width, aRect.height);
}
#endif
@ -347,6 +349,12 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame
#if 0
fprintf(stderr, " --> macRect %f %f %f %f\n",
macRect.origin.x, macRect.origin.y, macRect.size.width, macRect.size.height);
CGRect bounds = CGContextGetClipBoundingBox (cgContext);
fprintf(stderr, " --> clip bounds: %f %f %f %f\n",
bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height);
//CGContextSetRGBFillColor(cgContext, 0.0, 0.0, 1.0, 0.1);
//CGContextFillRect(cgContext, bounds);
#endif
PRInt32 eventState = GetContentState(aFrame, aWidgetType);