ad-hoc modularity: BlSpartaCanvasBuilder logic is calling for bugs and dependency mess
When using class environment the tools that analyse dependency get confused.
forBufferOn: aRendererSurface
<return: #SpartaCanvas>
^ (self class environment at: #MozSkiaCanvas)
createForData: aRendererSurface buffer
type: (self class environment at: #MozBackendType) SKIA
extent: aRendererSurface extent
stride: aRendererSurface stride
format: (self class environment at: #MozSurfaceFormat) B8G8R8A8
forOpenGLOn: aRendererSurface
| aWebrender |
<return: #SpartaCanvas>
aWebrender := (self class environment at: #Webrender)
init: ((self class environment at: #GtGleamGL) loadGl: [ :aSymbol | aRendererSurface context getProcAddress: aSymbol ])
extent: aRendererSurface physicalSize asPoint
options: ((self class environment at: #WebrenderRendererOptions) new
debugFlag: (self class environment at: #WebrenderDebugFlags) PROFILER_DBG";
debugFlag: (self class environment at: #WebrenderDebugFlags) COMPACT_PROFILER").
aRendererSurface addUpdateAction: [
aWebrender update.
aWebrender render: aRendererSurface physicalSize asPoint.
aWebrender flushPipelineInfo ].
aRendererSurface updateEveryFrame.
^ (self class environment at: #WebrenderWindowCanvas)
extent: aRendererSurface physicalSize asPoint
webrender: aWebrender
forFormOn: aRendererSurface
<return: #SpartaCanvas>
^ (self class environment at: #SpartaCairoCanvas)
createForData: aRendererSurface pointer
extent: aRendererSurface extent
stride: aRendererSurface stride
format: (self class environment at: #SpartaCairoSurfaceFormat) CAIRO_FORMAT_ARGB32
I looked at the senders of environement, and found:
- 25 senders belong to Bloc-Sparta
- 5 belong to Bloc package (4 are in Bloc class, 1 is in BlAttributeRope).
We will have to check. For now I do not want to touch sparta :). Probably a subclass with the registration mechanism should do it.
BTW why looking at environemtn. I would have looked the the key of the at:
Why? only to locate the occurrences of "self class environment ..." that would need to be fixed.
Note: it's not only at: but also includesKey:. Examples:
BlSpartaCairoCanvasBuilder >>
isSupported
<return: #Boolean>
^ self environment includesKey: #SpartaCairoCanvas
BlSpartaMozCanvasBuilder >>
isSupported
<return: #Boolean>
^ (self environment includesKey: #MozCanvas)
and: [ (self environment at: #MozLibrary) uniqueInstance hasModule ]
and several other testing methods.