|
|
| Line 1: |
Line 1: |
| == Porting Goals ==
| | This page has been renamed to [[Mobile/DFBPorting | DFBPorting]]. |
| | |
| * Firefox running with full functionality (including SVG) on non-X11 (DirectFB to start with) platforms
| |
| * Use GDK API only so that the backend (X, DFB etc) dependencies are abstracted out
| |
| | |
| | |
| == Porting Items ==
| |
| | |
| === Native Surface Creation ===
| |
| | |
| ==== Current State ====
| |
| | |
| cairo_xlib_* functions are used for creating surfaces on X. These
| |
| cairo_xlib_* funtions are implemented in cairo and are specific to X
| |
| backend.
| |
| | |
| ===== Related files =====
| |
| | |
| * gfx/thebes/public/gfxXlibSurface.h
| |
| * gfx/thebes/public/gfxXlibSurface.cpp
| |
| * All callers of gfxXlibSurface
| |
| ** widget/src/gtk2/nsWindow.cpp
| |
| ** gfx/thebes/src/gfxPlatformGtk.cpp
| |
| ** gfx/thebes/src/gfxASurface.cpp
| |
| ** layout/generic/nsObjectFrame.cpp
| |
| | |
| | |
| ==== Proposed Porting Approach ====
| |
| | |
| * All callers of gfxXlibSurface will be changed to use GdkDrawable to create gfxGdkCairoSurface. All X11 functions will be replace by GDK equivalents
| |
| * Clone gfxXlibSurface for GDK-CAIRO with name something like gfxGdkCairoSurface
| |
| * Use gdk_cairo_create () to create surfaces. gdk_cairo_create () creates a surface associated with the given GdkDrawable as well as a cairo context. However, we need only cairo surface but not the context. Both the solutions proposed below are some what hacky and any better method will be greatly appreciated
| |
| * Using gdk_cairo_create, cairo_surface_reference and cairo_get_target
| |
| cairo_t * cr = gdk_cairo_create (drawable);
| |
| cairo_surface_t * surface = cairo_surface_reference (cairo_get_target (cr));
| |
| cairo_destroy (cr);
| |
| | |
| * Using ref_cairo_surface on Drawable
| |
| cairo_surface_t * surface = GDK_DRAWABLE_GET_CLASS(drawable)->ref_cairo_surface(drawable);
| |
| | |
| === NativeRenderer ===
| |
| | |
| ==== Current State ====
| |
| | |
| NativeRenderer's Draw function is called for drawing a GTK widget composited with cairo state. NativeRenderer calls cairo_draw_with_xlib that has lot of dependencies on cairo_xlib*. cairo_draw_with_xlib does all the fancy stuff (complex transforms) and finally calls NativeDraw with the Drawable associated with the cairo surface. cairo_xlib provides API to obtain Drawable associated with a given Cairo surface.
| |
| | |
| According to Vlad (on irc), cairo_draw_with_xlib is really there for supporting complex transforms (rotation, affine-transorons etc) that gfx natively doesn't support but depends on cairo. Effect of disabling cairo_draw_with_xlib is that the SVG and Canvas will not work; but native theming will work fine.
| |
| | |
| | |
| ===== Related files =====
| |
| | |
| * gfx/thebes/public/gfxXlibNativeRenderer.h
| |
| * gfx/thebes/src/gfxXlibNativeRenderer.h
| |
| ** All callers of gfxXlibNativeRenderer
| |
| ** widget/src/gtk2/nsNativeThemeGTK.cpp
| |
| ** layout/generic/nsObjectFrame.cpp
| |
| | |
| | |
| ==== Proposed Porting Approach ====
| |
| | |
| | |
| * All the users of gfxXlibNativeRenderer will use gfxGdkNativeRenderer now
| |
| * gfxXlibNativeRenderer will be cloned as something like gfxGdkNativeRenderer
| |
| ** GdkDrawable will replace (Display, Visual, Drawable) touple
| |
| * '''Getting GdkDrawable from cairo surface'''
| |
| ** A new static const field will be added to gfxASurface class
| |
| *** static const cairo_user_data_key_t backendRenderingContext;
| |
| ** During the surface creation time, gfxGdkCairoSurface.cpp will store the GdkDrawable as user data in cairo surface
| |
| *** SetData (&gfxASurface::backendRenderingContext, (void *) mDrawable, nsnull);
| |
| ** Draw function in gfxGdknativeRenderer.cpp will obtain the GdkDrawable by calling GetData() function
| |
| *** (GdkDrawable *) ctx->OriginalSurface()->GetData(&gfxASurface::backendRenderingContext);
| |
| * cairo-xlib-utils.c and cairo-xlib-utils.h will be taken out from the build
| |
| * cairo_draw_with_xlib call in Draw function inside gfxGdkNativeRenderer.cpp will be replaced with the following code snippet.
| |
| | |
| double device_offset_x, device_offset_y;
| |
| short offset_x = 0, offset_y = 0;
| |
| cairo_surface_t * target = cairo_get_target (cr);
| |
| cairo_matrix_t matrix;
| |
| | |
| cairo_surface_get_device_offset (target, &device_offset_x, &device_offset_y);
| |
| cairo_get_matrix (cr, &matrix);
| |
| | |
| _convert_coord_to_short (matrix.x0 + device_offset_x, &offset_x);
| |
| _convert_coord_to_short (matrix.y0 + device_offset_y, &offset_y);
| |
| | |
| cairo_surface_flush (target);
| |
| NativeDraw ((GdkDrawable *) ctx->OriginalSurface()->GetData(&gfxASurface::backendRenderingContext),
| |
| offset_x, offset_y, NULL, 0);
| |
| cairo_surface_mark_dirty (target);
| |
| | |
| | |
| ==== TODO ====
| |
| | |
| In the current proposal we are ignoring cairo_draw_with_xlib; i.e., it will be disabled in the beginning phases of the porting. After the basic functionality is working on DFB, then we will work on this. Mean while, any input to port cairo_draw_with_xlib to GDK will be greatly appreciated.
| |
| | |
| | |
| === Miscellaneous ===
| |
| | |
| There are other places (widget and toolkit) in Mozilla where X11 calls are used. Currently all these X11 calls are being ported to GDK.
| |
| | |
| We are planning to use earlier work done on Mozilla-DFB by Tata Elxsi for the miscellaneous porting.
| |
| | |
| * [http://www.directfb.org/wiki/index.php/DFBMozilla DFBMozilla page]
| |
| * [https://bugzilla.mozilla.org/show_bug.cgi?id=357946 bugzilla patch]
| |