Gecko:Overview: Difference between revisions

Jump to navigation Jump to search
Add some info on Moz2D
(Tweak the start of the Graphics section)
(Add some info on Moz2D)
Line 582: Line 582:
==== Painting/Rasterizing ====
==== Painting/Rasterizing ====


Rasterizing is the step where graphical primitives (such as a filled [https://developer.mozilla.org/en-US/docs/Web/SVG SVG] circle, or a [https://developer.mozilla.org/en-US/docs/Web/Guide/Graphics/Drawing_graphics_with_canvas canvas] command to stroke a path between x, y, z, or the internally produced command to draw the edge of an HTML element's border) are used to color in the pixels of a surface so that the surface "displays" those rasterized primitives.
Painting/rendering/rasterizing is the step where graphical primitives (such as a command to fill an [https://developer.mozilla.org/en-US/docs/Web/SVG SVG] circle, or a [https://developer.mozilla.org/en-US/docs/Web/Guide/Graphics/Drawing_graphics_with_canvas canvas] command to stroke a path between x, y, z, or the internally produced command to draw the edge of an HTML div's border) are used to color in the pixels of a surface so that the surface "displays" those rasterized primitives.


2D Graphics API
The platform independent library that gecko uses to render is [http://dxr.mozilla.org/mozilla-central/source/gfx/2d/2D.h Moz2D]. Gecko code paints into Moz2D DrawTarget objects (the DrawTarget baseclass having multiple platform dependent subclasses). (At least this is where gecko is going - for now there is still significant amounts of code that uses [http://dxr.mozilla.org/mozilla-central/source/gfx/thebes/gfxContext.h Thebes gfxContext] objects or the even older nsRenderingContext objects. Objects of these types now always wrap a DrawTarget so all painting does now go through Moz2D, but conversion to use the wrapped DrawTargets directly is taking time since consumer code can sometimes need to be radically rewritten to fit the Moz2D API and immediate mode paradigm.)
* main use is at the end of the document pipeline, so could be part of it
* also used more directly from canvas


==== Compositing ====
==== Compositing ====
Line 592: Line 590:
The compositing stage of the rendering pipeline is operated by the [http://dxr.mozilla.org/mozilla-central/source/gfx/layers/ gfx/layers] module.
The compositing stage of the rendering pipeline is operated by the [http://dxr.mozilla.org/mozilla-central/source/gfx/layers/ gfx/layers] module.


Different pars of a web page can sometimes be painted into intermediate surfaces retained by layers. It can be convenient to think of layers as the layers in image manipulation programs like The Gimp or Photoshop. Layers are organized as a tree. Layers are primarily used to minimize invalidating and repainting when elements are being animated independently of one another in a way that can be optimized using layers (e.g. opacity or transform animation), and to enable some effects such as transparency and 3D transforms.
Different pars of a web page can sometimes be painted into intermediate surfaces retained by layers. It can be convenient to think of layers as the layers in image manipulation programs like The Gimp or Photoshop. Layers are organized as a tree. Layers are primarily used to minimize invalidating and repainting when elements are being animated independently of one another in a way that can be optimized using layers (e.g. opacity or transform animations), and to enable some effects (such as transparency and 3D transforms).


Compositing is the action of flattening the layers into the final image that is shown on the screen.
Compositing is the action of flattening the layers into the final image that is shown on the screen.
Confirmed users, Bureaucrats and Sysops emeriti
969

edits

Navigation menu