Closed Bug 328116 Opened 18 years ago Closed 18 years ago

Implement Cairo-on-OSX for Thebes gfx

Categories

(Core :: Graphics, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: vlad, Assigned: vlad)

References

Details

Attachments

(2 files)

Add native CG rendering using cairo on Cocoa-widget-based Gecko builds.
Small set of glue needed in cocoa widgets code to get cairo rendering going; will be expanded as time goes on, but this gets things up in the first run.  Eventually a lot of the QD-specific rendering code will be able to just go away (this patch already bypasses a large chunk for cairo builds).
Attachment #212646 - Flags: review?(joshmoz)
this has most of the work, including a CG-backed cairo surface implementation.

This also moves SystemFont stuff into separate per-platform files in gfx/src/thebes, instead of having things like GTK be handled differently than windows.

gfxAtsuiFonts is a bare rough outline needed to get text on the screen; this will be the focus of future work.
Attachment #212647 - Flags: review?(pavlov)
Attachment #212647 - Flags: review?(pavlov) → review+
Comment on attachment 212646 [details] [diff] [review]
cocoa widget changes

+ifeq ($(MOZ_ENABLE_CAIRO_GFX),1)

Ew, why not ifdef MOZ_ENABLE_CAIRO_GFX?

+  fprintf (stderr, "nsChildView[%p]::UpdateWidget called!\n", this);

You've got a few of these scattered throughout.  Any reason they're not within #ifdef DEBUG or something else?

r=me with satisfactory answers to those questions.
Attachment #212646 - Flags: review?(joshmoz) → review+
(In reply to comment #3)
> (From update of attachment 212646 [details] [diff] [review] [edit])
> +ifeq ($(MOZ_ENABLE_CAIRO_GFX),1)
> 
> Ew, why not ifdef MOZ_ENABLE_CAIRO_GFX?

Already changed, just didn't update the patch :)

> +  fprintf (stderr, "nsChildView[%p]::UpdateWidget called!\n", this);
> 
> You've got a few of these scattered throughout.  Any reason they're not within
> #ifdef DEBUG or something else?

Changed those to #ifdef DEBUG_vladimir
Re: finding fonts from their names, see bug 246527.
Comment on attachment 212646 [details] [diff] [review]
cocoa widget changes

>Index: widget/src/cocoa/nsChildView.mm
>===================================================================


>+#ifdef MOZ_CAIRO_GFX
>+gfxASurface*
>+nsChildView::GetThebesSurface()
>+{
>+  fprintf (stderr, "nsChildView[%p]::GetThebesSurface\n", this);
>+
>+  return new gfxQuartzSurface(gfxASurface::ImageFormatARGB32, 1, 1);
>+}
>+#endif

Do you really want to create one every time? If this is normal, then maybe the method name should be CreateThebesSurface().


>+#if 0
>+  targetContext->Rectangle(gfxRect(aRect.origin.x, aRect.origin.y,
>+                                   aRect.size.width, aRect.size.height));
>+  targetContext->Clip();
>+#else
>+  const NSRect *rects;
>+  int count, i;
>+  [self getRectsBeingDrawn:&rects count:&count];
>+  for (i = 0; i < count; ++i) {
>+    //fprintf (stderr, " Clip rect[%d]: %f %f %f %f\n", i, rects[i].origin.x, rects[i].origin.y, rects[i].size.width, rects[i].size.height);
>+    targetContext->Rectangle(gfxRect(rects[i].origin.x, rects[i].origin.y,
>+                                     rects[i].size.width, rects[i].size.height));
>+  }
>+  targetContext->Clip();
>+#endif

"Rectangle" has to be the worst method name ever.
(In reply to comment #6)
> (From update of attachment 212646 [details] [diff] [review] [edit])
> >Index: widget/src/cocoa/nsChildView.mm
> >===================================================================
> >+#ifdef MOZ_CAIRO_GFX
> >+gfxASurface*
> >+nsChildView::GetThebesSurface()
> >+{
> >+  fprintf (stderr, "nsChildView[%p]::GetThebesSurface\n", this);
> >+
> >+  return new gfxQuartzSurface(gfxASurface::ImageFormatARGB32, 1, 1);
> >+}
> >+#endif
> 
> Do you really want to create one every time? If this is normal, then maybe the
> method name should be CreateThebesSurface().

It's just returning a dummy surface; this method will go away relatively soon.

> 
> "Rectangle" has to be the worst method name ever.
> 

Eh, well, it's adding a rectangle to the current path.  Much better than Apple's ContextAddRectangleToCurrentPath() variety.
Blocks: 348059
Blocks: 345555
Flags: blocking1.9?
Has this been checked in?
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: