Greetings,
Over the past few weeks I have spent some time doing gfxContext-to-DrawTarget
conversions. (Also nsRendering-to-DrawTarget conversions, which are basically
the same because nsRenderingContext is a wafer-thin wrapper around gfxContext.)
The number of occurrences of gfxContext and nsRenderingContext is now about
20% lower than when I started (it went from 1813 to 1428), but I now need to
work on other things. Below is a list of cases that I didn't get to, but which
look like they might be easy-ish for people with some Thebes/Moz2D
experience.
If you do work on any of these, it might be worth replying to this message to
indicate this, to reduce the chance of two people duplicating work.
- gfxAlphaBoxBlur::Init(): the return value.
- gfxAlphaBoxBlur::BlurInsetBox() + FillDestinationPath(): the parameters.
- gfxAlphaBoxBlur::Paint() + DrawBlur(): the parameters.
- nsNativeThemeWin::DrawWidgetBackground: the parameter, in tandem with
changing gfxWindowsNativeDrawing::mContext and
gfxWindowsNativeDrawing::BeginNativeDrawing().
- nsCSSRendering::PaintGradient(): the parameter.
- DocumentRenderParent::mCanvasContext.
- ClipToContain() in BasicLayerManager.cpp: the parameter.
- PaintLayerContext::mTarget.
- InstallLayerClipPreserves3D() in BasicLayerManager.cpp: the parameter.
- PaintWithMask() in BasicLayersImpl.cpp: the parameter.
- gfxTextContextPaint::InitStrokeGeometry(): the parameter.
- imgFrame::SurfaceForDrawing(): the parameter.
- nsLayoutUtils::GetSnappedBaseline{X,Y}(): the parameter.
- ComputeSnappedImageDrawingParameters(): the parameter.
- The Android instance of nsPluginInstanceOwner::Paint(): the parameter.
- nsSVGUtils::SetClipRect(): the parameter.
- nsSVGUtils::Make{Fill,Stroke}PatternFor(): the parameter.
- BufferAlphaColor::mContext.
- DrawBackgroundColor() in nsCSSRendering.cpp: the parameter.
- SetupBackgroundClip() in nsCSSRendering.cpp: the parameter.
- MustCreateSurface() in ClippedImage.cpp.
- nsCSSRendering::PaintGradient(): the nsRenderingContext parameter.
- DumpFrames() in nsPrintEngine.cpp: this is commented-out code and it won't
compile because the nsRenderingContext is used in a bogus way (the call to
IsVisibleForPainting() has too many arguments). Perhaps all the
EXTENDED_DEBUG_PRINTING code can be removed? It looks ancient.
- Three CreateReferenceRenderingContext() call sites only require a
DrawTarget (nsTextBoxFrame::DrawText(), CreateReferenceDrawTarget(),
LazyReferenceRenderingDrawTargetGetterFromFrame::GetRefDrawTarget()), so
creating a gfxContext is overkill.
Finally, if I could choose a single function to magically Moz2Dify, it would be
AppUnitWidthOfStringBidi(). Changing its nsRenderingContext parameter to a
DrawTarget would allow huge swathes of functions to be changed similarly, as
well as nsBoxLayoutState::mRenderingContext and nsCSSOffsetState::rendContext.
But it's a hard case; the embedded gfxContext end up being passed through
nsFontMetrics::DrawString() to gfxTextRun::Draw() where it is put into a
TextRunDrawParams and gets used in lots of complicated ways.
Nick
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform