KiCad PCB EDA Suite
Loading...
Searching...
No Matches
KIGFX::GAL_MODERN Class Reference

GAL that turns drawing commands into instanced primitives for the RHI device. More...

#include <gal_modern.h>

Inheritance diagram for KIGFX::GAL_MODERN:
KIGFX::GAL KIGFX::GAL_DISPLAY_OPTIONS_OBSERVER

Classes

struct  BITMAP_CACHE_ENTRY
 GPU texture per bitmap, keyed on the image KIID so redrawing reuses the upload. More...
 
struct  BITMAP_QUAD
 
struct  GAL_GROUP
 
struct  GEOMETRY_BUFFER_SET
 
struct  PATCH_SPAN
 Half-open index span touched by patches since the last upload, empty when end <= begin. More...
 
struct  POLARITY_MARK
 A point in a pool's drawing order where the polarity of what is drawn changes. More...
 
struct  SCENE_ARENA
 Retained scene arena holding one slot per placed group, patched in place so changing one item uploads only that item. More...
 
struct  SCENE_LAYER
 
struct  STATIC_GROUP_SLOT
 Where a cached group landed in the static pool at the last full build, so a colour or depth change is patched in place instead of rebuilding and uploading the whole board. More...
 

Public Types

using SHAPE_INSTANCES = std::array<std::vector<RHI_INSTANCE>, RHI_INSTANCED_SHAPES>
 Instances of each instanced shape, indexed by RHI_SHAPE.
 

Public Member Functions

 GAL_MODERN (GAL_DISPLAY_OPTIONS &aOptions, RHI_DEVICE_PROXY &aDeviceProxy)
 
 ~GAL_MODERN () override
 
bool IsInitialized () const override
 Return the initialization status for the canvas.
 
bool IsDrawingMode () const override
 Return true if the GAL is inside a BeginDrawing/EndDrawing pair.
 
bool HasStaticRebuildPending () const override
 Return true if the backend dropped its cached geometry and VIEW must draw the cached layers again, even when its own TARGET_CACHED is clean.
 
bool HasRetainedScene () const override
 Return true if the backend keeps cached groups in a persistent scene that it patches in place, so one changed item does not make VIEW emit every cached layer again.
 
bool RefillsNonCachedTargets () const override
 Return true if the backend empties every non-cached target each frame, so VIEW must emit them again even when clean.
 
bool SupportsTypedPads () const override
 Return true if DrawPad() renders every standard pad shape.
 
bool UsesPolygonTriangulationCache () const override
 Return true if filled polygons are drawn from the SHAPE_POLY_SET triangulation cache, which painters should then fill before calling DrawPolygon.
 
void BeginDrawing () override
 Start/end drawing functions, draw calls can be only made in between the calls to BeginDrawing()/EndDrawing().
 
void EndDrawing () override
 End the drawing, needs to be called for every new frame.
 
void ResizeScreen (int aWidth, int aHeight) override
 Resize the canvas.
 
void Flush () override
 Force all remaining objects to be drawn.
 
void ClearScreen () override
 Clear the screen.
 
void SetTarget (RENDER_TARGET aTarget) override
 Set the target for rendering.
 
RENDER_TARGET GetTarget () const override
 Get the currently used target for rendering.
 
void ClearTarget (RENDER_TARGET aTarget) override
 Clear the target for rendering.
 
void StartDiffLayer () override
 Begins rendering of a differential layer.
 
void EndDiffLayer () override
 Ends rendering of a differential layer.
 
void StartNegativesLayer () override
 Begins rendering in a new layer that will be copied to the main layer in EndNegativesLayer().
 
void EndNegativesLayer () override
 Ends rendering of a negatives layer and draws it to the main layer.
 
void SetNegativeDrawMode (bool aSetting) override
 Set negative draw mode in the renderer.
 
void SetScreenSpaceMode (bool aEnabled) override
 Store sizes of what is drawn next in pixels rather than world units, so it keeps its pixel size through a zoom without being drawn again.
 
bool SupportsStrokePixelPad () const override
 Tell whether strokes can carry part of their width in pixels, see SetStrokePixelPad().
 
bool SupportsStrokeLengthPad () const override
 Tell whether strokes can be longer by a number of pixels, see SetStrokeLengthPad().
 
void SetStrokeLengthPad (double aPixels) override
 Extend every stroke drawn from now on by aPixels at each end.
 
void SetStrokePixelPad (double aPixels) override
 Widen every stroke, circle and pad drawn from now on by aPixels.
 
bool SupportsStrokeLevelOfDetail () const override
 Tell whether strokes can carry a level of detail, see SetStrokeLevelOfDetail().
 
void SetStrokeLevelOfDetail (double aLod) override
 Show every stroke drawn from now on only while the view scale is above aLod, as VIEW::IsShownAtScale() decides.
 
void BitmapText (const wxString &aText, const VECTOR2I &aPosition, const EDA_ANGLE &aAngle) override
 Draw a text using a bitmap font.
 
void SetBitmapGlyphs (bool aEnable)
 Draw bitmap text as one font atlas glyph per quad, for editors whose track shader supports it.
 
void DrawGrid () override
 Draw the grid.
 
void DrawCursor (const VECTOR2D &aCursorPosition) override
 Draw the cursor.
 
int BeginGroup () override
 Begin a group.
 
void EndGroup () override
 End the group.
 
std::array< uint64_t, 2 > GroupContentFingerprint (int aGroupNumber) const override
 
void DrawGroup (int aGroupNumber) override
 Draw the stored group.
 
void ChangeGroupColor (int aGroupNumber, const COLOR4D &aNewColor) override
 Change the color used to draw the group.
 
void ChangeGroupDepth (int aGroupNumber, int aDepth) override
 Change the depth (Z-axis position) of the group.
 
void ChangeGroupUndimmed (int aGroupNumber, bool aUndimmed) override
 Exempt the group from its layer's dim, see SetSceneLayerDim().
 
void DeleteGroup (int aGroupNumber) override
 Delete the group from the memory.
 
void ClearCache () override
 Delete all data created during caching of graphic items.
 
void SetSceneLayerState (int aLayer, int aOrder, bool aVisible, bool aHasNegatives) override
 Describe a cached layer to the retained scene.
 
void SetSceneLayerDim (int aLayer, const COLOR4D &aToward, double aKeep) override
 Fade a cached layer towards a colour in the shader, so dimming it recolours none of its groups.
 
void SetSceneLayerOverlayAlpha (int aLayer) override
 Blend a cached layer the way the other canvases blend the overlay they draw it in.
 
void SetSceneDrawOrdered (bool aOrdered) override
 Tell the retained scene whether cached groups are placed in an order that matters.
 
void BeginSceneLayer (int aLayer) override
 Open a cached layer of the retained scene during a rebuild.
 
void SetGroupPlacement (int aGroup, int aLayer, double aLodScale, bool aShown, const RETAINED_GROUP_ORDER &aOrder) override
 Declare where a cached group belongs in the retained scene.
 
void SetSceneScale (double aScale) override
 Set the view scale that group placements are tested against.
 
bool SyncScene ()
 Upload scene changes made outside a drawing context, such as groups crossing their level of detail on a zoom that redraws nothing.
 
void Save () override
 Save the context.
 
void Restore () override
 Restore the context.
 
void Transform (const MATRIX3x3D &aTransformation) override
 Transform the context.
 
void Rotate (double aAngle) override
 Rotate the context.
 
void Translate (const VECTOR2D &aTranslation) override
 Translate the context.
 
void Scale (const VECTOR2D &aScale) override
 Scale the context.
 
void SetLayerDepth (double aLayerDepth) override
 Set the depth of the layer (position on the z-axis)
 
int GetSwapInterval () const override
 Return the swap interval. -1 for adaptive, 0 for disabled/unknown.
 
void SetRenderThread (RENDER_THREAD *aThread)
 Render thread used for fence-based synchronization.
 
void SetDpiScale (float aScale)
 Backing-store scale factor, 2.0 on Retina.
 
void SetCentringPad (int aPad)
 The other canvases lay the view out this many pixels larger than the client area.
 
VECTOR2I GetLayoutPixelSize () const override
 Return the size the view is centred in and panned by.
 
void DestroyBuffers ()
 Destroy every GPU resource this GAL holds and forget the handles.
 
void ReleaseBuffers ()
 Drop all GPU handles without destroying them.
 
void DrawLine (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint) override
 Draw a line.
 
void DrawSegment (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth) override
 Draw a rounded segment.
 
void DrawTrack (const VECTOR2D &aStart, const VECTOR2D &aEnd, double aWidth, const COLOR4D &aColor) override
 Draw a filled track capsule in aColor without touching the fill and stroke state.
 
void DrawPad (const VECTOR2D &aCenter, double aHalfWidth, double aHalfHeight, double aCornerRadius, float aShapeType, double aRotation, const COLOR4D &aColor) override
 Draw a filled pad as one primitive in aColor.
 
void DrawSegmentChain (const std::vector< VECTOR2D > &aPointList, double aWidth) override
 Draw a chain of rounded segments.
 
void DrawSegmentChain (const SHAPE_LINE_CHAIN &aLineChain, double aWidth) override
 
void DrawArc (const VECTOR2D &aCenterPoint, double aRadius, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle) override
 Draw an arc.
 
void DrawArcSegment (const VECTOR2D &aCenterPoint, double aRadius, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle, double aWidth, double aMaxError) override
 Draw an arc segment.
 
void DrawCircle (const VECTOR2D &aCenterPoint, double aRadius) override
 Draw a circle using world coordinates.
 
void DrawEllipse (const VECTOR2D &aCenterPoint, double aMajorRadius, double aMinorRadius, const EDA_ANGLE &aRotation) override
 Draw a closed ellipse.
 
void DrawEllipseArc (const VECTOR2D &aCenterPoint, double aMajorRadius, double aMinorRadius, const EDA_ANGLE &aRotation, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aEndAngle) override
 Draw an elliptical arc in world coordinates.
 
void DrawHoleWall (const VECTOR2D &aCenterPoint, double aHoleRadius, double aWallWidth) override
 Draw a hole wall ring.
 
void DrawRectangle (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint) override
 Draw a rectangle.
 
void DrawPolygon (const std::deque< VECTOR2D > &aPointList) override
 Draw a polygon.
 
void DrawPolygon (const VECTOR2D aPointList[], int aListSize) override
 
void DrawPolygon (const SHAPE_POLY_SET &aPolySet, bool aStrokeTriangulation=false) override
 
void DrawPolygon (const SHAPE_LINE_CHAIN &aPolySet) override
 
void DrawCurve (const VECTOR2D &aStartPoint, const VECTOR2D &aControlPointA, const VECTOR2D &aControlPointB, const VECTOR2D &aEndPoint, double aFilterValue=0.0) override
 Draw a cubic bezier spline.
 
void DrawBitmap (const BITMAP_BASE &aBitmap, double alphaBlend=1.0) override
 Draw a bitmap image.
 
void DrawPolyline (const std::deque< VECTOR2D > &aPointList) override
 Draw a polyline.
 
void DrawPolyline (const std::vector< VECTOR2D > &aPointList) override
 
void DrawPolyline (const VECTOR2D aPointList[], int aListSize) override
 
void DrawPolyline (const SHAPE_LINE_CHAIN &aLineChain) override
 
void DrawPolylines (const std::vector< std::vector< VECTOR2D > > &aPointLists) override
 Draw multiple polylines.
 
void DrawGlyph (const KIFONT::GLYPH &aGlyph, int aNth=0, int aTotal=1) override
 Draw a polygon representing a font glyph.
 
void ReleaseRetiredBuffers (uint64_t aConsumedGeneration)
 Free retired buffers and textures once the render thread has consumed a frame built after them.
 
KIGFX::FRAME_DRAW_DESC GetDrawDesc () const
 Snapshot buffer handles, draw counts and grid and cursor uniforms after EndDrawing()
 
void PopulateCursorUBO (KIGFX::FRAME_DRAW_DESC &aDesc) const
 Update only the cursor UBO fields, for overlay-only frames that reuse the scene geometry.
 
void SetPersistentTargets (bool aPersistent)
 Keep the non-cached and overlay pools across frames until ClearTarget() empties one, as the other backends do, so moving an overlay item re-emits only the overlay.
 
void MarkStaticDirty () override
 Force the next Flush() to rebuild the static pool from scratch.
 
KIGFX::FRAME_DRAW_DESC GetStaticDrawDesc () const
 Draw descriptor of the static pool.
 
KIGFX::FRAME_DRAW_DESC GetDynamicDrawDesc () const
 Draw descriptor of the current dynamic ring slot, which is rebuilt every frame.
 
bool TakeStaticChanged ()
 Whether the last Flush() rebuilt the static pool.
 
void PopulateCameraUBOs (KIGFX::FRAME_DRAW_DESC &aDesc) const
 Update the camera-dependent UBOs of an existing descriptor.
 
virtual bool IsVisible () const
 Return true if the GAL canvas is visible on the screen.
 
virtual bool IsCairoEngine ()
 Return true if the GAL engine is a Cairo based type.
 
virtual bool IsOpenGlEngine ()
 Return true if the GAL engine is a OpenGL based type.
 
void DrawRectangle (const BOX2I &aRect)
 
virtual void DrawGlyphs (const std::vector< std::unique_ptr< KIFONT::GLYPH > > &aGlyphs)
 Draw polygons representing font glyphs.
 
virtual bool Show (bool aShow)
 Show/hide the GAL canvas.
 
const VECTOR2I & GetScreenPixelSize () const
 Return GAL canvas size in pixels.
 
void SetClearColor (const COLOR4D &aColor)
 
const COLOR4D & GetClearColor () const
 
virtual void SetIsFill (bool aIsFillEnabled)
 Enable/disable fill.
 
bool GetIsFill () const
 Get the fill status.
 
virtual void SetIsStroke (bool aIsStrokeEnabled)
 Enable/disable stroked outlines.
 
bool GetIsStroke () const
 Get the stroke status.
 
virtual void SetFillColor (const COLOR4D &aColor)
 Set the fill color.
 
const COLOR4D & GetFillColor () const
 Get the fill color.
 
virtual void SetStrokeColor (const COLOR4D &aColor)
 Set the stroke color.
 
virtual void SetHoverColor (const COLOR4D &aColor)
 
const COLOR4D & GetStrokeColor () const
 Get the stroke color.
 
virtual void SetLineWidth (float aLineWidth)
 Set the line width.
 
virtual void SetMinLineWidth (float aLineWidth)
 Set the minimum line width in pixels.
 
float GetLineWidth () const
 Get the line width.
 
float GetMinLineWidth () const
 Get the minimum line width in pixels.
 
void AdvanceDepth ()
 Change the current depth to deeper, so it is possible to draw objects right beneath other.
 
void ResetTextAttributes ()
 Reset text attributes to default styling.
 
void SetGlyphSize (const VECTOR2I aSize)
 
const VECTOR2I & GetGlyphSize () const
 
void SetFontBold (const bool aBold)
 
bool IsFontBold () const
 
void SetFontItalic (bool aItalic)
 
bool IsFontItalic () const
 
void SetFontUnderlined (bool aUnderlined)
 
bool IsFontUnderlined () const
 
void SetTextMirrored (const bool aMirrored)
 
bool IsTextMirrored () const
 
void SetHorizontalJustify (const GR_TEXT_H_ALIGN_T aHorizontalJustify)
 
GR_TEXT_H_ALIGN_T GetHorizontalJustify () const
 
void SetVerticalJustify (const GR_TEXT_V_ALIGN_T aVerticalJustify)
 
GR_TEXT_V_ALIGN_T GetVerticalJustify () const
 
virtual void ComputeWorldScreenMatrix ()
 Compute the world <-> screen transformation matrix.
 
const MATRIX3x3D & GetWorldScreenMatrix () const
 Get the world <-> screen transformation matrix.
 
const MATRIX3x3D & GetScreenWorldMatrix () const
 Get the screen <-> world transformation matrix.
 
void SetWorldScreenMatrix (const MATRIX3x3D &aMatrix)
 Set the world <-> screen transformation matrix.
 
BOX2D GetVisibleWorldExtents () const
 
void SetWorldUnitLength (double aWorldUnitLength)
 Set the unit length.
 
double GetWorldUnitLength () const
 
void SetScreenSize (const VECTOR2I &aSize)
 
void SetScreenDPI (double aScreenDPI)
 Set the dots per inch of the screen.
 
double GetScreenDPI () const
 
void SetLookAtPoint (const VECTOR2D &aPoint)
 Get/set the Point in world space to look at.
 
const VECTOR2D & GetLookAtPoint () const
 
void SetZoomFactor (double aZoomFactor)
 
double GetZoomFactor () const
 
void SetRotation (double aRotation)
 Get/set the rotation angle (in radians).
 
double GetRotation () const
 
void SetDepthRange (const VECTOR2D &aDepthRange)
 Set the range of the layer depth.
 
double GetMinDepth () const
 
double GetMaxDepth () const
 
double GetWorldScale () const
 Get the world scale.
 
double GetWorldScaleForScreenSpace () const
 Get the world scale to size something drawn in screen space mode.
 
bool WorldScaleBelow (double aLimit) const
 Tell whether the world scale is below a limit.
 
void TakeWorldScaleLimits (double &aBelow, double &aAbove) const
 Give and forget the nearest limits on either side of the scale passed to WorldScaleBelow().
 
bool TakeWorldScaleRead () const
 Tell whether GetWorldScale() or a transformation matrix was read since the last call.
 
void SetFlip (bool xAxis, bool yAxis)
 Sets flipping of the screen.
 
bool IsFlippedX () const
 
bool IsFlippedY () const
 
virtual bool HasTarget (RENDER_TARGET aTarget)
 Return true if the target exists.
 
void SetGridVisibility (bool aVisibility)
 Set the visibility setting of the grid.
 
bool GetGridVisibility () const
 
bool GetGridSnapping () const
 
void SetGridOrigin (const VECTOR2D &aGridOrigin)
 Set the origin point for the grid.
 
const VECTOR2D & GetGridOrigin () const
 
void SetGridSize (const VECTOR2D &aGridSize)
 Set the grid size.
 
const VECTOR2D & GetGridSize () const
 Return the grid size.
 
VECTOR2D GetVisibleGridSize () const
 Return the visible grid size in x and y directions.
 
void SetGridColor (const COLOR4D &aGridColor)
 Set the grid color.
 
void SetAxesColor (const COLOR4D &aAxesColor)
 Set the axes color.
 
void SetAxesEnabled (bool aAxesEnabled)
 Enable drawing the axes.
 
void SetCoarseGrid (int aInterval)
 Draw every tick line wider.
 
float GetGridLineWidth () const
 Get the grid line width.
 
void SetGridSources (std::vector< GRID_SOURCE > aSources)
 Set the grid-source list rendered alongside the display grid.
 
const std::vector< GRID_SOURCE > & GetGridSources () const
 
GRID_STYLE GetGridStyle () const
 
int GetCoarseGrid () const
 
const COLOR4D & GetGridColor () const
 
VECTOR2D GetGridPoint (const VECTOR2D &aPoint) const
 For a given point it returns the nearest point belonging to the grid in world coordinates.
 
VECTOR2D ToWorld (const VECTOR2D &aPoint) const
 Compute the point position in world coordinates from given screen coordinates.
 
VECTOR2D ToScreen (const VECTOR2D &aPoint) const
 Compute the point position in screen coordinates from given world coordinates.
 
virtual bool SetNativeCursorStyle (KICURSOR aCursor, bool aHiDPI)
 Set the cursor in the native panel.
 
void SetCursorEnabled (bool aCursorEnabled)
 Enable/disable cursor.
 
bool IsCursorEnabled () const
 Return information about cursor visibility.
 
void SetCursorColor (const COLOR4D &aCursorColor)
 Set the cursor color.
 
virtual void EnableDepthTest (bool aEnabled=false)
 
virtual bool IsContextLocked ()
 Checks the state of the context lock.
 
virtual bool IsContextValid () const
 Check whether the locked context is actually the current one.
 
virtual GAL_CONTEXT_LOSS GetContextLoss () const
 Check whether a GPU reset destroyed this canvas' rendering context.
 
virtual bool IsResetSettled ()
 Check whether the driver has finished the reset that destroyed this canvas' context.
 
virtual void LockContext (int aClientCookie)
 Use GAL_CONTEXT_LOCKER RAII object unless you know what you're doing.
 
virtual void UnlockContext (int aClientCookie)
 

Static Public Member Functions

static std::shared_ptr< RENDER_THREAD > AcquireRenderThread (bool aEnableValidation)
 Return the render thread every RHI canvas in the process shares, starting it on first use and replacing one whose device was lost.
 
static uint32_t AllocateWindowId ()
 
static constexpr int arenaOf (int aShape, bool aNegative)
 

Static Public Attributes

static constexpr int ARENA_INSTANCE_COUNT = 2 * RHI_INSTANCED_SHAPES
 Arenas of one retained scene layer.
 
static constexpr int ARENA_POLYGON = ARENA_INSTANCE_COUNT
 
static constexpr int ARENA_COUNT = ARENA_POLYGON + 1
 

Protected Member Functions

void beginUpdate () override
 Enable item update mode.
 
void endUpdate () override
 Disable item update mode.
 
void computeWorldScale ()
 Compute the scaling factor for the world->screen matrix.
 
double computeMinGridSpacing () const
 Compute minimum grid spacing from the grid settings.
 
float gridMinorLineWidth (double aWorldPixelSize, double aScaleFactor) const
 Compute the world width of a minor grid line.
 
BOX2D gridScreenBBox (const GRID_SOURCE &aSrc) const
 
GRID_LATTICE gridLattice (const GRID_SOURCE &aSrc) const
 Thin a grid source's pitch out until its lines are far enough apart on screen.
 
COLOR4D gridSourceColor (const GRID_SOURCE &aSrc) const
 The colour a grid source is drawn in, brightened while it is being edited.
 
void drawGridCoverageShape (const GRID_SOURCE &aSrc)
 Draw the area a grid source covers in its own frame with the current fill and stroke.
 
COLOR4D getCursorColor () const
 Get the actual cursor color to draw.
 
void OnGalDisplayOptionsChanged (const GAL_DISPLAY_OPTIONS &aOptions) override
 Handler for observer settings changes.
 
virtual bool updatedGalDisplayOptions (const GAL_DISPLAY_OPTIONS &aOptions)
 Handle updating display options.
 
template<typename T>
void normalize (T &a, T &b)
 Ensure that the first element is smaller than the second.
 

Static Protected Member Functions

static double calcAngleStep (double aRadius)
 Compute the angle step when drawing arcs/circles approximated with lines.
 

Protected Attributes

GAL_DISPLAY_OPTIONS & m_options
 
UTIL::LINK m_observerLink
 
std::stack< double > m_depthStack
 Stored depth values.
 
VECTOR2I m_screenSize
 Screen size in screen (wx logical) coordinates.
 
double m_worldUnitLength
 The unit length of the world coordinates [inch].
 
double m_screenDPI
 The dots per inch of the screen.
 
VECTOR2D m_lookAtPoint
 Point to be looked at in world space.
 
double m_zoomFactor
 The zoom factor.
 
double m_rotation
 Rotation transformation (radians)
 
MATRIX3x3D m_worldScreenMatrix
 World transformation.
 
MATRIX3x3D m_screenWorldMatrix
 Screen transformation.
 
double m_worldScale
 The scale factor world->screen.
 
bool m_worldScaleRead = false
 see TakeWorldScaleRead()
 
double m_scaleLimitBelow = 0.0
 see TakeWorldScaleLimits()
 
double m_scaleLimitAbove = std::numeric_limits<double>::max()
 
bool m_globalFlipX
 Flag for X axis flipping.
 
bool m_globalFlipY
 Flag for Y axis flipping.
 
float m_lineWidth
 The line width.
 
float m_minLineWidth
 Minimum line width in pixels.
 
bool m_isFillEnabled
 Is filling of graphic objects enabled ?
 
bool m_isStrokeEnabled
 Are the outlines stroked ?
 
COLOR4D m_fillColor
 The fill color.
 
COLOR4D m_strokeColor
 The color of the outlines.
 
COLOR4D m_clearColor
 
COLOR4D m_hoverColor
 Color for hovered (active) links.
 
double m_layerDepth
 The actual layer depth.
 
VECTOR2D m_depthRange
 Range of the depth.
 
bool m_gridVisibility
 Should the grid be shown.
 
GRID_STYLE m_gridStyle
 Grid display style.
 
VECTOR2D m_gridSize
 The grid size.
 
VECTOR2D m_gridOrigin
 The grid origin.
 
VECTOR2D m_gridOffset
 The grid offset to compensate cursor position.
 
COLOR4D m_gridColor
 Color of the grid.
 
COLOR4D m_axesColor
 Color of the axes.
 
bool m_axesEnabled
 Should the axes be drawn.
 
int m_gridTick
 Every tick line gets the double width.
 
float m_gridLineWidth
 Line width of the grid.
 
int m_gridMinSpacing
 Minimum screen size of the grid (pixels) below which the grid is not drawn.
 
std::vector< GRID_SOURCE > m_gridSources
 Sources overlayed on the display grid.
 
bool m_isCursorEnabled
 Is the cursor enabled?
 
bool m_forceDisplayCursor
 Always show cursor.
 
COLOR4D m_cursorColor
 Cursor color.
 
KIGFX::CROSS_HAIR_MODE m_crossHairMode
 Crosshair drawing mode.
 
VECTOR2D m_cursorPosition
 Current cursor position (world coordinates)
 
KICURSOR m_currentNativeCursor
 Current cursor.
 

Static Protected Attributes

static constexpr int SEG_PER_CIRCLE_COUNT = 64
 The default number of segments approximating a full circle.
 
static const int MIN_DEPTH = -2*MAX_LAYERS_FOR_VIEW
 Possible depth range.
 
static const int MAX_DEPTH = 2*MAX_LAYERS_FOR_VIEW - 1
 
static const int GRID_DEPTH = MAX_DEPTH - 1
 Depth level on which the grid is drawn.
 

Private Member Functions

void recomputeTransformIdentity ()
 Exact comparison is enough since a false negative only takes the slow path.
 
VECTOR2D xform (const VECTOR2D &aPt) const
 
double xformScale () const
 
double xformAngle () const
 
RHI_INSTANCE makeInstance (const COLOR4D &aColor)
 An instance in aColor at the layer depth, with the current polarity and padding.
 
void emitInstance (RHI_SHAPE aShape, const RHI_INSTANCE &aInstance)
 Append to the current target's pool.
 
void releaseBitmapQuads (std::vector< BITMAP_QUAD > &aQuads, bool aOwnedOnly)
 Retire the textures and vertex buffers the quads own, then empty the list.
 
bool drawBitmapGlyphs (const wxString &aText, const VECTOR2I &aPosition, const EDA_ANGLE &aAngle)
 Emit bitmap text glyph by glyph.
 
void addCapsuleInstance (const VECTOR2D &aStart, const VECTOR2D &aEnd, double aWidth, const COLOR4D &aColor)
 
RHI_INSTANCE & addArcInstance (const VECTOR2D &aCenter, double aRadius, double aStartAngle, double aSweepAngle, double aWidth, const COLOR4D &aColor)
 
RHI_INSTANCE & addPadInstance (const VECTOR2D &aCenter, double aHalfWidth, double aHalfHeight, double aCornerRadius, float aShapeType, double aRotation, const COLOR4D &aColor)
 
void drawEllipseShape (const SHAPE_ELLIPSE &aEllipse)
 Fill and stroke an ellipse per the current settings, filling an arc as a sector.
 
void fillOutline (SHAPE_LINE_CHAIN aOutline, const COLOR4D &aColor)
 Fill an outline, closed or not, without stroking it.
 
void emitTriangulatedPolygon (const SHAPE_POLY_SET &aPolySet, const COLOR4D &aColor)
 
RHI_VERTEX fillVertex (const COLOR4D &aColor)
 A vertex filled in aColor at the layer depth, for emitTriangle() to place.
 
void emitTriangle (const VECTOR2D &aA, const VECTOR2D &aB, const VECTOR2D &aC, const RHI_VERTEX &aFill)
 Append a triangle given in world coordinates under the current transform.
 
void strokeLineChain (const SHAPE_LINE_CHAIN &aChain)
 Stroke a chain as segments, adding a last-to-first segment when it is closed.
 
bool ensureBuffer (RHI_BufferHandle &aBuffer, size_t &aCapacity, size_t aNeeded, size_t aStride)
 Grow aBuffer to hold aNeeded elements.
 
void refillDynamicTarget (RENDER_TARGET aTarget)
 Rotate a dynamic target's ring, empty the new slot and open a range at the current depth.
 
bool currentTargetOpen () const
 Whether drawing to the current target lands in a pool that this frame has emptied.
 
void drawGridSources ()
 Draw the grid sources into m_gridPool, each over its own area as the Cairo canvas paints them.
 
void drawGridSource (const GRID_SOURCE &aSrc)
 
double screenPixelSize () const
 The world size of a screen pixel, which grid lines are measured in.
 
void retireBuffer (RHI_BufferHandle aBuffer)
 
void retireTexture (RHI_TextureHandle aTexture)
 
template<typename T>
void submitSpan (const std::vector< T > &aElements, RHI_BufferHandle aBuffer, const PATCH_SPAN &aSpan)
 Queue an upload of a span of aElements to the same place in aBuffer.
 
void clearStaticSlots ()
 Forget where groups sit in the static pool and the patches pending for it.
 
template<typename INSTANCE_FN, typename VERTEX_FN>
bool patchStaticGroup (int aGroup, INSTANCE_FN aInstance, VERTEX_FN aVertex)
 Patch a cached group in place in the static pool, applying aInstance to each instance and aVertex to each polygon vertex, and record the touched spans for a partial upload.
 
void rewriteResidentGroup (int aGroupNumber, GAL_GROUP &aGroup)
 Write a resident group back into its scene layer after its elements changed.
 
void buildSceneRuns (SCENE_LAYER &aLayer)
 Work out a layer's polarity runs again after its residents changed or moved.
 
bool gridShown () const
 
void sortSceneOrder ()
 Put the declared layers back in decreasing depth order after one was added or moved.
 
template<typename T>
uint32_t allocSceneSlot (SCENE_ARENA< T > &aArena, uint32_t aCount)
 
template<typename T>
void freeSceneSlot (SCENE_ARENA< T > &aArena, uint32_t aStart, uint32_t aCount)
 
template<typename T>
void compactSceneArena (SCENE_LAYER &aLayer, SCENE_ARENA< T > &aArena, int aArenaId)
 
template<typename T>
bool uploadSceneArena (SCENE_ARENA< T > &aArena)
 Upload the arena's pending spans, growing its buffer first.
 
void placeGroupInScene (int aGroupId, GAL_GROUP &aGroup, SCENE_LAYER &aLayer)
 
void removeGroupFromScene (int aGroupId, GAL_GROUP &aGroup)
 
void trackGroupLod (int aGroupId, GAL_GROUP &aGroup, bool aTrack)
 Keep m_lodGroups to the shown groups whose threshold a zoom can actually cross.
 
void writeGroupToScene (const GAL_GROUP &aGroup, SCENE_LAYER &aLayer)
 Copy a resident group's elements into its slots, applying the layer's hoisted alpha.
 
bool retainedTieOrderChanged (int aGroupId, GAL_GROUP &aGroup, SCENE_LAYER &aLayer)
 
void countGroupAlpha (const GAL_GROUP &aGroup, SCENE_LAYER &aLayer, int aDelta)
 
void resetScene ()
 Empty every arena and forget residency ahead of a full rebuild.
 
bool flushScene ()
 Settle hoisted alpha, compact and upload.
 
void appendSceneRanges (FRAME_DRAW_DESC &aDesc) const
 
GEOMETRY_BUFFER_SET & buf ()
 
const GEOMETRY_BUFFER_SET & buf () const
 
GEOMETRY_BUFFER_SET & obuf ()
 
const GEOMETRY_BUFFER_SET & obuf () const
 
GEOMETRY_BUFFER_SET & poolForCurrentTarget ()
 TARGET_CACHED draws to the static pool and every other target to its dynamic ring slot.
 
const GEOMETRY_BUFFER_SET & poolForCurrentTarget () const
 
void countBitmapRefs (const GAL_GROUP &aGroup, int aDelta)
 Count a group's quads against the cached textures they draw, so a texture a cached group still shows is not evicted for not being drawn again each frame.
 
bool assignSlicesByOrder (std::vector< LAYER_RANGE > &aRanges, size_t aFirst) const
 Give ranges their slices of the depth range from one mapping of layer order, the same for every target.
 
bool keepsRelativeDepth (const GEOMETRY_BUFFER_SET &aPool) const
 The pool is a kept target whose ranges are drawn in depth slices, see Flush()
 
void notePolarity (bool aNegative)
 Note the polarity of what is about to be drawn, so that a pool remembers where it changed.
 
void evictBitmapCacheEntries ()
 Evict least recently used entries down to the entry and byte caps, sparing those used this frame since a submitted quad may still reference them.
 
std::vector< LAYER_RANGE > & layerRangesForCurrentTarget ()
 
const std::vector< LAYER_RANGE > & layerRangesForCurrentTarget () const
 
void beginLayerRange (float aDepth)
 
double getLayerDepth () const
 

Static Private Member Functions

static std::shared_ptr< const RHI_RUN_TABLE > updateSceneCullRuns (SCENE_LAYER &aLayer)
 Bring a layer's culling bounds up to date, recounting only runs whose elements changed.
 
static bool sceneLayerComposited (const SCENE_LAYER &aLayer)
 Whether a scene layer goes through the temp target and is composited with its alpha.
 
static std::array< uint64_t, 2 > computeGroupFingerprint (const GAL_GROUP &aGroup)
 
static void countGroupArenas (const GAL_GROUP &aGroup, uint32_t *aCounts)
 Fill aCounts with how many of a group's instances go in each instance arena.
 

Private Attributes

RHI_DEVICE_PROXY & m_deviceProxy
 
RENDER_THREAD * m_renderThread = nullptr
 
bool m_rhiInitialized = false
 
bool m_isDrawing = false
 
bool m_isUpdating = false
 
RENDER_TARGET m_currentTarget = TARGET_CACHED
 
int m_screenWidth = 0
 
int m_screenHeight = 0
 
float m_dpiScale = 1.0f
 see SetDpiScale()
 
int m_centringPad = 0
 see SetCentringPad()
 
bool m_negativeMode = false
 
bool m_screenSpaceMode = false
 
uint16_t m_strokePixelPad = 0
 see SetStrokePixelPad(), in sixteenths of a pixel
 
float m_strokeLengthPad = 0.0f
 see SetStrokeLengthPad(), 0 when off
 
double m_strokeLod = 0.0
 see SetStrokeLevelOfDetail(), 0 when off
 
double m_bitmapTextHeight = 0.0
 glyph height while bitmap text is stroked, else 0
 
bool m_bitmapGlyphs = false
 see SetBitmapGlyphs()
 
bool m_diffLayerActive = false
 
bool m_drawGrid = false
 
bool m_drawCursor = false
 
bool m_transformIsIdentity = true
 The GPU applies world to screen, so most geometry skips the matrix math on the hot path.
 
GEOMETRY_BUFFER_SET m_bufferSets [BUFFER_RING_SIZE]
 The non-cached pool.
 
int m_currentBufferSet = 0
 
GEOMETRY_BUFFER_SET m_overlaySets [BUFFER_RING_SIZE]
 
int m_currentOverlaySet = 0
 
bool m_persistentTargets = false
 
bool m_nonCachedRefilled = false
 non-cached pool was emptied for the frame being drawn
 
bool m_overlayRefilled = false
 
GEOMETRY_BUFFER_SET m_staticPool
 Pool for TARGET_CACHED.
 
bool m_staticDirty = true
 
GEOMETRY_BUFFER_SET m_gridPool
 The grids of the grid items, which the static target draws over the grid and under all else.
 
std::vector< LAYER_RANGE > m_gridLayerRanges
 
bool m_gridPoolRefilled = false
 
bool m_drawingGridSources = false
 emissions go to m_gridPool
 
std::array< uint64_t, 2 > m_gridPoolHash {}
 hash of what the GPU buffers hold
 
bool m_staticRebuiltThisFlush = false
 see TakeStaticChanged()
 
uint64_t m_bufferGeneration = 1
 Bumped whenever a resource is retired.
 
std::vector< std::pair< uint64_t, RHI_BufferHandle > > m_retiredBuffers
 
std::vector< std::pair< uint64_t, RHI_TextureHandle > > m_retiredTextures
 
std::unordered_map< int, std::vector< STATIC_GROUP_SLOT > > m_staticGroupSlots
 A group may be drawn into the static pool more than once per build, so a patch touches every slot.
 
std::array< PATCH_SPAN, RHI_SHAPES > m_staticPatches
 
uint64_t m_placeSeq = 0
 
bool m_sceneDrawOrdered = false
 
std::unordered_map< int, SCENE_LAYER > m_sceneLayers
 by VIEW layer id
 
std::vector< int > m_sceneOrder
 layer ids in draw order
 
std::multimap< double, int > m_lodGroups
 groups with a scale threshold, by it
 
SCENE_LAYER * m_openSceneLayer = nullptr
 
int m_openSceneLayerId = -1
 
double m_sceneScale = 1.0
 
bool m_sceneChanged = false
 
bool m_sceneOrderStale = false
 
bool m_negativesLayer = false
 
bool m_groupNegative = false
 the group being recorded has drawn a knockout
 
std::unordered_map< KIID, BITMAP_CACHE_ENTRY > m_bitmapTextureCache
 
uint64_t m_bitmapUseCounter = 0
 bumped on every cache touch
 
uint64_t m_bitmapFrameStartSeq = 0
 use counter at frame start, entries used since are pinned
 
std::unordered_map< int, GAL_GROUP > m_groups
 
int m_groupCounter = 0
 
int m_currentGroupId = -1
 
int m_groupDepth = 0
 
SHAPE_INSTANCES m_groupScratchInstances
 BeginGroup() swaps these with the current pool's vectors and EndGroup() swaps them back.
 
std::vector< RHI_VERTEX > m_groupScratchPolygonVertices
 
std::vector< BITMAP_QUAD > m_groupScratchBitmapQuads
 
MATRIX3x3D m_currentTransform
 
std::vector< MATRIX3x3D > m_transformStack
 
std::vector< LAYER_RANGE > m_staticLayerRanges
 Kept per pool so static ranges survive BeginDrawing when m_staticDirty is false.
 
std::vector< LAYER_RANGE > m_dynamicLayerRanges
 
std::vector< LAYER_RANGE > m_overlayLayerRanges
 
TEXT_ATTRIBUTES m_attributes
 

Static Private Attributes

static constexpr int BUFFER_RING_SIZE = 2
 
static constexpr size_t BITMAP_CACHE_MAX_ENTRIES = 64
 

Detailed Description

GAL that turns drawing commands into instanced primitives for the RHI device.

It has no wxWidgets base so it can run headless. EDA_DRAW_PANEL_GAL_MODERN does the wx integration.

Definition at line 49 of file gal_modern.h.

Member Typedef Documentation

◆ SHAPE_INSTANCES

Instances of each instanced shape, indexed by RHI_SHAPE.

Definition at line 278 of file gal_modern.h.

Constructor & Destructor Documentation

◆ GAL_MODERN()

GAL_MODERN::GAL_MODERN ( GAL_DISPLAY_OPTIONS & aOptions,
RHI_DEVICE_PROXY & aDeviceProxy )

◆ ~GAL_MODERN()

GAL_MODERN::~GAL_MODERN ( )
override

Definition at line 230 of file gal_modern.cpp.

References DestroyBuffers().

Member Function Documentation

◆ AcquireRenderThread()

std::shared_ptr< RENDER_THREAD > GAL_MODERN::AcquireRenderThread ( bool aEnableValidation)
static

Return the render thread every RHI canvas in the process shares, starting it on first use and replacing one whose device was lost.

NVIDIA's DXGI-layered present aborts the process when a second device creates a swapchain. It lives in the GAL library because each kiface links its own copy of the RHI code.

Returns
nullptr if the device could not be created.

Definition at line 191 of file gal_modern.cpp.

References RhiCreatePlatformDevice().

Referenced by EDA_DRAW_PANEL_GAL::SwitchBackend().

◆ addArcInstance()

RHI_INSTANCE & GAL_MODERN::addArcInstance ( const VECTOR2D & aCenter,
double aRadius,
double aStartAngle,
double aSweepAngle,
double aWidth,
const COLOR4D & aColor )
private

◆ addCapsuleInstance()

◆ addPadInstance()

RHI_INSTANCE & GAL_MODERN::addPadInstance ( const VECTOR2D & aCenter,
double aHalfWidth,
double aHalfHeight,
double aCornerRadius,
float aShapeType,
double aRotation,
const COLOR4D & aColor )
private

◆ AdvanceDepth()

void KIGFX::GAL::AdvanceDepth ( )
inlineinherited

Change the current depth to deeper, so it is possible to draw objects right beneath other.

If you do this, you should consider using a GAL_SCOPED_ATTR to ensure the depth is reset to the original value.

Definition at line 683 of file graphics_abstraction_layer.h.

References m_layerDepth, and SetLayerDepth().

Referenced by KIGFX::VIEW_GROUP::ViewDraw().

◆ AllocateWindowId()

uint32_t GAL_MODERN::AllocateWindowId ( )
static
Returns
a window ID no other canvas in the process has, whichever kiface it belongs to

Definition at line 222 of file gal_modern.cpp.

Referenced by EDA_DRAW_PANEL_GAL::SwitchBackend().

◆ allocSceneSlot()

template<typename T>
uint32_t GAL_MODERN::allocSceneSlot ( SCENE_ARENA< T > & aArena,
uint32_t aCount )
private

◆ appendSceneRanges()

◆ arenaOf()

static constexpr int KIGFX::GAL_MODERN::arenaOf ( int aShape,
bool aNegative )
inlinestaticconstexpr

◆ assignSlicesByOrder()

bool GAL_MODERN::assignSlicesByOrder ( std::vector< LAYER_RANGE > & aRanges,
size_t aFirst ) const
private

Give ranges their slices of the depth range from one mapping of layer order, the same for every target.

False if the scene has no declared layers to take the mapping from.

Definition at line 3499 of file gal_modern.cpp.

References m_sceneLayers.

Referenced by appendSceneRanges(), and GetDynamicDrawDesc().

◆ BeginDrawing()

void GAL_MODERN::BeginDrawing ( )
overridevirtual

Start/end drawing functions, draw calls can be only made in between the calls to BeginDrawing()/EndDrawing().

Normally you should create a GAL_DRAWING_CONTEXT RAII object, but I'm leaving these functions public for more precise (i.e. timing/profiling) control of the drawing process - Tom Begin the drawing, needs to be called for every new frame. Use GAL_DRAWING_CONTEXT RAII object unless you know what you're doing.

Reimplemented from KIGFX::GAL.

Definition at line 286 of file gal_modern.cpp.

References clearStaticSlots(), m_bitmapFrameStartSeq, m_bitmapUseCounter, m_currentTransform, m_drawCursor, m_isDrawing, m_nonCachedRefilled, m_overlayRefilled, m_persistentTargets, m_staticDirty, m_staticLayerRanges, m_staticPool, m_transformIsIdentity, m_transformStack, refillDynamicTarget(), releaseBitmapQuads(), resetScene(), KIGFX::TARGET_NONCACHED, and KIGFX::TARGET_OVERLAY.

◆ BeginGroup()

int GAL_MODERN::BeginGroup ( )
overridevirtual

Begin a group.

A group is a collection of graphic items. Hierarchical groups are possible, attributes and transformations can be used.

Returns
the number of the group.

Reimplemented from KIGFX::GAL.

Definition at line 2210 of file gal_modern.cpp.

References KIGFX::GAL_MODERN::GEOMETRY_BUFFER_SET::bitmapQuads, KIGFX::GAL_MODERN::GEOMETRY_BUFFER_SET::instances, m_currentGroupId, m_groupCounter, m_groupDepth, m_groupNegative, m_groupScratchBitmapQuads, m_groupScratchInstances, m_groupScratchPolygonVertices, KIGFX::GAL_MODERN::GEOMETRY_BUFFER_SET::polygonVertices, poolForCurrentTarget(), KIGFX::RHI_INSTANCED_SHAPES, and swap.

◆ beginLayerRange()

◆ BeginSceneLayer()

void GAL_MODERN::BeginSceneLayer ( int aLayer)
overridevirtual

Open a cached layer of the retained scene during a rebuild.

Layers draw in the order they are opened, at the current layer depth.

Parameters
aLayeris the VIEW layer id.

Reimplemented from KIGFX::GAL.

Definition at line 2992 of file gal_modern.cpp.

References m_isDrawing, KIGFX::GAL::m_layerDepth, m_negativesLayer, m_openSceneLayer, m_openSceneLayerId, m_sceneLayers, m_staticDirty, and SetSceneLayerState().

◆ beginUpdate()

void GAL_MODERN::beginUpdate ( )
overrideprotectedvirtual

Enable item update mode.

Private: use GAL_UPDATE_CONTEXT RAII object

Reimplemented from KIGFX::GAL.

Definition at line 4336 of file gal_modern.cpp.

References m_isUpdating.

◆ BitmapText()

void GAL_MODERN::BitmapText ( const wxString & aText,
const VECTOR2I & aPosition,
const EDA_ANGLE & aAngle )
overridevirtual

Draw a text using a bitmap font.

It should be faster than StrokeText(), but can be used only for non-Gerber elements.

Parameters
aTextis the text to be drawn.
aPositionis the text position in world coordinates.
aAngleis the text rotation angle.

Reimplemented from KIGFX::GAL.

Definition at line 2083 of file gal_modern.cpp.

References KIGFX::GAL::BitmapText(), drawBitmapGlyphs(), KIGFX::GAL::GetGlyphSize(), m_bitmapTextHeight, and VECTOR2< T >::y.

◆ buf() [1/2]

GEOMETRY_BUFFER_SET & KIGFX::GAL_MODERN::buf ( )
inlineprivate

◆ buf() [2/2]

const GEOMETRY_BUFFER_SET & KIGFX::GAL_MODERN::buf ( ) const
inlineprivate

Definition at line 797 of file gal_modern.h.

References m_bufferSets, and m_currentBufferSet.

◆ buildSceneRuns()

◆ calcAngleStep()

static double KIGFX::GAL::calcAngleStep ( double aRadius)
inlinestaticprotectedinherited

Compute the angle step when drawing arcs/circles approximated with lines.

Bigger arcs need smaller alpha increment to make them look smooth

Definition at line 1469 of file graphics_abstraction_layer.h.

References M_PI, and SEG_PER_CIRCLE_COUNT.

Referenced by KIGFX::GAL_MODERN::DrawArc(), KIGFX::OPENGL_GAL::DrawArc(), KIGFX::OPENGL_GAL::DrawEllipse(), and KIGFX::OPENGL_GAL::DrawEllipseArc().

◆ ChangeGroupColor()

void GAL_MODERN::ChangeGroupColor ( int aGroupNumber,
const COLOR4D & aNewColor )
overridevirtual

◆ ChangeGroupDepth()

void GAL_MODERN::ChangeGroupDepth ( int aGroupNumber,
int aDepth )
overridevirtual

Change the depth (Z-axis position) of the group.

Parameters
aGroupNumberis the group number.
aDepthis the new depth.

Reimplemented from KIGFX::GAL.

Definition at line 3770 of file gal_modern.cpp.

References forEachElement(), group, GroupContentFingerprint(), m_groups, m_staticDirty, patchStaticGroup(), and rewriteResidentGroup().

◆ ChangeGroupUndimmed()

void GAL_MODERN::ChangeGroupUndimmed ( int aGroupNumber,
bool aUndimmed )
overridevirtual

Exempt the group from its layer's dim, see SetSceneLayerDim().

Parameters
aGroupNumberis the group number.
aUndimmedis true to keep the group's colour while its layer is dimmed.

Reimplemented from KIGFX::GAL.

Definition at line 3809 of file gal_modern.cpp.

References RHI_INSTANCE::ClearFlag(), forEachElement(), group, GroupContentFingerprint(), m_groups, rewriteResidentGroup(), RHI_INSTANCE_UNDIMMED, and RHI_INSTANCE::SetFlag().

◆ ClearCache()

void GAL_MODERN::ClearCache ( )
overridevirtual

Delete all data created during caching of graphic items.

Reimplemented from KIGFX::GAL.

Definition at line 3924 of file gal_modern.cpp.

References clearStaticSlots(), group, m_bitmapTextureCache, m_groups, m_lodGroups, m_staticDirty, releaseBitmapQuads(), resetScene(), and retireTexture().

◆ ClearScreen()

void GAL_MODERN::ClearScreen ( )
overridevirtual

◆ clearStaticSlots()

void KIGFX::GAL_MODERN::clearStaticSlots ( )
inlineprivate

Forget where groups sit in the static pool and the patches pending for it.

Definition at line 641 of file gal_modern.h.

References m_staticGroupSlots, and m_staticPatches.

Referenced by BeginDrawing(), ClearCache(), and ClearScreen().

◆ ClearTarget()

void GAL_MODERN::ClearTarget ( RENDER_TARGET aTarget)
overridevirtual

Clear the target for rendering.

Parameters
aTargetis the target to be cleared.

Reimplemented from KIGFX::GAL.

Definition at line 962 of file gal_modern.cpp.

References m_isDrawing, m_nonCachedRefilled, m_overlayRefilled, m_persistentTargets, refillDynamicTarget(), KIGFX::TARGET_NONCACHED, and KIGFX::TARGET_OVERLAY.

◆ compactSceneArena()

◆ computeGroupFingerprint()

◆ computeMinGridSpacing()

double GAL::computeMinGridSpacing ( ) const
protectedinherited

Compute minimum grid spacing from the grid settings.

Returns
the minimum spacing to use for drawing the grid

Definition at line 266 of file graphics_abstraction_layer.cpp.

References m_gridMinSpacing.

Referenced by GetVisibleGridSize(), and gridLattice().

◆ computeWorldScale()

void KIGFX::GAL::computeWorldScale ( )
inlineprotectedinherited

◆ ComputeWorldScreenMatrix()

◆ countBitmapRefs()

void GAL_MODERN::countBitmapRefs ( const GAL_GROUP & aGroup,
int aDelta )
private

Count a group's quads against the cached textures they draw, so a texture a cached group still shows is not evicted for not being drawn again each frame.

Definition at line 3865 of file gal_modern.cpp.

References KIGFX::GAL_MODERN::GAL_GROUP::bitmapQuads, m_bitmapTextureCache, KIGFX::GAL_MODERN::BITMAP_QUAD::ownsTexture, and KIGFX::GAL_MODERN::BITMAP_QUAD::texture.

Referenced by DeleteGroup(), and EndGroup().

◆ countGroupAlpha()

◆ countGroupArenas()

void GAL_MODERN::countGroupArenas ( const GAL_GROUP & aGroup,
uint32_t * aCounts )
staticprivate

Fill aCounts with how many of a group's instances go in each instance arena.

Definition at line 2594 of file gal_modern.cpp.

References arenaOf(), RHI_INSTANCE::HasFlag(), KIGFX::GAL_MODERN::GAL_GROUP::instances, RHI_INSTANCE_NEGATIVE, and KIGFX::RHI_INSTANCED_SHAPES.

Referenced by placeGroupInScene(), and retainedTieOrderChanged().

◆ currentTargetOpen()

bool KIGFX::GAL_MODERN::currentTargetOpen ( ) const
inlineprivate

Whether drawing to the current target lands in a pool that this frame has emptied.

Definition at line 555 of file gal_modern.h.

References m_currentTarget, m_drawingGridSources, m_nonCachedRefilled, m_overlayRefilled, m_persistentTargets, KIGFX::TARGET_CACHED, and KIGFX::TARGET_OVERLAY.

Referenced by beginLayerRange(), EndDiffLayer(), poolForCurrentTarget(), and StartDiffLayer().

◆ DeleteGroup()

void GAL_MODERN::DeleteGroup ( int aGroupNumber)
overridevirtual

Delete the group from the memory.

Parameters
aGroupNumberis the group number.

Reimplemented from KIGFX::GAL.

Definition at line 3847 of file gal_modern.cpp.

References countBitmapRefs(), m_groups, releaseBitmapQuads(), removeGroupFromScene(), and trackGroupLod().

◆ DestroyBuffers()

void GAL_MODERN::DestroyBuffers ( )

Destroy every GPU resource this GAL holds and forget the handles.

The render thread is shared with other canvases, so nothing else would free them.

Definition at line 236 of file gal_modern.cpp.

References KIGFX::GAL_MODERN::SCENE_ARENA< T >::buffer, m_bitmapTextureCache, m_bufferSets, m_deviceProxy, m_gridPool, m_overlaySets, m_persistentTargets, m_sceneLayers, m_staticPool, releaseBitmapQuads(), ReleaseBuffers(), and ReleaseRetiredBuffers().

Referenced by ~GAL_MODERN().

◆ DrawArc()

void GAL_MODERN::DrawArc ( const VECTOR2D & aCenterPoint,
double aRadius,
const EDA_ANGLE & aStartAngle,
const EDA_ANGLE & aAngle )
overridevirtual

Draw an arc.

Parameters
aCenterPointis the center point of the arc.
aRadiusis the arc radius.
aStartAngleis the start angle of the arc.
aAngleis the angle of the arc.

Reimplemented from KIGFX::GAL.

Definition at line 1452 of file gal_modern.cpp.

References addArcInstance(), EDA_ANGLE::AsRadians(), KIGFX::GAL::calcAngleStep(), fillOutline(), KIGFX::GAL::m_fillColor, KIGFX::GAL::m_isFillEnabled, KIGFX::GAL::m_isStrokeEnabled, KIGFX::GAL::m_lineWidth, KIGFX::GAL::m_strokeColor, KIGFX::GAL::normalize(), roundedOutline(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by drawGridSource().

◆ DrawArcSegment()

void GAL_MODERN::DrawArcSegment ( const VECTOR2D & aCenterPoint,
double aRadius,
const EDA_ANGLE & aStartAngle,
const EDA_ANGLE & aAngle,
double aWidth,
double aMaxError )
overridevirtual

Draw an arc segment.

This method differs from DrawArc() in what happens when fill/stroke are on or off. DrawArc() draws a "pie piece" when fill is turned on, and a thick stroke when fill is off. DrawArcSegment() with fill on behaves like DrawArc() with fill off. DrawArcSegment() with fill off draws the outline of what it would have drawn with fill on.

This has meaning only for back ends that can't draw a true arc, and use segments to approximate.

TODO: Unify Arc routines

Parameters
aCenterPointis the center point of the arc.
aRadiusis the arc radius.
aStartAngleis the start angle of the arc.
aAngleis the angle of the arc.
aWidthis the thickness of the arc (pen size).
aMaxErroris the max allowed error to create segments to approximate a circle.

Reimplemented from KIGFX::GAL.

Definition at line 1492 of file gal_modern.cpp.

References addArcInstance(), EDA_ANGLE::AsRadians(), DrawCircle(), KIGFX::GAL::m_fillColor, KIGFX::GAL::m_isFillEnabled, KIGFX::GAL::m_isStrokeEnabled, KIGFX::GAL::m_lineWidth, M_PI, KIGFX::GAL::m_strokeColor, KIGFX::GAL::normalize(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ DrawBitmap()

void GAL_MODERN::DrawBitmap ( const BITMAP_BASE & aBitmap,
double alphaBlend = 1.0 )
overridevirtual

◆ drawBitmapGlyphs()

◆ DrawCircle()

void GAL_MODERN::DrawCircle ( const VECTOR2D & aCenterPoint,
double aRadius )
overridevirtual

Draw a circle using world coordinates.

Parameters
aCenterPointis the center point of the circle.
aRadiusis the radius of the circle.

Reimplemented from KIGFX::GAL.

Definition at line 1552 of file gal_modern.cpp.

References addArcInstance(), addPadInstance(), KIGFX::GAL::m_fillColor, KIGFX::GAL::m_isFillEnabled, KIGFX::GAL::m_isStrokeEnabled, KIGFX::GAL::m_lineWidth, M_PI, KIGFX::GAL::m_strokeColor, RHI_INSTANCE_PIXEL_CIRCLE, and RHI_INSTANCE::SetFlag().

Referenced by DrawArcSegment(), and DrawSegment().

◆ DrawCursor()

void GAL_MODERN::DrawCursor ( const VECTOR2D & aCursorPosition)
overridevirtual

Draw the cursor.

Parameters
aCursorPositionis the cursor position in screen coordinates.

Reimplemented from KIGFX::GAL.

Definition at line 1293 of file gal_modern.cpp.

References KIGFX::GAL::m_cursorPosition, and m_drawCursor.

◆ DrawCurve()

void GAL_MODERN::DrawCurve ( const VECTOR2D & startPoint,
const VECTOR2D & controlPointA,
const VECTOR2D & controlPointB,
const VECTOR2D & endPoint,
double aFilterValue = 0.0 )
overridevirtual

Draw a cubic bezier spline.

Parameters
startPointis the start point of the spline.
controlPointAis the first control point.
controlPointBis the second control point.
endPointis the end point of the spline.
aFilterValueis used by Bezier to segments approximation, if the Bezier curve is not supported and needs a curve to polyline conversion. aFilterValue = 0 means no filtering.

Reimplemented from KIGFX::GAL.

Definition at line 1728 of file gal_modern.cpp.

References DrawLine(), and BEZIER_POLY::GetPoly().

◆ DrawEllipse()

void GAL_MODERN::DrawEllipse ( const VECTOR2D & aCenterPoint,
double aMajorRadius,
double aMinorRadius,
const EDA_ANGLE & aRotation )
overridevirtual

Draw a closed ellipse.

Parameters
aCenterPointcenter of the ellipse.
aMajorRadiusmajor semi-axis length.
aMinorRadiusminor semi-axis length.
aRotationrotation of the major axis from world X, CCW.

Reimplemented from KIGFX::GAL.

Definition at line 1571 of file gal_modern.cpp.

References drawEllipseShape(), and KiROUND().

◆ DrawEllipseArc()

void GAL_MODERN::DrawEllipseArc ( const VECTOR2D & aCenterPoint,
double aMajorRadius,
double aMinorRadius,
const EDA_ANGLE & aRotation,
const EDA_ANGLE & aStartAngle,
const EDA_ANGLE & aEndAngle )
overridevirtual

Draw an elliptical arc in world coordinates.

Parameters
aCenterPointcenter of the parent ellipse.
aMajorRadiusmajor semi-axis length.
aMinorRadiusminor semi-axis length.
aRotationrotation of the major axis from world X, CCW.
aStartAnglesweep start angle in the ellipse local frame, CCW.
aEndAnglesweep end angle in the ellipse local frame, CCW.

Reimplemented from KIGFX::GAL.

Definition at line 1582 of file gal_modern.cpp.

References drawEllipseShape(), and KiROUND().

◆ drawEllipseShape()

void GAL_MODERN::drawEllipseShape ( const SHAPE_ELLIPSE & aEllipse)
private

◆ DrawGlyph()

void GAL_MODERN::DrawGlyph ( const KIFONT::GLYPH & aGlyph,
int aNth = 0,
int aTotal = 1 )
overridevirtual

Draw a polygon representing a font glyph.

Reimplemented from KIGFX::GAL.

Definition at line 2096 of file gal_modern.cpp.

References DrawPolylines(), emitTriangle(), fillVertex(), KIFONT::GLYPH::IsOutline(), KIFONT::GLYPH::IsStroke(), and KIGFX::GAL::m_fillColor.

◆ DrawGlyphs()

virtual void KIGFX::GAL::DrawGlyphs ( const std::vector< std::unique_ptr< KIFONT::GLYPH > > & aGlyphs)
inlinevirtualinherited

◆ DrawGrid()

void GAL_MODERN::DrawGrid ( )
overridevirtual

Draw the grid.

Reimplemented from KIGFX::GAL.

Definition at line 1063 of file gal_modern.cpp.

References drawGridSources(), gridShown(), KIGFX::GAL::m_axesEnabled, and m_drawGrid.

◆ drawGridCoverageShape()

◆ drawGridSource()

◆ drawGridSources()

void GAL_MODERN::drawGridSources ( )
private

◆ DrawGroup()

◆ DrawHoleWall()

void GAL_MODERN::DrawHoleWall ( const VECTOR2D & aCenterPoint,
double aHoleRadius,
double aWallWidth )
overridevirtual

Draw a hole wall ring.

Parameters
aCenterPointis the center point of the hole.
aHoleRadiusis the radius of the hole.
aWallWidthis the wall thickness.

Reimplemented from KIGFX::GAL.

Definition at line 1615 of file gal_modern.cpp.

References addArcInstance(), KIGFX::GAL::m_fillColor, KIGFX::GAL::m_isFillEnabled, M_PI, RHI_INSTANCE_GROW_OUTWARD, RHI_INSTANCE_PIXEL_CIRCLE, and RHI_INSTANCE::SetFlag().

◆ DrawLine()

void GAL_MODERN::DrawLine ( const VECTOR2D & aStartPoint,
const VECTOR2D & aEndPoint )
overridevirtual

Draw a line.

Start and end points are defined as 2D-Vectors.

Parameters
aStartPointis the start point of the line.
aEndPointis the end point of the line.

Reimplemented from KIGFX::GAL.

Definition at line 1300 of file gal_modern.cpp.

References addCapsuleInstance(), KIGFX::GAL::m_lineWidth, and KIGFX::GAL::m_strokeColor.

Referenced by DrawCurve(), drawGridSource(), drawPolylineSegments(), and strokeLineChain().

◆ DrawPad()

void GAL_MODERN::DrawPad ( const VECTOR2D & aCenter,
double aHalfWidth,
double aHalfHeight,
double aCornerRadius,
float aShapeType,
double aRotation,
const COLOR4D & aColor )
overridevirtual

Draw a filled pad as one primitive in aColor.

Only called when SupportsTypedPads().

Parameters
aShapeTypeis 0 circle, 1 rect, 2 roundrect, 3 chamfered, 4 oval or 5 trapezoid.

Reimplemented from KIGFX::GAL.

Definition at line 1343 of file gal_modern.cpp.

References addPadInstance().

◆ DrawPolygon() [1/4]

void GAL_MODERN::DrawPolygon ( const SHAPE_LINE_CHAIN & aPolySet)
overridevirtual

◆ DrawPolygon() [2/4]

◆ DrawPolygon() [3/4]

void GAL_MODERN::DrawPolygon ( const std::deque< VECTOR2D > & aPointList)
overridevirtual

Draw a polygon.

Parameters
aPointListis the list of the polygon points.

Reimplemented from KIGFX::GAL.

Definition at line 1657 of file gal_modern.cpp.

References drawPolylineSegments(), fillOutline(), KIGFX::GAL::m_fillColor, KIGFX::GAL::m_isFillEnabled, KIGFX::GAL::m_isStrokeEnabled, and roundedOutline().

◆ DrawPolygon() [4/4]

void GAL_MODERN::DrawPolygon ( const VECTOR2D aPointList[],
int aListSize )
overridevirtual

◆ DrawPolyline() [1/4]

void GAL_MODERN::DrawPolyline ( const SHAPE_LINE_CHAIN & aLineChain)
overridevirtual

Reimplemented from KIGFX::GAL.

Definition at line 1901 of file gal_modern.cpp.

References strokeLineChain().

◆ DrawPolyline() [2/4]

void GAL_MODERN::DrawPolyline ( const std::deque< VECTOR2D > & aPointList)
overridevirtual

Draw a polyline.

Parameters
aPointListis a list of 2D-Vectors containing the polyline points.

Reimplemented from KIGFX::GAL.

Definition at line 1880 of file gal_modern.cpp.

References drawPolylineSegments().

Referenced by DrawPolylines().

◆ DrawPolyline() [3/4]

void GAL_MODERN::DrawPolyline ( const std::vector< VECTOR2D > & aPointList)
overridevirtual

Reimplemented from KIGFX::GAL.

Definition at line 1886 of file gal_modern.cpp.

References drawPolylineSegments().

◆ DrawPolyline() [4/4]

void GAL_MODERN::DrawPolyline ( const VECTOR2D aPointList[],
int aListSize )
overridevirtual

Reimplemented from KIGFX::GAL.

Definition at line 1892 of file gal_modern.cpp.

References drawPolylineSegments().

◆ DrawPolylines()

void GAL_MODERN::DrawPolylines ( const std::vector< std::vector< VECTOR2D > > & aPointLists)
overridevirtual

Draw multiple polylines.

Parameters
aPointListsare lists of 2D-Vectors containing the polyline points.

Reimplemented from KIGFX::GAL.

Definition at line 1907 of file gal_modern.cpp.

References DrawPolyline().

Referenced by DrawGlyph().

◆ DrawRectangle() [1/2]

void KIGFX::GAL::DrawRectangle ( const BOX2I & aRect)
inlineinherited

◆ DrawRectangle() [2/2]

void GAL_MODERN::DrawRectangle ( const VECTOR2D & aStartPoint,
const VECTOR2D & aEndPoint )
overridevirtual

Draw a rectangle.

Parameters
aStartPointis the start point of the rectangle.
aEndPointis the end point of the rectangle.

Reimplemented from KIGFX::GAL.

Definition at line 1630 of file gal_modern.cpp.

References std::abs(), addCapsuleInstance(), addPadInstance(), center, KIGFX::GAL::m_fillColor, KIGFX::GAL::m_isFillEnabled, KIGFX::GAL::m_isStrokeEnabled, KIGFX::GAL::m_lineWidth, KIGFX::GAL::m_strokeColor, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by drawGridSource().

◆ DrawSegment()

void GAL_MODERN::DrawSegment ( const VECTOR2D & aStartPoint,
const VECTOR2D & aEndPoint,
double aWidth )
overridevirtual

Draw a rounded segment.

Start and end points are defined as 2D-Vectors.

Parameters
aStartPointis the start point of the segment.
aEndPointis the end point of the segment.
aWidthis a width of the segment

Reimplemented from KIGFX::GAL.

Definition at line 1306 of file gal_modern.cpp.

References addArcInstance(), addCapsuleInstance(), delta, DrawCircle(), KIGFX::GAL::m_fillColor, KIGFX::GAL::m_isFillEnabled, M_PI, KIGFX::GAL::m_strokeColor, VECTOR2< T >::Resize(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by DrawSegmentChain(), and DrawSegmentChain().

◆ DrawSegmentChain() [1/2]

void GAL_MODERN::DrawSegmentChain ( const SHAPE_LINE_CHAIN & aLineChain,
double aWidth )
overridevirtual

◆ DrawSegmentChain() [2/2]

void GAL_MODERN::DrawSegmentChain ( const std::vector< VECTOR2D > & aPointList,
double aWidth )
overridevirtual

Draw a chain of rounded segments.

Parameters
aPointListis a list of 2D-Vectors containing the chain points.
aWidthis a width of the segments

Reimplemented from KIGFX::GAL.

Definition at line 1352 of file gal_modern.cpp.

References DrawSegment().

◆ DrawTrack()

void GAL_MODERN::DrawTrack ( const VECTOR2D & aStart,
const VECTOR2D & aEnd,
double aWidth,
const COLOR4D & aColor )
overridevirtual

Draw a filled track capsule in aColor without touching the fill and stroke state.

Backends may override it to skip that overhead on the track hot path.

Reimplemented from KIGFX::GAL.

Definition at line 1336 of file gal_modern.cpp.

References addCapsuleInstance().

◆ emitInstance()

void KIGFX::GAL_MODERN::emitInstance ( RHI_SHAPE aShape,
const RHI_INSTANCE & aInstance )
inlineprivate

Append to the current target's pool.

Definition at line 430 of file gal_modern.h.

References poolForCurrentTarget().

Referenced by addArcInstance(), addCapsuleInstance(), and addPadInstance().

◆ emitTriangle()

void GAL_MODERN::emitTriangle ( const VECTOR2D & aA,
const VECTOR2D & aB,
const VECTOR2D & aC,
const RHI_VERTEX & aFill )
private

Append a triangle given in world coordinates under the current transform.

Definition at line 2196 of file gal_modern.cpp.

References KIGFX::GAL_MODERN::GEOMETRY_BUFFER_SET::polygonVertices, poolForCurrentTarget(), VECTOR2< T >::x, xform(), and VECTOR2< T >::y.

Referenced by DrawGlyph(), and emitTriangulatedPolygon().

◆ emitTriangulatedPolygon()

void GAL_MODERN::emitTriangulatedPolygon ( const SHAPE_POLY_SET & aPolySet,
const COLOR4D & aColor )
private

◆ EnableDepthTest()

virtual void KIGFX::GAL::EnableDepthTest ( bool aEnabled = false)
inlinevirtualinherited

Reimplemented in KIGFX::CAIRO_GAL_BASE, and KIGFX::OPENGL_GAL.

Definition at line 1362 of file graphics_abstraction_layer.h.

◆ EndDiffLayer()

void GAL_MODERN::EndDiffLayer ( )
overridevirtual

Ends rendering of a differential layer.

Objects drawn after the StartDiffLayer() will be drawn and composited with a differential blend mode, then drawing is returned to normal.

Reimplemented from KIGFX::GAL.

Definition at line 998 of file gal_modern.cpp.

References beginLayerRange(), currentTargetOpen(), layerRangesForCurrentTarget(), m_diffLayerActive, m_isDrawing, and KIGFX::GAL::m_layerDepth.

◆ EndDrawing()

void GAL_MODERN::EndDrawing ( )
overridevirtual

End the drawing, needs to be called for every new frame.

Use GAL_DRAWING_CONTEXT RAII object unless you know what you're doing.

Reimplemented from KIGFX::GAL.

Definition at line 358 of file gal_modern.cpp.

References Flush(), and m_isDrawing.

◆ EndGroup()

◆ EndNegativesLayer()

void GAL_MODERN::EndNegativesLayer ( )
overridevirtual

Ends rendering of a negatives layer and draws it to the main layer.

No-op in OpenGL.

Reimplemented from KIGFX::GAL.

Definition at line 1025 of file gal_modern.cpp.

References m_negativeMode, and m_negativesLayer.

◆ endUpdate()

void GAL_MODERN::endUpdate ( )
overrideprotectedvirtual

Disable item update mode.

Reimplemented from KIGFX::GAL.

Definition at line 4342 of file gal_modern.cpp.

References m_isUpdating.

◆ ensureBuffer()

bool GAL_MODERN::ensureBuffer ( RHI_BufferHandle & aBuffer,
size_t & aCapacity,
size_t aNeeded,
size_t aStride )
private

Grow aBuffer to hold aNeeded elements.

On allocation failure return false and leave the buffer intact, so the caller can take the GPU out-of-memory fallback instead of dropping geometry.

Definition at line 443 of file gal_modern.cpp.

References m_deviceProxy, retireBuffer(), RHI_BUFFER_DESC::sizeBytes, RHI_BUFFER_DESC::type, and VERTEX.

Referenced by Flush(), and uploadSceneArena().

◆ evictBitmapCacheEntries()

void GAL_MODERN::evictBitmapCacheEntries ( )
private

Evict least recently used entries down to the entry and byte caps, sparing those used this frame since a submitted quad may still reference them.

Definition at line 3884 of file gal_modern.cpp.

References KIGFX::BITMAP_CACHE_MAX_BYTES, BITMAP_CACHE_MAX_ENTRIES, m_bitmapFrameStartSeq, m_bitmapTextureCache, and retireTexture().

Referenced by DrawBitmap().

◆ fillOutline()

void GAL_MODERN::fillOutline ( SHAPE_LINE_CHAIN aOutline,
const COLOR4D & aColor )
private

◆ fillVertex()

RHI_VERTEX GAL_MODERN::fillVertex ( const COLOR4D & aColor)
private

◆ Flush()

void GAL_MODERN::Flush ( )
overridevirtual

Force all remaining objects to be drawn.

Reimplemented from KIGFX::GAL.

Definition at line 479 of file gal_modern.cpp.

References KIGFX::LAYER_RANGE::alpha, KIGFX::GAL_MODERN::POLARITY_MARK::at, KIGFX::LAYER_RANGE::bitmapCount, KIGFX::GAL_MODERN::GEOMETRY_BUFFER_SET::bitmapQuads, KIGFX::LAYER_RANGE::bitmapStart, buf(), KIGFX::GAL_MODERN::GEOMETRY_BUFFER_SET::buffer, KIGFX::GAL_MODERN::GEOMETRY_BUFFER_SET::capacity, KIGFX::LAYER_RANGE::count, KIGFX::POLARITY_RUN::count, KIGFX::GAL_MODERN::GEOMETRY_BUFFER_SET::cullRuns, KIGFX::LAYER_RANGE::depth, RHI_INSTANCE::depth, KIGFX::LAYER_RANGE::depthKnockout, KIGFX::GAL_MODERN::GEOMETRY_BUFFER_SET::Empty(), KIGFX::POLARITY_RUN::Empty(), end, ensureBuffer(), flushScene(), RHI_INSTANCE::HasFlag(), hashDigest(), hashPool(), KIGFX::LAYER_RANGE::hasNegatives, KIGFX::GAL_MODERN::GEOMETRY_BUFFER_SET::instances, keepsRelativeDepth(), KIGFX::GAL_MODERN::GEOMETRY_BUFFER_SET::lastCount, KIGFX::GAL_MODERN::GEOMETRY_BUFFER_SET::lastNegCount, m_currentTarget, m_dynamicLayerRanges, m_gridLayerRanges, m_gridPool, m_gridPoolHash, m_gridPoolRefilled, m_nonCachedRefilled, m_overlayLayerRanges, m_overlayRefilled, m_renderThread, m_sceneChanged, m_staticDirty, m_staticLayerRanges, m_staticPatches, m_staticPool, m_staticRebuiltThisFlush, KIGFX::GAL_MODERN::POLARITY_MARK::negative, KIGFX::POLARITY_RUN::negative, KIGFX::LAYER_RANGE::negCount, KIGFX::LAYER_RANGE::negStart, obuf(), KIGFX::GAL_MODERN::GEOMETRY_BUFFER_SET::polarityMarks, KIGFX::GAL_MODERN::GEOMETRY_BUFFER_SET::polarityRuns, KIGFX::GAL_MODERN::GEOMETRY_BUFFER_SET::polygonVertices, relativeDepth(), KIGFX::RHI_CULL_RUN_LENGTH, KIGFX::RHI_CULL_VERTEX_RUN_LENGTH, RHI_INSTANCE_HARD_EDGE, RHI_INSTANCE_NEGATIVE, KIGFX::RHI_INSTANCED_SHAPES, KIGFX::RHI_SHAPE_POLYGON, KIGFX::RHI_SHAPES, RhiUploadAdoptStaging(), RhiUploadCopyStaging(), KIGFX::RhiVertexRun(), KIGFX::LAYER_RANGE::runCount, KIGFX::LAYER_RANGE::runStart, RHI_INSTANCE::SetFlag(), KIGFX::LAYER_RANGE::singleCoverage, KIGFX::GAL_MODERN::GEOMETRY_BUFFER_SET::Sizes(), KIGFX::LAYER_RANGE::start, KIGFX::POLARITY_RUN::start, submitSpan(), table, KIGFX::LAYER_RANGE::target, RHI_GEOMETRY_UPLOAD::targetBuffer, RHI_GEOMETRY_UPLOAD::targetOffset, and updateRuns().

Referenced by EndDrawing().

◆ flushScene()

◆ freeSceneSlot()

template<typename T>
void GAL_MODERN::freeSceneSlot ( SCENE_ARENA< T > & aArena,
uint32_t aStart,
uint32_t aCount )
private

◆ GetClearColor()

const COLOR4D & KIGFX::GAL::GetClearColor ( ) const
inlineinherited

Definition at line 519 of file graphics_abstraction_layer.h.

References m_clearColor.

Referenced by EDIT_POINTS::ViewDraw().

◆ GetCoarseGrid()

int KIGFX::GAL::GetCoarseGrid ( ) const
inlineinherited

Definition at line 1280 of file graphics_abstraction_layer.h.

References m_gridTick.

◆ GetContextLoss()

virtual GAL_CONTEXT_LOSS KIGFX::GAL::GetContextLoss ( ) const
inlinevirtualinherited

Check whether a GPU reset destroyed this canvas' rendering context.

A lost canvas cannot draw or update cached items until its owner rebuilds it.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1391 of file graphics_abstraction_layer.h.

References KIGFX::NONE.

◆ getCursorColor()

COLOR4D GAL::getCursorColor ( ) const
protectedinherited

◆ GetDrawDesc()

FRAME_DRAW_DESC GAL_MODERN::GetDrawDesc ( ) const

◆ GetDynamicDrawDesc()

◆ GetFillColor()

const COLOR4D & KIGFX::GAL::GetFillColor ( ) const
inlineinherited

Get the fill color.

Returns
the color for filling a outline.

Definition at line 588 of file graphics_abstraction_layer.h.

References m_fillColor.

Referenced by DrawGlyphs().

◆ GetGlyphSize()

◆ GetGridColor()

const COLOR4D & KIGFX::GAL::GetGridColor ( ) const
inlineinherited

Definition at line 1281 of file graphics_abstraction_layer.h.

References m_gridColor.

◆ GetGridLineWidth()

float KIGFX::GAL::GetGridLineWidth ( ) const
inlineinherited

Get the grid line width.

Returns
the grid line width

Definition at line 1263 of file graphics_abstraction_layer.h.

References m_gridLineWidth.

◆ GetGridOrigin()

const VECTOR2D & KIGFX::GAL::GetGridOrigin ( ) const
inlineinherited

Definition at line 1161 of file graphics_abstraction_layer.h.

References m_gridOrigin.

◆ GetGridPoint()

VECTOR2D GAL::GetGridPoint ( const VECTOR2D & aPoint) const
inherited

For a given point it returns the nearest point belonging to the grid in world coordinates.

Parameters
aPointis the point for which the grid point is searched.
Returns
The nearest grid point in world coordinates.

Definition at line 405 of file graphics_abstraction_layer.cpp.

References KiROUND(), m_gridOffset, m_gridSize, m_gridSources, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by KIGFX::WX_VIEW_CONTROLS::GetRawCursorPosition().

◆ GetGridSize()

const VECTOR2D & KIGFX::GAL::GetGridSize ( ) const
inlineinherited

◆ GetGridSnapping()

◆ GetGridSources()

const std::vector< GRID_SOURCE > & KIGFX::GAL::GetGridSources ( ) const
inlineinherited

Definition at line 1277 of file graphics_abstraction_layer.h.

References m_gridSources.

◆ GetGridStyle()

GRID_STYLE KIGFX::GAL::GetGridStyle ( ) const
inlineinherited

Definition at line 1279 of file graphics_abstraction_layer.h.

References m_gridStyle.

◆ GetGridVisibility()

bool KIGFX::GAL::GetGridVisibility ( ) const
inlineinherited

Definition at line 1133 of file graphics_abstraction_layer.h.

References m_gridVisibility.

◆ GetHorizontalJustify()

GR_TEXT_H_ALIGN_T KIGFX::GAL::GetHorizontalJustify ( ) const
inlineinherited

◆ GetIsFill()

bool KIGFX::GAL::GetIsFill ( ) const
inlineinherited

Get the fill status.

Returns
true if fill is enabled, false otherwise.

Definition at line 548 of file graphics_abstraction_layer.h.

References m_isFillEnabled.

◆ GetIsStroke()

bool KIGFX::GAL::GetIsStroke ( ) const
inlineinherited

Get the stroke status.

Returns
true if stroke is enabled, false otherwise.

Definition at line 568 of file graphics_abstraction_layer.h.

References m_isStrokeEnabled.

◆ getLayerDepth()

double KIGFX::GAL::getLayerDepth ( ) const
inlineprivateinherited

Definition at line 1613 of file graphics_abstraction_layer.h.

References m_layerDepth.

◆ GetLayoutPixelSize()

VECTOR2I KIGFX::GAL_MODERN::GetLayoutPixelSize ( ) const
inlineoverridevirtual

Return the size the view is centred in and panned by.

It is the canvas size unless the canvas lays its view out like one of another size.

Reimplemented from KIGFX::GAL.

Definition at line 157 of file gal_modern.h.

References m_centringPad, and KIGFX::GAL::m_screenSize.

◆ GetLineWidth()

float KIGFX::GAL::GetLineWidth ( ) const
inlineinherited

Get the line width.

Returns
the actual line width.

Definition at line 643 of file graphics_abstraction_layer.h.

References m_lineWidth.

Referenced by BitmapText(), CALLBACK_GAL::DrawGlyph(), ROUTER_PREVIEW_ITEM::drawLineChain(), and RATSNEST_VIEW_ITEM::ViewDraw().

◆ GetLookAtPoint()

const VECTOR2D & KIGFX::GAL::GetLookAtPoint ( ) const
inlineinherited

Definition at line 917 of file graphics_abstraction_layer.h.

References m_lookAtPoint.

Referenced by GetVisibleWorldExtents().

◆ GetMaxDepth()

double KIGFX::GAL::GetMaxDepth ( ) const
inlineinherited

Definition at line 938 of file graphics_abstraction_layer.h.

References m_depthRange.

◆ GetMinDepth()

double KIGFX::GAL::GetMinDepth ( ) const
inlineinherited

◆ GetMinLineWidth()

float KIGFX::GAL::GetMinLineWidth ( ) const
inlineinherited

Get the minimum line width in pixels.

Returns
the minimum line width.

Definition at line 653 of file graphics_abstraction_layer.h.

References m_minLineWidth.

Referenced by KIGFX::OPENGL_GAL::BeginDrawing().

◆ GetRotation()

double KIGFX::GAL::GetRotation ( ) const
inlineinherited

Definition at line 926 of file graphics_abstraction_layer.h.

References m_rotation.

◆ GetScreenDPI()

double KIGFX::GAL::GetScreenDPI ( ) const
inlineinherited

Definition at line 909 of file graphics_abstraction_layer.h.

References m_screenDPI.

◆ GetScreenPixelSize()

const VECTOR2I & KIGFX::GAL::GetScreenPixelSize ( ) const
inlineinherited

◆ GetScreenWorldMatrix()

const MATRIX3x3D & KIGFX::GAL::GetScreenWorldMatrix ( ) const
inlineinherited

Get the screen <-> world transformation matrix.

The matrix carries the world scale, so this counts as a read of it, see TakeWorldScaleRead().

Returns
the transformation matrix.

Definition at line 868 of file graphics_abstraction_layer.h.

References m_screenWorldMatrix, and m_worldScaleRead.

Referenced by GetVisibleWorldExtents(), KIGFX::OPENGL_GAL::getWorldPixelSize(), screenSpaceCircle(), screenSpaceLine(), ROUTER_STATUS_VIEW_ITEM::ViewDraw(), and TUNING_STATUS_VIEW_ITEM::ViewDraw().

◆ GetStaticDrawDesc()

◆ GetStrokeColor()

const COLOR4D & KIGFX::GAL::GetStrokeColor ( ) const
inlineinherited

Get the stroke color.

Returns
the color for stroking the outline.

Definition at line 613 of file graphics_abstraction_layer.h.

References m_strokeColor.

Referenced by DrawGlyphs(), KIGFX::PREVIEW::DrawTextNextToCursor(), and KIGFX::PREVIEW::RULER_ITEM::ViewDraw().

◆ GetSwapInterval()

int GAL_MODERN::GetSwapInterval ( ) const
overridevirtual

Return the swap interval. -1 for adaptive, 0 for disabled/unknown.

Reimplemented from KIGFX::GAL.

Definition at line 4007 of file gal_modern.cpp.

◆ GetTarget()

RENDER_TARGET GAL_MODERN::GetTarget ( ) const
overridevirtual

Get the currently used target for rendering.

Returns
The current rendering target.

Reimplemented from KIGFX::GAL.

Definition at line 956 of file gal_modern.cpp.

References m_currentTarget.

◆ GetVerticalJustify()

GR_TEXT_V_ALIGN_T KIGFX::GAL::GetVerticalJustify ( ) const
inlineinherited

◆ GetVisibleGridSize()

VECTOR2D KIGFX::GAL::GetVisibleGridSize ( ) const
inlineinherited

Return the visible grid size in x and y directions.

Returns
A vector containing the spacing of visible grid marks

Definition at line 1198 of file graphics_abstraction_layer.h.

References KIGFX::AutoSparsePitch(), computeMinGridSpacing(), m_gridSize, m_gridStyle, m_gridTick, m_worldScale, minSize, KIGFX::SMALL_CROSS, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by KIGFX::CAIRO_GAL_BASE::DrawGrid(), KIGFX::OPENGL_GAL::DrawGrid(), KIGFX::GAL_MODERN::PopulateCameraUBOs(), and ViaSnapRange().

◆ GetVisibleWorldExtents()

BOX2D GAL::GetVisibleWorldExtents ( ) const
inherited
Returns
the bounding box of the world that is displayed on screen at the moment

Definition at line 251 of file graphics_abstraction_layer.cpp.

References GetLookAtPoint(), MATRIX3x3< T >::GetScale(), GetScreenWorldMatrix(), m_screenSize, BOX2< Vec >::SetOrigin(), BOX2< Vec >::SetSize(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by ROUTER_TOOL::handleCommonEvents(), and ROUTER_TOOL::InlineDrag().

◆ GetWorldScale()

◆ GetWorldScaleForScreenSpace()

double KIGFX::GAL::GetWorldScaleForScreenSpace ( ) const
inlineinherited

Get the world scale to size something drawn in screen space mode.

Such things keep their pixel size at any scale, so unlike GetWorldScale() this is not a read, see TakeWorldScaleRead().

Definition at line 955 of file graphics_abstraction_layer.h.

References m_worldScale.

◆ GetWorldScreenMatrix()

const MATRIX3x3D & KIGFX::GAL::GetWorldScreenMatrix ( ) const
inlineinherited

Get the world <-> screen transformation matrix.

The matrix carries the world scale, so this counts as a read of it, see TakeWorldScaleRead().

Returns
the transformation matrix.

Definition at line 855 of file graphics_abstraction_layer.h.

References m_worldScaleRead, and m_worldScreenMatrix.

◆ GetWorldUnitLength()

double KIGFX::GAL::GetWorldUnitLength ( ) const
inlineinherited

Definition at line 898 of file graphics_abstraction_layer.h.

References m_worldUnitLength.

Referenced by CONSTRAINT_BADGE_ITEM::ViewDraw().

◆ GetZoomFactor()

double KIGFX::GAL::GetZoomFactor ( ) const
inlineinherited

◆ gridLattice()

◆ gridMinorLineWidth()

float KIGFX::GAL::gridMinorLineWidth ( double aWorldPixelSize,
double aScaleFactor ) const
inlineprotectedinherited

Compute the world width of a minor grid line.

A major line is twice as wide. Shaders round this to whole pixels, so every canvas must evaluate it in the same order to round the same way.

Parameters
aWorldPixelSizeis the world length of a screen pixel.
aScaleFactoris the canvas DPI scale factor.

Definition at line 1460 of file graphics_abstraction_layer.h.

References m_gridLineWidth.

Referenced by KIGFX::OPENGL_GAL::DrawGrid(), KIGFX::GAL_MODERN::drawGridSource(), KIGFX::OPENGL_GAL::drawGridSources(), and KIGFX::GAL_MODERN::PopulateCameraUBOs().

◆ gridScreenBBox()

BOX2D GAL::gridScreenBBox ( const GRID_SOURCE & aSrc) const
protectedinherited
Returns
the visible screen area expressed in aSrc's frame (relative to its origin and counter-rotated by its orientation).

Definition at line 286 of file graphics_abstraction_layer.cpp.

References m_screenSize, m_screenWorldMatrix, BOX2< Vec >::Merge(), GRID_GEOMETRY::orientation, GRID_GEOMETRY::origin, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by drawGridCoverageShape(), KIGFX::CAIRO_GAL_BASE::drawGridSource(), KIGFX::GAL_MODERN::drawGridSource(), KIGFX::OPENGL_GAL::drawGridSources(), and gridLattice().

◆ gridShown()

bool KIGFX::GAL_MODERN::gridShown ( ) const
inlineprivate

Definition at line 735 of file gal_modern.h.

References KIGFX::GAL::m_gridSize, and KIGFX::GAL::m_gridVisibility.

Referenced by DrawGrid(), and PopulateCameraUBOs().

◆ gridSourceColor()

COLOR4D GAL::gridSourceColor ( const GRID_SOURCE & aSrc) const
protectedinherited

◆ GroupContentFingerprint()

std::array< uint64_t, 2 > GAL_MODERN::GroupContentFingerprint ( int aGroupNumber) const
overridevirtual

◆ HasRetainedScene()

bool KIGFX::GAL_MODERN::HasRetainedScene ( ) const
inlineoverridevirtual

Return true if the backend keeps cached groups in a persistent scene that it patches in place, so one changed item does not make VIEW emit every cached layer again.

VIEW places each group with SetGroupPlacement() and emits the cached layers through BeginSceneLayer() only while HasStaticRebuildPending(). The scene holds every item, not just the viewport.

Reimplemented from KIGFX::GAL.

Definition at line 58 of file gal_modern.h.

◆ HasStaticRebuildPending()

bool KIGFX::GAL_MODERN::HasStaticRebuildPending ( ) const
inlineoverridevirtual

Return true if the backend dropped its cached geometry and VIEW must draw the cached layers again, even when its own TARGET_CACHED is clean.

Otherwise the pool would rebuild empty and blank the scene.

Reimplemented from KIGFX::GAL.

Definition at line 57 of file gal_modern.h.

References m_staticDirty.

◆ HasTarget()

virtual bool KIGFX::GAL::HasTarget ( RENDER_TARGET aTarget)
inlinevirtualinherited

Return true if the target exists.

Parameters
aTargetis the target to be checked.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1039 of file graphics_abstraction_layer.h.

◆ IsCairoEngine()

virtual bool KIGFX::GAL::IsCairoEngine ( )
inlinevirtualinherited

Return true if the GAL engine is a Cairo based type.

Reimplemented in KIGFX::CAIRO_GAL_BASE.

Definition at line 164 of file graphics_abstraction_layer.h.

Referenced by getShadowLayer().

◆ IsContextLocked()

virtual bool KIGFX::GAL::IsContextLocked ( )
inlinevirtualinherited

Checks the state of the context lock.

Returns
True if the context is currently locked

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1368 of file graphics_abstraction_layer.h.

◆ IsContextValid()

virtual bool KIGFX::GAL::IsContextValid ( ) const
inlinevirtualinherited

Check whether the locked context is actually the current one.

A canvas whose native window is already gone cannot be made current. GL commands issued while this is false land in whichever sibling context is still bound.

Returns
True if GL commands may be issued.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1381 of file graphics_abstraction_layer.h.

◆ IsCursorEnabled()

bool KIGFX::GAL::IsCursorEnabled ( ) const
inlineinherited

Return information about cursor visibility.

Returns
True if cursor is visible.

Definition at line 1340 of file graphics_abstraction_layer.h.

References m_forceDisplayCursor, and m_isCursorEnabled.

Referenced by KIGFX::CAIRO_GAL_BASE::blitCursor(), KIGFX::OPENGL_GAL::blitCursor(), and KIGFX::GAL_MODERN::PopulateCursorUBO().

◆ IsDrawingMode()

bool KIGFX::GAL_MODERN::IsDrawingMode ( ) const
inlineoverridevirtual

Return true if the GAL is inside a BeginDrawing/EndDrawing pair.

Reimplemented from KIGFX::GAL.

Definition at line 56 of file gal_modern.h.

References m_isDrawing.

◆ IsFlippedX()

◆ IsFlippedY()

bool KIGFX::GAL::IsFlippedY ( ) const
inlineinherited

Definition at line 1007 of file graphics_abstraction_layer.h.

References m_globalFlipY.

◆ IsFontBold()

bool KIGFX::GAL::IsFontBold ( ) const
inlineinherited

Definition at line 715 of file graphics_abstraction_layer.h.

References m_attributes.

◆ IsFontItalic()

bool KIGFX::GAL::IsFontItalic ( ) const
inlineinherited

Definition at line 718 of file graphics_abstraction_layer.h.

References m_attributes.

◆ IsFontUnderlined()

bool KIGFX::GAL::IsFontUnderlined ( ) const
inlineinherited

Definition at line 721 of file graphics_abstraction_layer.h.

References m_attributes.

◆ IsInitialized()

bool KIGFX::GAL_MODERN::IsInitialized ( ) const
inlineoverridevirtual

Return the initialization status for the canvas.

Reimplemented from KIGFX::GAL.

Definition at line 55 of file gal_modern.h.

References m_rhiInitialized.

Referenced by GAL_MODERN().

◆ IsOpenGlEngine()

virtual bool KIGFX::GAL::IsOpenGlEngine ( )
inlinevirtualinherited

Return true if the GAL engine is a OpenGL based type.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 167 of file graphics_abstraction_layer.h.

◆ IsResetSettled()

virtual bool KIGFX::GAL::IsResetSettled ( )
inlinevirtualinherited

Check whether the driver has finished the reset that destroyed this canvas' context.

Rebuilding before then can fail or hang in the driver.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1401 of file graphics_abstraction_layer.h.

◆ IsTextMirrored()

bool KIGFX::GAL::IsTextMirrored ( ) const
inlineinherited

◆ IsVisible()

virtual bool KIGFX::GAL::IsVisible ( ) const
inlinevirtualinherited

Return true if the GAL canvas is visible on the screen.

Reimplemented in KIGFX::CAIRO_GAL, and KIGFX::OPENGL_GAL.

Definition at line 161 of file graphics_abstraction_layer.h.

◆ keepsRelativeDepth()

bool KIGFX::GAL_MODERN::keepsRelativeDepth ( const GEOMETRY_BUFFER_SET & aPool) const
inlineprivate

The pool is a kept target whose ranges are drawn in depth slices, see Flush()

Definition at line 858 of file gal_modern.h.

References m_gridPool, m_persistentTargets, and m_staticPool.

Referenced by Flush(), and GetDynamicDrawDesc().

◆ layerRangesForCurrentTarget() [1/2]

◆ layerRangesForCurrentTarget() [2/2]

const std::vector< LAYER_RANGE > & KIGFX::GAL_MODERN::layerRangesForCurrentTarget ( ) const
inlineprivate

◆ LockContext()

virtual void KIGFX::GAL::LockContext ( int aClientCookie)
inlinevirtualinherited

Use GAL_CONTEXT_LOCKER RAII object unless you know what you're doing.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1408 of file graphics_abstraction_layer.h.

◆ makeInstance()

◆ MarkStaticDirty()

void KIGFX::GAL_MODERN::MarkStaticDirty ( )
inlineoverridevirtual

Force the next Flush() to rebuild the static pool from scratch.

Reimplemented from KIGFX::GAL.

Definition at line 346 of file gal_modern.h.

References m_staticDirty.

◆ normalize()

template<typename T>
void KIGFX::GAL::normalize ( T & a,
T & b )
inlineprotectedinherited

◆ notePolarity()

void GAL_MODERN::notePolarity ( bool aNegative)
private

◆ obuf() [1/2]

GEOMETRY_BUFFER_SET & KIGFX::GAL_MODERN::obuf ( )
inlineprivate

◆ obuf() [2/2]

const GEOMETRY_BUFFER_SET & KIGFX::GAL_MODERN::obuf ( ) const
inlineprivate

Definition at line 800 of file gal_modern.h.

References m_currentOverlaySet, and m_overlaySets.

◆ OnGalDisplayOptionsChanged()

void GAL::OnGalDisplayOptionsChanged ( const GAL_DISPLAY_OPTIONS & aOptions)
overrideprotectedvirtualinherited

Handler for observer settings changes.

Implements KIGFX::GAL_DISPLAY_OPTIONS_OBSERVER.

Definition at line 105 of file graphics_abstraction_layer.cpp.

References updatedGalDisplayOptions().

◆ patchStaticGroup()

template<typename INSTANCE_FN, typename VERTEX_FN>
bool GAL_MODERN::patchStaticGroup ( int aGroup,
INSTANCE_FN aInstance,
VERTEX_FN aVertex )
private

Patch a cached group in place in the static pool, applying aInstance to each instance and aVertex to each polygon vertex, and record the touched spans for a partial upload.

Returns
true if the group was resident and patched, so the full rebuild can be skipped.

Definition at line 3642 of file gal_modern.cpp.

References KIGFX::GAL_MODERN::STATIC_GROUP_SLOT::count, m_staticGroupSlots, m_staticPatches, m_staticPool, KIGFX::RHI_INSTANCED_SHAPES, KIGFX::RHI_SHAPE_POLYGON, KIGFX::RHI_SHAPES, and KIGFX::GAL_MODERN::STATIC_GROUP_SLOT::start.

Referenced by ChangeGroupColor(), and ChangeGroupDepth().

◆ placeGroupInScene()

◆ poolForCurrentTarget() [1/2]

GEOMETRY_BUFFER_SET & KIGFX::GAL_MODERN::poolForCurrentTarget ( )
inlineprivate

TARGET_CACHED draws to the static pool and every other target to its dynamic ring slot.

A target not cleared this frame is started afresh, since what it holds was already handed to the render thread.

Definition at line 803 of file gal_modern.h.

References buf(), currentTargetOpen(), m_currentTarget, m_drawingGridSources, m_gridPool, m_groupDepth, m_isDrawing, m_staticPool, obuf(), refillDynamicTarget(), KIGFX::TARGET_CACHED, and KIGFX::TARGET_OVERLAY.

Referenced by addArcInstance(), addPadInstance(), BeginGroup(), DrawBitmap(), drawBitmapGlyphs(), DrawGroup(), emitInstance(), emitTriangle(), EndGroup(), and notePolarity().

◆ poolForCurrentTarget() [2/2]

const GEOMETRY_BUFFER_SET & KIGFX::GAL_MODERN::poolForCurrentTarget ( ) const
inlineprivate

◆ PopulateCameraUBOs()

void GAL_MODERN::PopulateCameraUBOs ( KIGFX::FRAME_DRAW_DESC & aDesc) const

Update the camera-dependent UBOs of an existing descriptor.

The camera fast path uses this rather than read ring-buffered geometry state that reuse_scene frames may have overwritten.

Definition at line 4188 of file gal_modern.cpp.

References KIGFX::GRID_UBO_DATA::axisColorX, KIGFX::GRID_UBO_DATA::axisColorY, KIGFX::DOTS, KIGFX::FRAME_DRAW_DESC::frameUBO, KIGFX::GAL::GetVisibleGridSize(), KIGFX::GRID_UBO_DATA::gridAngle, KIGFX::GRID_UBO_DATA::gridColor, KIGFX::GAL::gridMinorLineWidth(), KIGFX::GRID_UBO_DATA::gridOrigin, gridShown(), KIGFX::GRID_UBO_DATA::gridSpacing, KIGFX::GRID_UBO_DATA::gridStyle, KIGFX::GRID_UBO_DATA::gridTick, KIGFX::FRAME_DRAW_DESC::gridUBO, MATRIX3x3< T >::Inverse(), KIGFX::GRID_UBO_DATA::invProjection, KIGFX::LINES, KIGFX::GAL::m_axesColor, KIGFX::GAL::m_axesEnabled, MATRIX3x3< T >::m_data, m_deviceProxy, m_dpiScale, KIGFX::GAL::m_gridColor, KIGFX::GAL::m_gridLineWidth, KIGFX::GAL::m_gridOrigin, KIGFX::GAL::m_gridStyle, KIGFX::GAL::m_gridTick, m_screenHeight, m_screenWidth, KIGFX::GAL::m_screenWorldMatrix, KIGFX::GAL::m_zoomFactor, KIGFX::GRID_UBO_DATA::majorLineWorld, KIGFX::GAL::MAX_DEPTH, KIGFX::GRID_UBO_DATA::minorLineWidth, KIGFX::FRAME_UBO_DATA::projection, KIGFX::FRAME_DRAW_DESC::RELATIVE_DEPTH_RANGE, KIGFX::FRAME_DRAW_DESC::relativeDepth, RhiAdjustProjectionForBackend(), RhiBackendNeedsYFlip(), S, screenPixelSize(), KIGFX::SMALL_CROSS, toFloat4(), KIGFX::FRAME_UBO_DATA::viewport, KIGFX::GRID_UBO_DATA::viewport, KIGFX::FRAME_UBO_DATA::viewScale, KIGFX::GRID_UBO_DATA::worldPixelSize, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by GetDynamicDrawDesc(), and GetStaticDrawDesc().

◆ PopulateCursorUBO()

◆ recomputeTransformIdentity()

void KIGFX::GAL_MODERN::recomputeTransformIdentity ( )
inlineprivate

Exact comparison is enough since a false negative only takes the slow path.

Definition at line 401 of file gal_modern.h.

References m_currentTransform, and m_transformIsIdentity.

Referenced by Restore(), and Transform().

◆ refillDynamicTarget()

◆ RefillsNonCachedTargets()

bool KIGFX::GAL_MODERN::RefillsNonCachedTargets ( ) const
inlineoverridevirtual

Return true if the backend empties every non-cached target each frame, so VIEW must emit them again even when clean.

Reimplemented from KIGFX::GAL.

Definition at line 59 of file gal_modern.h.

References m_persistentTargets.

◆ releaseBitmapQuads()

void GAL_MODERN::releaseBitmapQuads ( std::vector< BITMAP_QUAD > & aQuads,
bool aOwnedOnly )
private

Retire the textures and vertex buffers the quads own, then empty the list.

Definition at line 401 of file gal_modern.cpp.

References retireBuffer(), and retireTexture().

Referenced by BeginDrawing(), ClearCache(), ClearScreen(), DeleteGroup(), DestroyBuffers(), and refillDynamicTarget().

◆ ReleaseBuffers()

void KIGFX::GAL_MODERN::ReleaseBuffers ( )
inline

◆ ReleaseRetiredBuffers()

void GAL_MODERN::ReleaseRetiredBuffers ( uint64_t aConsumedGeneration)

Free retired buffers and textures once the render thread has consumed a frame built after them.

Counting frames is not enough because an idle canvas keeps drawing its newest descriptor.

Parameters
aConsumedGenerationis FRAME_MAILBOX::ConsumedBufferGeneration().

Definition at line 419 of file gal_modern.cpp.

References m_deviceProxy, m_retiredBuffers, and m_retiredTextures.

Referenced by DestroyBuffers().

◆ removeGroupFromScene()

◆ resetScene()

void GAL_MODERN::resetScene ( )
private

Empty every arena and forget residency ahead of a full rebuild.

GPU buffers are kept.

Definition at line 2850 of file gal_modern.cpp.

References group, m_groups, m_openSceneLayer, m_openSceneLayerId, m_sceneChanged, and m_sceneLayers.

Referenced by BeginDrawing(), ClearCache(), and ClearScreen().

◆ ResetTextAttributes()

void GAL::ResetTextAttributes ( )
inherited

Reset text attributes to default styling.

FONT TODO: do we need any of this in GAL anymore?

Normally, custom attributes will be set individually after this, otherwise you can use SetTextAttributes()

Definition at line 204 of file graphics_abstraction_layer.cpp.

References GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_CENTER, SetFontBold(), SetFontItalic(), SetFontUnderlined(), SetGlyphSize(), SetHorizontalJustify(), SetTextMirrored(), and SetVerticalJustify().

Referenced by GAL(), KIGFX::PREVIEW::ARC_ASSISTANT::ViewDraw(), KIGFX::PREVIEW::BEZIER_ASSISTANT::ViewDraw(), KIGFX::PREVIEW::ELLIPSE_ASSISTANT::ViewDraw(), KIGFX::PREVIEW::RULER_ITEM::ViewDraw(), and KIGFX::PREVIEW::TWO_POINT_ASSISTANT::ViewDraw().

◆ ResizeScreen()

void GAL_MODERN::ResizeScreen ( int aWidth,
int aHeight )
overridevirtual

Resize the canvas.

Reimplemented from KIGFX::GAL.

Definition at line 366 of file gal_modern.cpp.

References KIGFX::GAL::ComputeWorldScreenMatrix(), m_screenHeight, m_screenWidth, and KIGFX::GAL::SetScreenSize().

◆ Restore()

void GAL_MODERN::Restore ( )
overridevirtual

Restore the context.

Reimplemented from KIGFX::GAL.

Definition at line 3957 of file gal_modern.cpp.

References m_currentTransform, m_transformStack, and recomputeTransformIdentity().

Referenced by drawGridSource().

◆ retainedTieOrderChanged()

◆ retireBuffer()

void GAL_MODERN::retireBuffer ( RHI_BufferHandle aBuffer)
private

◆ retireTexture()

void GAL_MODERN::retireTexture ( RHI_TextureHandle aTexture)
private

◆ rewriteResidentGroup()

void GAL_MODERN::rewriteResidentGroup ( int aGroupNumber,
GAL_GROUP & aGroup )
private

◆ Rotate()

void GAL_MODERN::Rotate ( double aAngle)
overridevirtual

Rotate the context.

Parameters
aAngleis the rotation angle in radians.

Reimplemented from KIGFX::GAL.

Definition at line 3980 of file gal_modern.cpp.

References MATRIX3x3< T >::SetIdentity(), MATRIX3x3< T >::SetRotation(), and Transform().

Referenced by drawGridSource().

◆ Save()

void GAL_MODERN::Save ( )
overridevirtual

Save the context.

Reimplemented from KIGFX::GAL.

Definition at line 3951 of file gal_modern.cpp.

References m_currentTransform, and m_transformStack.

Referenced by drawGridSource().

◆ Scale()

void GAL_MODERN::Scale ( const VECTOR2D & aScale)
overridevirtual

Scale the context.

Parameters
aScaleis the scale factor for the x- and y-axis.

Reimplemented from KIGFX::GAL.

Definition at line 3998 of file gal_modern.cpp.

References MATRIX3x3< T >::SetIdentity(), MATRIX3x3< T >::SetScale(), and Transform().

◆ sceneLayerComposited()

static bool KIGFX::GAL_MODERN::sceneLayerComposited ( const SCENE_LAYER & aLayer)
inlinestaticprivate

Whether a scene layer goes through the temp target and is composited with its alpha.

Only a layer whose order matters does, and the rest are drawn in their own depth slice in one pass.

Definition at line 741 of file gal_modern.h.

References KIGFX::GAL_MODERN::SCENE_LAYER::runs.

Referenced by appendSceneRanges(), flushScene(), and writeGroupToScene().

◆ screenPixelSize()

double GAL_MODERN::screenPixelSize ( ) const
private

The world size of a screen pixel, which grid lines are measured in.

Definition at line 1075 of file gal_modern.cpp.

References std::abs(), KIGFX::GAL::m_screenWorldMatrix, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by drawGridSource(), and PopulateCameraUBOs().

◆ SetAxesColor()

void KIGFX::GAL::SetAxesColor ( const COLOR4D & aAxesColor)
inlineinherited

◆ SetAxesEnabled()

◆ SetBitmapGlyphs()

void KIGFX::GAL_MODERN::SetBitmapGlyphs ( bool aEnable)
inline

Draw bitmap text as one font atlas glyph per quad, for editors whose track shader supports it.

Definition at line 99 of file gal_modern.h.

References m_bitmapGlyphs.

◆ SetCentringPad()

void KIGFX::GAL_MODERN::SetCentringPad ( int aPad)
inline

The other canvases lay the view out this many pixels larger than the client area.

Matching them keeps the picture in place across a backend switch.

Definition at line 155 of file gal_modern.h.

References m_centringPad.

Referenced by EDA_DRAW_PANEL_GAL::SwitchBackend().

◆ SetClearColor()

void KIGFX::GAL::SetClearColor ( const COLOR4D & aColor)
inlineinherited

Definition at line 514 of file graphics_abstraction_layer.h.

References m_clearColor.

Referenced by BOARD_PRINTOUT::DrawPage(), and SCH_PRINTOUT::PrintPage().

◆ SetCoarseGrid()

void KIGFX::GAL::SetCoarseGrid ( int aInterval)
inlineinherited

Draw every tick line wider.

Parameters
aIntervalincrease the width of every aInterval line, if 0 do not use this feature.

Definition at line 1253 of file graphics_abstraction_layer.h.

References m_gridTick.

Referenced by GAL().

◆ SetCursorColor()

void KIGFX::GAL::SetCursorColor ( const COLOR4D & aCursorColor)
inlineinherited

Set the cursor color.

Parameters
aCursorColoris the color of the cursor.

Definition at line 1350 of file graphics_abstraction_layer.h.

References m_cursorColor.

Referenced by GAL().

◆ SetCursorEnabled()

void KIGFX::GAL::SetCursorEnabled ( bool aCursorEnabled)
inlineinherited

Enable/disable cursor.

Parameters
aCursorEnabledis true if the cursor should be drawn, else false.

Definition at line 1330 of file graphics_abstraction_layer.h.

References m_isCursorEnabled.

Referenced by GAL().

◆ SetDepthRange()

void KIGFX::GAL::SetDepthRange ( const VECTOR2D & aDepthRange)
inlineinherited

Set the range of the layer depth.

Usually required for the OpenGL implementation, any object outside this range is not drawn.

The MinDepth (x) is closest to the clipping plane (top) while the MaxDepth (y) is farthest from the clipping plane (bottom).

Definition at line 936 of file graphics_abstraction_layer.h.

References m_depthRange.

Referenced by GAL().

◆ SetDpiScale()

void KIGFX::GAL_MODERN::SetDpiScale ( float aScale)
inline

Backing-store scale factor, 2.0 on Retina.

The GAL stays in logical coordinates for VIEW and hit testing, so the viewport UBO needs this to size antialiasing edges in real pixels.

Definition at line 149 of file gal_modern.h.

References m_dpiScale.

Referenced by EDA_DRAW_PANEL_GAL::SwitchBackend().

◆ SetFillColor()

◆ SetFlip()

void KIGFX::GAL::SetFlip ( bool xAxis,
bool yAxis )
inlineinherited

Sets flipping of the screen.

Parameters
xAxisis the flip flag for the X axis.
yAxisis the flip flag for the Y axis.

Definition at line 1000 of file graphics_abstraction_layer.h.

References m_globalFlipX, and m_globalFlipY.

Referenced by GAL(), and BOARD_PRINTOUT::setupGal().

◆ SetFontBold()

void KIGFX::GAL::SetFontBold ( const bool aBold)
inlineinherited

Definition at line 714 of file graphics_abstraction_layer.h.

References m_attributes.

Referenced by ResetTextAttributes().

◆ SetFontItalic()

void KIGFX::GAL::SetFontItalic ( bool aItalic)
inlineinherited

Definition at line 717 of file graphics_abstraction_layer.h.

References m_attributes.

Referenced by ResetTextAttributes().

◆ SetFontUnderlined()

void KIGFX::GAL::SetFontUnderlined ( bool aUnderlined)
inlineinherited

Definition at line 720 of file graphics_abstraction_layer.h.

References m_attributes.

Referenced by ResetTextAttributes().

◆ SetGlyphSize()

void KIGFX::GAL::SetGlyphSize ( const VECTOR2I aSize)
inlineinherited

◆ SetGridColor()

void KIGFX::GAL::SetGridColor ( const COLOR4D & aGridColor)
inlineinherited

Set the grid color.

Parameters
aGridColoris the grid color, it should have a low alpha value for the best effect.

Definition at line 1225 of file graphics_abstraction_layer.h.

References m_gridColor.

Referenced by GERBVIEW_FRAME::ActivateGalCanvas(), KIGFX::CAIRO_GAL_BASE::CAIRO_GAL_BASE(), KIGFX::OPENGL_GAL::OPENGL_GAL(), GERBVIEW_FRAME::SetGridColor(), and PCB_EDIT_FRAME::SetGridColor().

◆ SetGridOrigin()

void KIGFX::GAL::SetGridOrigin ( const VECTOR2D & aGridOrigin)
inlineinherited

Set the origin point for the grid.

Parameters
aGridOriginis a vector containing the grid origin point, in world coordinates.

Definition at line 1146 of file graphics_abstraction_layer.h.

References m_gridOffset, m_gridOrigin, and m_gridSize.

Referenced by FOOTPRINT_EDIT_FRAME::borrowBoardNonDestructive(), PCB_CONTROL::DoSetGridOrigin(), and PCB_BASE_EDIT_FRAME::SetBoard().

◆ SetGridSize()

void KIGFX::GAL::SetGridSize ( const VECTOR2D & aGridSize)
inlineinherited

Set the grid size.

Parameters
aGridSizeis a vector containing the grid size in x and y direction.

Definition at line 1171 of file graphics_abstraction_layer.h.

References m_gridOffset, m_gridOrigin, and m_gridSize.

Referenced by FOOTPRINT_PREVIEW_PANEL::New(), COMMON_TOOLS::OnGridChanged(), DIALOG_BARCODE_PROPERTIES::prepareCanvas(), and DIALOG_PAD_PROPERTIES::prepareCanvas().

◆ SetGridSources()

void GAL::SetGridSources ( std::vector< GRID_SOURCE > aSources)
inherited

Set the grid-source list rendered alongside the display grid.

The list is sorted by GRID_GEOMETRY::TakesPrecedenceOver, so every consumer can take the first source that applies rather than re-deriving the overlap rules. The sort is stable, leaving exact ties in the caller's original order.

Definition at line 274 of file graphics_abstraction_layer.cpp.

References m_gridSources.

◆ SetGridVisibility()

void KIGFX::GAL::SetGridVisibility ( bool aVisibility)
inlineinherited

◆ SetGroupPlacement()

void GAL_MODERN::SetGroupPlacement ( int aGroup,
int aLayer,
double aLodScale,
bool aShown,
const RETAINED_GROUP_ORDER & aOrder )
overridevirtual

Declare where a cached group belongs in the retained scene.

Parameters
aGroupis the group number returned by BeginGroup().
aLayeris the VIEW layer id the group was cached for.
aLodScaleis the view scale above which the group is drawn.
aShownis false to keep the group out of the scene regardless of scale.

Reimplemented from KIGFX::GAL.

Definition at line 3100 of file gal_modern.cpp.

References KIGFX::RETAINED_GROUP_ORDER::contentHash, KIGFX::RETAINED_GROUP_ORDER::contentTie, group, GroupContentFingerprint(), m_groups, m_openSceneLayer, m_openSceneLayerId, m_sceneLayers, m_sceneScale, m_staticDirty, placeGroupInScene(), removeGroupFromScene(), retainedTieOrderChanged(), and trackGroupLod().

◆ SetHorizontalJustify()

void KIGFX::GAL::SetHorizontalJustify ( const GR_TEXT_H_ALIGN_T aHorizontalJustify)
inlineinherited

Definition at line 726 of file graphics_abstraction_layer.h.

References m_attributes.

Referenced by KIGFX::bitmapText(), and ResetTextAttributes().

◆ SetHoverColor()

virtual void KIGFX::GAL::SetHoverColor ( const COLOR4D & aColor)
inlinevirtualinherited

Definition at line 603 of file graphics_abstraction_layer.h.

References m_hoverColor.

◆ SetIsFill()

◆ SetIsStroke()

◆ SetLayerDepth()

void GAL_MODERN::SetLayerDepth ( double aLayerDepth)
overridevirtual

Set the depth of the layer (position on the z-axis)

If you do this, you should consider using a GAL_SCOPED_ATTR to ensure the depth is reset to the original value.

Parameters
aLayerDepththe layer depth for the objects. Smaller is closer to the viewer.

Reimplemented from KIGFX::GAL.

Definition at line 920 of file gal_modern.cpp.

References beginLayerRange(), layerRangesForCurrentTarget(), and KIGFX::GAL::SetLayerDepth().

◆ SetLineWidth()

virtual void KIGFX::GAL::SetLineWidth ( float aLineWidth)
inlinevirtualinherited

◆ SetLookAtPoint()

void KIGFX::GAL::SetLookAtPoint ( const VECTOR2D & aPoint)
inlineinherited

Get/set the Point in world space to look at.

This point corresponds with the center of the actual drawing area.

Definition at line 916 of file graphics_abstraction_layer.h.

References m_lookAtPoint.

Referenced by BOARD_PRINTOUT::DrawPage(), GAL(), and SCH_PRINTOUT::PrintPage().

◆ SetMinLineWidth()

virtual void KIGFX::GAL::SetMinLineWidth ( float aLineWidth)
inlinevirtualinherited

Set the minimum line width in pixels.

Parameters
aLineWidthis the minimum line width.

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 633 of file graphics_abstraction_layer.h.

References m_minLineWidth.

Referenced by GAL(), and KIGFX::OPENGL_GAL::SetMinLineWidth().

◆ SetNativeCursorStyle()

bool GAL::SetNativeCursorStyle ( KICURSOR aCursor,
bool aHiDPI )
virtualinherited

Set the cursor in the native panel.

Parameters
aCursoris the cursor to use in the native panell
aHiDPIis used to determine if high DPI cursors should be used.
Returns
true if the cursor was updated, false if the cursor given was already set.

Reimplemented in KIGFX::CAIRO_GAL, and KIGFX::OPENGL_GAL.

Definition at line 470 of file graphics_abstraction_layer.cpp.

References m_currentNativeCursor.

Referenced by GAL(), KIGFX::CAIRO_GAL::SetNativeCursorStyle(), and KIGFX::OPENGL_GAL::SetNativeCursorStyle().

◆ SetNegativeDrawMode()

void GAL_MODERN::SetNegativeDrawMode ( bool aSetting)
overridevirtual

Set negative draw mode in the renderer.

When negative mode is enabled, drawn items will subtract from previously drawn items. This is mainly needed for Gerber negative item support in Cairo, since unlike in OpenGL, objects drawn with zero opacity on top of other objects would not normally mask objects in Cairo. This method is a no-op in OpenGL.

Parameters
aSettingis true if negative mode should be enabled

Reimplemented from KIGFX::GAL.

Definition at line 1052 of file gal_modern.cpp.

References layerRangesForCurrentTarget(), and m_negativeMode.

◆ SetPersistentTargets()

void KIGFX::GAL_MODERN::SetPersistentTargets ( bool aPersistent)
inline

Keep the non-cached and overlay pools across frames until ClearTarget() empties one, as the other backends do, so moving an overlay item re-emits only the overlay.

When off, BeginDrawing() empties both.

Definition at line 343 of file gal_modern.h.

References m_persistentTargets.

◆ SetRenderThread()

void KIGFX::GAL_MODERN::SetRenderThread ( RENDER_THREAD * aThread)
inline

Render thread used for fence-based synchronization.

Definition at line 143 of file gal_modern.h.

References m_renderThread.

Referenced by EDA_DRAW_PANEL_GAL::SwitchBackend().

◆ SetRotation()

void KIGFX::GAL::SetRotation ( double aRotation)
inlineinherited

Get/set the rotation angle (in radians).

Definition at line 925 of file graphics_abstraction_layer.h.

References m_rotation.

Referenced by GAL().

◆ SetSceneDrawOrdered()

void GAL_MODERN::SetSceneDrawOrdered ( bool aOrdered)
overridevirtual

Tell the retained scene whether cached groups are placed in an order that matters.

When they are, a knockout erases only what was placed before it on its layer, as on a Gerber layer. Otherwise a layer's knockouts apply to all of it.

Reimplemented from KIGFX::GAL.

Definition at line 3386 of file gal_modern.cpp.

References m_sceneChanged, m_sceneDrawOrdered, and m_sceneLayers.

◆ SetSceneLayerDim()

void GAL_MODERN::SetSceneLayerDim ( int aLayer,
const COLOR4D & aToward,
double aKeep )
overridevirtual

Fade a cached layer towards a colour in the shader, so dimming it recolours none of its groups.

Groups marked with ChangeGroupUndimmed() keep their colour.

Parameters
aLayeris the VIEW layer id.
aTowardis the colour the layer fades towards, usually the background.
aKeepis the share of each colour that is kept, 1 to leave the layer as it is.

Reimplemented from KIGFX::GAL.

Definition at line 2935 of file gal_modern.cpp.

References KIGFX::COLOR4D::b, KIGFX::GAL_MODERN::SCENE_LAYER::dim, KIGFX::COLOR4D::g, KIGFX::RHI_LAYER_DIM::keep, m_sceneChanged, m_sceneLayers, KIGFX::COLOR4D::r, and KIGFX::RHI_LAYER_DIM::toward.

◆ SetSceneLayerOverlayAlpha()

void GAL_MODERN::SetSceneLayerOverlayAlpha ( int aLayer)
overridevirtual

Blend a cached layer the way the other canvases blend the overlay they draw it in.

Colour c with alpha a over d then shows c*a + d*(1 - a*a) rather than c*a + d*(1 - a).

Parameters
aLayeris the VIEW layer id.

Reimplemented from KIGFX::GAL.

Definition at line 2963 of file gal_modern.cpp.

References m_groups, m_sceneChanged, m_sceneLayers, KIGFX::GAL_MODERN::SCENE_LAYER::overlayAlpha, KIGFX::GAL_MODERN::SCENE_LAYER::residents, and writeGroupToScene().

◆ SetSceneLayerState()

void GAL_MODERN::SetSceneLayerState ( int aLayer,
int aOrder,
bool aVisible,
bool aHasNegatives )
overridevirtual

Describe a cached layer to the retained scene.

Layers draw in decreasing order value and a hidden layer keeps its groups, so showing, hiding or reordering layers emits nothing again.

Parameters
aLayeris the VIEW layer id.
aOrderis the layer's rendering order.
aVisibleis false to leave the layer out of the frame.
aHasNegativesis true if the layer has to contain its own knockouts.

Reimplemented from KIGFX::GAL.

Definition at line 2889 of file gal_modern.cpp.

References KIGFX::GAL_MODERN::SCENE_LAYER::depth, KIGFX::GAL_MODERN::SCENE_LAYER::hasNegatives, KIGFX::GAL_MODERN::SCENE_LAYER::inOrder, KIGFX::GAL_MODERN::SCENE_LAYER::instances, m_groups, m_sceneChanged, m_sceneLayers, m_sceneOrder, m_sceneOrderStale, m_staticDirty, KIGFX::GAL_MODERN::SCENE_LAYER::polygons, KIGFX::GAL_MODERN::SCENE_LAYER::residents, KIGFX::GAL_MODERN::SCENE_LAYER::runsStale, KIGFX::GAL_MODERN::SCENE_ARENA< T >::uploadAll, KIGFX::GAL_MODERN::SCENE_LAYER::visible, and writeGroupToScene().

Referenced by BeginSceneLayer().

◆ SetSceneScale()

void GAL_MODERN::SetSceneScale ( double aScale)
overridevirtual

Set the view scale that group placements are tested against.

Reimplemented from KIGFX::GAL.

Definition at line 3020 of file gal_modern.cpp.

References group, m_groups, m_lodGroups, m_sceneLayers, m_sceneScale, m_staticDirty, placeGroupInScene(), and removeGroupFromScene().

◆ SetScreenDPI()

void KIGFX::GAL::SetScreenDPI ( double aScreenDPI)
inlineinherited

Set the dots per inch of the screen.

This value depends on the user screen, it should be configurable by the application. For instance a typical notebook with HD+ resolution (1600x900) has 106 DPI.

Definition at line 908 of file graphics_abstraction_layer.h.

References m_screenDPI.

Referenced by KIGFX::CAIRO_PRINT_GAL::CAIRO_PRINT_GAL(), and GAL().

◆ SetScreenSize()

void KIGFX::GAL::SetScreenSize ( const VECTOR2I & aSize)
inlineinherited

◆ SetScreenSpaceMode()

void KIGFX::GAL_MODERN::SetScreenSpaceMode ( bool aEnabled)
inlineoverridevirtual

Store sizes of what is drawn next in pixels rather than world units, so it keeps its pixel size through a zoom without being drawn again.

Reimplemented from KIGFX::GAL.

Definition at line 79 of file gal_modern.h.

References m_screenSpaceMode.

◆ SetStrokeColor()

◆ SetStrokeLengthPad()

void KIGFX::GAL_MODERN::SetStrokeLengthPad ( double aPixels)
inlineoverridevirtual

Extend every stroke drawn from now on by aPixels at each end.

Pixels are resolved per frame so the look survives a zoom without drawing again. Zero turns it off.

Reimplemented from KIGFX::GAL.

Definition at line 85 of file gal_modern.h.

References m_strokeLengthPad.

◆ SetStrokeLevelOfDetail()

void KIGFX::GAL_MODERN::SetStrokeLevelOfDetail ( double aLod)
inlineoverridevirtual

Show every stroke drawn from now on only while the view scale is above aLod, as VIEW::IsShownAtScale() decides.

It is decided per frame so a zoom needs no redraw. Zero turns it off.

Reimplemented from KIGFX::GAL.

Definition at line 94 of file gal_modern.h.

References m_strokeLod.

◆ SetStrokePixelPad()

void KIGFX::GAL_MODERN::SetStrokePixelPad ( double aPixels)
inlineoverridevirtual

Widen every stroke, circle and pad drawn from now on by aPixels.

Pixels are resolved per frame so the look survives a zoom without drawing again. Zero turns it off.

Reimplemented from KIGFX::GAL.

Definition at line 87 of file gal_modern.h.

References L, and m_strokePixelPad.

◆ SetTarget()

void GAL_MODERN::SetTarget ( RENDER_TARGET aTarget)
overridevirtual

Set the target for rendering.

Parameters
aTargetis the new target for rendering.

Reimplemented from KIGFX::GAL.

Definition at line 895 of file gal_modern.cpp.

References beginLayerRange(), m_currentTarget, m_dynamicLayerRanges, m_overlayLayerRanges, m_staticLayerRanges, and KIGFX::TARGET_OVERLAY.

◆ SetTextMirrored()

void KIGFX::GAL::SetTextMirrored ( const bool aMirrored)
inlineinherited

◆ SetVerticalJustify()

void KIGFX::GAL::SetVerticalJustify ( const GR_TEXT_V_ALIGN_T aVerticalJustify)
inlineinherited

Definition at line 733 of file graphics_abstraction_layer.h.

References m_attributes.

Referenced by KIGFX::bitmapText(), and ResetTextAttributes().

◆ SetWorldScreenMatrix()

void KIGFX::GAL::SetWorldScreenMatrix ( const MATRIX3x3D & aMatrix)
inlineinherited

Set the world <-> screen transformation matrix.

Parameters
aMatrixis the 3x3 world <-> screen transformation matrix.

Definition at line 879 of file graphics_abstraction_layer.h.

References m_worldScreenMatrix.

◆ SetWorldUnitLength()

void KIGFX::GAL::SetWorldUnitLength ( double aWorldUnitLength)
inlineinherited

Set the unit length.

This defines the length [inch] per one integer. For instance a value 0.001 means that the coordinate [1000, 1000] corresponds with a point at (1 inch, 1 inch) or 1 mil resolution per integer.

Definition at line 896 of file graphics_abstraction_layer.h.

References m_worldUnitLength.

Referenced by GAL(), GERBVIEW_DRAW_PANEL_GAL::GERBVIEW_DRAW_PANEL_GAL(), PL_DRAW_PANEL_GAL::PL_DRAW_PANEL_GAL(), SCH_PRINTOUT::PrintPage(), GERBVIEW_PRINTOUT::setupGal(), PCBNEW_PRINTOUT::setupGal(), GERBVIEW_DRAW_PANEL_GAL::SwitchBackend(), and PL_DRAW_PANEL_GAL::SwitchBackend().

◆ SetZoomFactor()

void KIGFX::GAL::SetZoomFactor ( double aZoomFactor)
inlineinherited

Definition at line 919 of file graphics_abstraction_layer.h.

References m_zoomFactor.

Referenced by BOARD_PRINTOUT::DrawPage(), GAL(), and SCH_PRINTOUT::PrintPage().

◆ Show()

virtual bool KIGFX::GAL::Show ( bool aShow)
inlinevirtualinherited

Show/hide the GAL canvas.

Reimplemented in KIGFX::CAIRO_GAL, and KIGFX::OPENGL_GAL.

Definition at line 491 of file graphics_abstraction_layer.h.

◆ sortSceneOrder()

void GAL_MODERN::sortSceneOrder ( )
private

Put the declared layers back in decreasing depth order after one was added or moved.

Definition at line 2979 of file gal_modern.cpp.

References m_sceneOrder, and m_sceneOrderStale.

Referenced by flushScene().

◆ StartDiffLayer()

void GAL_MODERN::StartDiffLayer ( )
overridevirtual

Begins rendering of a differential layer.

Used by gerbview's differential mode.

Differential layers have their drawn objects blended onto the lower layers differently so we need to end drawing of current objects and start a new set to be completed with a different blend mode.

Reimplemented from KIGFX::GAL.

Definition at line 974 of file gal_modern.cpp.

References beginLayerRange(), KIGFX::GAL_MODERN::GEOMETRY_BUFFER_SET::bitmapQuads, currentTargetOpen(), layerRangesForCurrentTarget(), m_diffLayerActive, m_isDrawing, KIGFX::GAL::m_layerDepth, and KIGFX::GAL_MODERN::GEOMETRY_BUFFER_SET::Sizes().

◆ StartNegativesLayer()

void GAL_MODERN::StartNegativesLayer ( )
overridevirtual

Begins rendering in a new layer that will be copied to the main layer in EndNegativesLayer().

For Cairo, layers with negative items need a new layer so when negative layers _CLEAR sections it doesn't delete drawings on layers below them. No-op in OpenGL

Reimplemented from KIGFX::GAL.

Definition at line 1013 of file gal_modern.cpp.

References layerRangesForCurrentTarget(), m_negativeMode, and m_negativesLayer.

◆ strokeLineChain()

void GAL_MODERN::strokeLineChain ( const SHAPE_LINE_CHAIN & aChain)
private

Stroke a chain as segments, adding a last-to-first segment when it is closed.

Definition at line 2137 of file gal_modern.cpp.

References SEG::A, SEG::B, SHAPE_LINE_CHAIN::CSegment(), DrawLine(), SHAPE_LINE_CHAIN::PointCount(), and SHAPE_LINE_CHAIN::SegmentCount().

Referenced by drawEllipseShape(), DrawPolygon(), DrawPolygon(), and DrawPolyline().

◆ submitSpan()

template<typename T>
void GAL_MODERN::submitSpan ( const std::vector< T > & aElements,
RHI_BufferHandle aBuffer,
const PATCH_SPAN & aSpan )
private

Queue an upload of a span of aElements to the same place in aBuffer.

Definition at line 3166 of file gal_modern.cpp.

References KIGFX::GAL_MODERN::PATCH_SPAN::begin, KIGFX::GAL_MODERN::PATCH_SPAN::end, m_renderThread, RhiUploadCopyStaging(), T, RHI_GEOMETRY_UPLOAD::targetBuffer, and RHI_GEOMETRY_UPLOAD::targetOffset.

Referenced by Flush(), and uploadSceneArena().

◆ SupportsStrokeLengthPad()

bool KIGFX::GAL_MODERN::SupportsStrokeLengthPad ( ) const
inlineoverridevirtual

Tell whether strokes can be longer by a number of pixels, see SetStrokeLengthPad().

Reimplemented from KIGFX::GAL.

Definition at line 83 of file gal_modern.h.

◆ SupportsStrokeLevelOfDetail()

bool KIGFX::GAL_MODERN::SupportsStrokeLevelOfDetail ( ) const
inlineoverridevirtual

Tell whether strokes can carry a level of detail, see SetStrokeLevelOfDetail().

Reimplemented from KIGFX::GAL.

Definition at line 92 of file gal_modern.h.

◆ SupportsStrokePixelPad()

bool KIGFX::GAL_MODERN::SupportsStrokePixelPad ( ) const
inlineoverridevirtual

Tell whether strokes can carry part of their width in pixels, see SetStrokePixelPad().

Reimplemented from KIGFX::GAL.

Definition at line 81 of file gal_modern.h.

◆ SupportsTypedPads()

bool KIGFX::GAL_MODERN::SupportsTypedPads ( ) const
inlineoverridevirtual

Return true if DrawPad() renders every standard pad shape.

Painters must not use it otherwise, since the base implementation draws every non-circular pad as a rectangle.

Reimplemented from KIGFX::GAL.

Definition at line 60 of file gal_modern.h.

◆ SyncScene()

bool GAL_MODERN::SyncScene ( )

Upload scene changes made outside a drawing context, such as groups crossing their level of detail on a zoom that redraws nothing.

Returns
true if the static scene changed and its descriptor must be fetched again.

Definition at line 3086 of file gal_modern.cpp.

References flushScene(), m_sceneChanged, and m_staticDirty.

◆ TakeStaticChanged()

bool KIGFX::GAL_MODERN::TakeStaticChanged ( )
inline

Whether the last Flush() rebuilt the static pool.

Reading clears it so each rebuild is seen once.

Definition at line 355 of file gal_modern.h.

References m_staticRebuiltThisFlush.

◆ TakeWorldScaleLimits()

void KIGFX::GAL::TakeWorldScaleLimits ( double & aBelow,
double & aAbove ) const
inlineinherited

Give and forget the nearest limits on either side of the scale passed to WorldScaleBelow().

Definition at line 974 of file graphics_abstraction_layer.h.

References m_scaleLimitAbove, and m_scaleLimitBelow.

◆ TakeWorldScaleRead()

bool KIGFX::GAL::TakeWorldScaleRead ( ) const
inlineinherited

Tell whether GetWorldScale() or a transformation matrix was read since the last call.

A backend that keeps geometry across frames needs this because whatever was sized from the scale goes stale on zoom.

Definition at line 986 of file graphics_abstraction_layer.h.

References m_worldScaleRead.

◆ ToScreen()

VECTOR2D KIGFX::GAL::ToScreen ( const VECTOR2D & aPoint) const
inlineinherited

Compute the point position in screen coordinates from given world coordinates.

Parameters
aPointthe point position in world coordinates.
Returns
the point position in screen coordinates.

Definition at line 1311 of file graphics_abstraction_layer.h.

References m_worldScreenMatrix.

Referenced by KIGFX::CAIRO_GAL_BASE::blitCursor(), and KIGFX::PREVIEW::RULER_ITEM::ViewDraw().

◆ ToWorld()

VECTOR2D KIGFX::GAL::ToWorld ( const VECTOR2D & aPoint) const
inlineinherited

Compute the point position in world coordinates from given screen coordinates.

Parameters
aPointthe point position in screen coordinates.
Returns
the point position in world coordinates.

Definition at line 1300 of file graphics_abstraction_layer.h.

References m_screenWorldMatrix.

◆ trackGroupLod()

void GAL_MODERN::trackGroupLod ( int aGroupId,
GAL_GROUP & aGroup,
bool aTrack )
private

Keep m_lodGroups to the shown groups whose threshold a zoom can actually cross.

Definition at line 3006 of file gal_modern.cpp.

References KIGFX::GAL_MODERN::GAL_GROUP::lodEntry, KIGFX::GAL_MODERN::GAL_GROUP::lodScale, and m_lodGroups.

Referenced by DeleteGroup(), and SetGroupPlacement().

◆ Transform()

void GAL_MODERN::Transform ( const MATRIX3x3D & aTransformation)
overridevirtual

Transform the context.

Parameters
aTransformationis the transformation matrix.

Reimplemented from KIGFX::GAL.

Definition at line 3973 of file gal_modern.cpp.

References m_currentTransform, and recomputeTransformIdentity().

Referenced by Rotate(), Scale(), and Translate().

◆ Translate()

void GAL_MODERN::Translate ( const VECTOR2D & aTranslation)
overridevirtual

Translate the context.

Parameters
aTranslationis the translation vector.

Reimplemented from KIGFX::GAL.

Definition at line 3989 of file gal_modern.cpp.

References MATRIX3x3< T >::SetIdentity(), MATRIX3x3< T >::SetTranslation(), and Transform().

Referenced by drawGridSource().

◆ UnlockContext()

virtual void KIGFX::GAL::UnlockContext ( int aClientCookie)
inlinevirtualinherited

Reimplemented in KIGFX::OPENGL_GAL.

Definition at line 1410 of file graphics_abstraction_layer.h.

◆ updatedGalDisplayOptions()

bool GAL::updatedGalDisplayOptions ( const GAL_DISPLAY_OPTIONS & aOptions)
protectedvirtualinherited

Handle updating display options.

Derived classes should call up to this to set base-class methods.

Returns
true if the new settings changed something. Derived classes can use this information to refresh themselves

Reimplemented in KIGFX::CAIRO_GAL, and KIGFX::OPENGL_GAL.

Definition at line 138 of file graphics_abstraction_layer.cpp.

References m_axesEnabled, m_crossHairMode, m_forceDisplayCursor, m_gridLineWidth, m_gridMinSpacing, m_gridStyle, m_gridTick, m_options, and refresh.

Referenced by OnGalDisplayOptionsChanged(), KIGFX::CAIRO_GAL::updatedGalDisplayOptions(), and KIGFX::OPENGL_GAL::updatedGalDisplayOptions().

◆ updateSceneCullRuns()

std::shared_ptr< const RHI_RUN_TABLE > GAL_MODERN::updateSceneCullRuns ( SCENE_LAYER & aLayer)
staticprivate

◆ uploadSceneArena()

template<typename T>
bool GAL_MODERN::uploadSceneArena ( SCENE_ARENA< T > & aArena)
private

◆ UsesPolygonTriangulationCache()

bool KIGFX::GAL_MODERN::UsesPolygonTriangulationCache ( ) const
inlineoverridevirtual

Return true if filled polygons are drawn from the SHAPE_POLY_SET triangulation cache, which painters should then fill before calling DrawPolygon.

Reimplemented from KIGFX::GAL.

Definition at line 61 of file gal_modern.h.

◆ WorldScaleBelow()

bool KIGFX::GAL::WorldScaleBelow ( double aLimit) const
inlineinherited

Tell whether the world scale is below a limit.

This is not a read of the scale, so what depends only on the answer stays valid through a zoom that does not cross the limit, see TakeWorldScaleLimits().

Definition at line 961 of file graphics_abstraction_layer.h.

References m_scaleLimitAbove, m_scaleLimitBelow, and m_worldScale.

Referenced by KIGFX::SCH_PAINTER::draw().

◆ writeGroupToScene()

◆ xform()

VECTOR2D KIGFX::GAL_MODERN::xform ( const VECTOR2D & aPt) const
inlineprivate

◆ xformAngle()

double KIGFX::GAL_MODERN::xformAngle ( ) const
inlineprivate

Definition at line 420 of file gal_modern.h.

References m_currentTransform, and m_transformIsIdentity.

Referenced by addArcInstance(), addPadInstance(), and drawBitmapGlyphs().

◆ xformScale()

double KIGFX::GAL_MODERN::xformScale ( ) const
inlineprivate

Member Data Documentation

◆ ARENA_COUNT

int KIGFX::GAL_MODERN::ARENA_COUNT = ARENA_POLYGON + 1
staticconstexpr

Definition at line 286 of file gal_modern.h.

Referenced by retainedTieOrderChanged().

◆ ARENA_INSTANCE_COUNT

int KIGFX::GAL_MODERN::ARENA_INSTANCE_COUNT = 2 * RHI_INSTANCED_SHAPES
staticconstexpr

Arenas of one retained scene layer.

Each instanced shape has a normal and a negative arena so a layer draws every normal before any negative.

Definition at line 284 of file gal_modern.h.

Referenced by flushScene(), placeGroupInScene(), removeGroupFromScene(), and updateSceneCullRuns().

◆ ARENA_POLYGON

int KIGFX::GAL_MODERN::ARENA_POLYGON = ARENA_INSTANCE_COUNT
staticconstexpr

◆ BITMAP_CACHE_MAX_ENTRIES

size_t KIGFX::GAL_MODERN::BITMAP_CACHE_MAX_ENTRIES = 64
staticconstexprprivate

Definition at line 868 of file gal_modern.h.

Referenced by evictBitmapCacheEntries().

◆ BUFFER_RING_SIZE

int KIGFX::GAL_MODERN::BUFFER_RING_SIZE = 2
staticconstexprprivate

Definition at line 476 of file gal_modern.h.

Referenced by refillDynamicTarget().

◆ GRID_DEPTH

const int GAL::GRID_DEPTH = MAX_DEPTH - 1
staticprotectedinherited

Depth level on which the grid is drawn.

Definition at line 1511 of file graphics_abstraction_layer.h.

◆ m_attributes

◆ m_axesColor

COLOR4D KIGFX::GAL::m_axesColor
protectedinherited

◆ m_axesEnabled

bool KIGFX::GAL::m_axesEnabled
protectedinherited

◆ m_bitmapFrameStartSeq

uint64_t KIGFX::GAL_MODERN::m_bitmapFrameStartSeq = 0
private

use counter at frame start, entries used since are pinned

Definition at line 872 of file gal_modern.h.

Referenced by BeginDrawing(), and evictBitmapCacheEntries().

◆ m_bitmapGlyphs

bool KIGFX::GAL_MODERN::m_bitmapGlyphs = false
private

see SetBitmapGlyphs()

Definition at line 392 of file gal_modern.h.

Referenced by drawBitmapGlyphs(), and SetBitmapGlyphs().

◆ m_bitmapTextHeight

double KIGFX::GAL_MODERN::m_bitmapTextHeight = 0.0
private

glyph height while bitmap text is stroked, else 0

Definition at line 391 of file gal_modern.h.

Referenced by addCapsuleInstance(), and BitmapText().

◆ m_bitmapTextureCache

std::unordered_map<KIID, BITMAP_CACHE_ENTRY> KIGFX::GAL_MODERN::m_bitmapTextureCache
private

◆ m_bitmapUseCounter

uint64_t KIGFX::GAL_MODERN::m_bitmapUseCounter = 0
private

bumped on every cache touch

Definition at line 871 of file gal_modern.h.

Referenced by BeginDrawing(), and DrawBitmap().

◆ m_bufferGeneration

uint64_t KIGFX::GAL_MODERN::m_bufferGeneration = 1
private

Bumped whenever a resource is retired.

A descriptor built afterwards carries a generation at least as new and no longer references it.

Definition at line 594 of file gal_modern.h.

Referenced by GetDynamicDrawDesc(), GetStaticDrawDesc(), retireBuffer(), and retireTexture().

◆ m_bufferSets

GEOMETRY_BUFFER_SET KIGFX::GAL_MODERN::m_bufferSets[BUFFER_RING_SIZE]
private

The non-cached pool.

Each dynamic target has its own ring so one can be refilled while the other keeps the buffers its last frame uploaded.

Definition at line 541 of file gal_modern.h.

Referenced by buf(), buf(), DestroyBuffers(), and ReleaseBuffers().

◆ m_centringPad

int KIGFX::GAL_MODERN::m_centringPad = 0
private

see SetCentringPad()

Definition at line 384 of file gal_modern.h.

Referenced by GetLayoutPixelSize(), and SetCentringPad().

◆ m_clearColor

◆ m_crossHairMode

KIGFX::CROSS_HAIR_MODE KIGFX::GAL::m_crossHairMode
protectedinherited

◆ m_currentBufferSet

int KIGFX::GAL_MODERN::m_currentBufferSet = 0
private

Definition at line 542 of file gal_modern.h.

Referenced by buf(), buf(), and refillDynamicTarget().

◆ m_currentGroupId

int KIGFX::GAL_MODERN::m_currentGroupId = -1
private

Definition at line 882 of file gal_modern.h.

Referenced by BeginGroup(), EndGroup(), and notePolarity().

◆ m_currentNativeCursor

KICURSOR KIGFX::GAL::m_currentNativeCursor
protectedinherited

◆ m_currentOverlaySet

int KIGFX::GAL_MODERN::m_currentOverlaySet = 0
private

Definition at line 545 of file gal_modern.h.

Referenced by obuf(), obuf(), and refillDynamicTarget().

◆ m_currentTarget

◆ m_currentTransform

MATRIX3x3D KIGFX::GAL_MODERN::m_currentTransform
private

◆ m_cursorColor

COLOR4D KIGFX::GAL::m_cursorColor
protectedinherited

Cursor color.

Definition at line 1605 of file graphics_abstraction_layer.h.

Referenced by getCursorColor(), and SetCursorColor().

◆ m_cursorPosition

◆ m_depthRange

VECTOR2D KIGFX::GAL::m_depthRange
protectedinherited

◆ m_depthStack

std::stack<double> KIGFX::GAL::m_depthStack
protectedinherited

Stored depth values.

Definition at line 1553 of file graphics_abstraction_layer.h.

◆ m_deviceProxy

◆ m_diffLayerActive

bool KIGFX::GAL_MODERN::m_diffLayerActive = false
private

Definition at line 393 of file gal_modern.h.

Referenced by beginLayerRange(), EndDiffLayer(), and StartDiffLayer().

◆ m_dpiScale

float KIGFX::GAL_MODERN::m_dpiScale = 1.0f
private

◆ m_drawCursor

bool KIGFX::GAL_MODERN::m_drawCursor = false
private

Definition at line 395 of file gal_modern.h.

Referenced by BeginDrawing(), ClearScreen(), DrawCursor(), and GetDynamicDrawDesc().

◆ m_drawGrid

bool KIGFX::GAL_MODERN::m_drawGrid = false
private

◆ m_drawingGridSources

bool KIGFX::GAL_MODERN::m_drawingGridSources = false
private

◆ m_dynamicLayerRanges

std::vector<LAYER_RANGE> KIGFX::GAL_MODERN::m_dynamicLayerRanges
private

◆ m_fillColor

◆ m_forceDisplayCursor

bool KIGFX::GAL::m_forceDisplayCursor
protectedinherited

Always show cursor.

Definition at line 1604 of file graphics_abstraction_layer.h.

Referenced by GAL(), IsCursorEnabled(), and updatedGalDisplayOptions().

◆ m_globalFlipX

◆ m_globalFlipY

bool KIGFX::GAL::m_globalFlipY
protectedinherited

◆ m_gridColor

COLOR4D KIGFX::GAL::m_gridColor
protectedinherited

◆ m_gridLayerRanges

std::vector<LAYER_RANGE> KIGFX::GAL_MODERN::m_gridLayerRanges
private

◆ m_gridLineWidth

◆ m_gridMinSpacing

int KIGFX::GAL::m_gridMinSpacing
protectedinherited

Minimum screen size of the grid (pixels) below which the grid is not drawn.

Definition at line 1597 of file graphics_abstraction_layer.h.

Referenced by computeMinGridSpacing(), GAL(), and updatedGalDisplayOptions().

◆ m_gridOffset

VECTOR2D KIGFX::GAL::m_gridOffset
protectedinherited

The grid offset to compensate cursor position.

Definition at line 1591 of file graphics_abstraction_layer.h.

Referenced by GetGridPoint(), SetGridOrigin(), and SetGridSize().

◆ m_gridOrigin

VECTOR2D KIGFX::GAL::m_gridOrigin
protectedinherited

◆ m_gridPool

GEOMETRY_BUFFER_SET KIGFX::GAL_MODERN::m_gridPool
private

The grids of the grid items, which the static target draws over the grid and under all else.

Rebuilt by each DrawGrid, and uploaded and redrawn only when that changed them.

Definition at line 574 of file gal_modern.h.

Referenced by ClearScreen(), DestroyBuffers(), drawGridSources(), Flush(), GetStaticDrawDesc(), keepsRelativeDepth(), poolForCurrentTarget(), poolForCurrentTarget(), and ReleaseBuffers().

◆ m_gridPoolHash

std::array<uint64_t, 2> KIGFX::GAL_MODERN::m_gridPoolHash {}
private

hash of what the GPU buffers hold

Definition at line 578 of file gal_modern.h.

Referenced by Flush().

◆ m_gridPoolRefilled

bool KIGFX::GAL_MODERN::m_gridPoolRefilled = false
private

Definition at line 576 of file gal_modern.h.

Referenced by ClearScreen(), drawGridSources(), and Flush().

◆ m_gridSize

◆ m_gridSources

◆ m_gridStyle

◆ m_gridTick

int KIGFX::GAL::m_gridTick
protectedinherited

◆ m_gridVisibility

bool KIGFX::GAL::m_gridVisibility
protectedinherited

◆ m_groupCounter

int KIGFX::GAL_MODERN::m_groupCounter = 0
private

Definition at line 881 of file gal_modern.h.

Referenced by BeginGroup().

◆ m_groupDepth

int KIGFX::GAL_MODERN::m_groupDepth = 0
private

◆ m_groupNegative

bool KIGFX::GAL_MODERN::m_groupNegative = false
private

the group being recorded has drawn a knockout

Definition at line 866 of file gal_modern.h.

Referenced by BeginGroup(), EndGroup(), and notePolarity().

◆ m_groups

◆ m_groupScratchBitmapQuads

std::vector<BITMAP_QUAD> KIGFX::GAL_MODERN::m_groupScratchBitmapQuads
private

Definition at line 892 of file gal_modern.h.

Referenced by BeginGroup(), and EndGroup().

◆ m_groupScratchInstances

SHAPE_INSTANCES KIGFX::GAL_MODERN::m_groupScratchInstances
private

BeginGroup() swaps these with the current pool's vectors and EndGroup() swaps them back.

Swapping keeps valid the storage the render thread may still upload from, so groups can be rebuilt outside a drawing context.

Definition at line 890 of file gal_modern.h.

Referenced by BeginGroup(), and EndGroup().

◆ m_groupScratchPolygonVertices

std::vector<RHI_VERTEX> KIGFX::GAL_MODERN::m_groupScratchPolygonVertices
private

Definition at line 891 of file gal_modern.h.

Referenced by BeginGroup(), and EndGroup().

◆ m_hoverColor

COLOR4D KIGFX::GAL::m_hoverColor
protectedinherited

Color for hovered (active) links.

Definition at line 1581 of file graphics_abstraction_layer.h.

Referenced by DrawGlyphs(), and SetHoverColor().

◆ m_isCursorEnabled

bool KIGFX::GAL::m_isCursorEnabled
protectedinherited

Is the cursor enabled?

Definition at line 1603 of file graphics_abstraction_layer.h.

Referenced by getCursorColor(), IsCursorEnabled(), and SetCursorEnabled().

◆ m_isDrawing

bool KIGFX::GAL_MODERN::m_isDrawing = false
private

◆ m_isFillEnabled

◆ m_isStrokeEnabled

◆ m_isUpdating

bool KIGFX::GAL_MODERN::m_isUpdating = false
private

Definition at line 378 of file gal_modern.h.

Referenced by beginLayerRange(), beginUpdate(), and endUpdate().

◆ m_layerDepth

◆ m_lineWidth

◆ m_lodGroups

std::multimap<double, int> KIGFX::GAL_MODERN::m_lodGroups
private

groups with a scale threshold, by it

Definition at line 748 of file gal_modern.h.

Referenced by ClearCache(), SetSceneScale(), and trackGroupLod().

◆ m_lookAtPoint

VECTOR2D KIGFX::GAL::m_lookAtPoint
protectedinherited

◆ m_minLineWidth

float KIGFX::GAL::m_minLineWidth
protectedinherited

Minimum line width in pixels.

Definition at line 1573 of file graphics_abstraction_layer.h.

Referenced by GetMinLineWidth(), and SetMinLineWidth().

◆ m_negativeMode

bool KIGFX::GAL_MODERN::m_negativeMode = false
private

◆ m_negativesLayer

bool KIGFX::GAL_MODERN::m_negativesLayer = false
private

Definition at line 757 of file gal_modern.h.

Referenced by BeginSceneLayer(), EndNegativesLayer(), and StartNegativesLayer().

◆ m_nonCachedRefilled

bool KIGFX::GAL_MODERN::m_nonCachedRefilled = false
private

non-cached pool was emptied for the frame being drawn

Definition at line 548 of file gal_modern.h.

Referenced by BeginDrawing(), ClearTarget(), currentTargetOpen(), DrawGroup(), Flush(), and refillDynamicTarget().

◆ m_observerLink

UTIL::LINK KIGFX::GAL::m_observerLink
protectedinherited

Definition at line 1551 of file graphics_abstraction_layer.h.

Referenced by GAL().

◆ m_openSceneLayer

SCENE_LAYER* KIGFX::GAL_MODERN::m_openSceneLayer = nullptr
private

Definition at line 749 of file gal_modern.h.

Referenced by BeginSceneLayer(), flushScene(), resetScene(), and SetGroupPlacement().

◆ m_openSceneLayerId

int KIGFX::GAL_MODERN::m_openSceneLayerId = -1
private

Definition at line 750 of file gal_modern.h.

Referenced by BeginSceneLayer(), flushScene(), resetScene(), and SetGroupPlacement().

◆ m_options

◆ m_overlayLayerRanges

std::vector<LAYER_RANGE> KIGFX::GAL_MODERN::m_overlayLayerRanges
private

◆ m_overlayRefilled

bool KIGFX::GAL_MODERN::m_overlayRefilled = false
private

◆ m_overlaySets

GEOMETRY_BUFFER_SET KIGFX::GAL_MODERN::m_overlaySets[BUFFER_RING_SIZE]
private

Definition at line 544 of file gal_modern.h.

Referenced by DestroyBuffers(), obuf(), obuf(), and ReleaseBuffers().

◆ m_persistentTargets

◆ m_placeSeq

uint64_t KIGFX::GAL_MODERN::m_placeSeq = 0
private

Definition at line 743 of file gal_modern.h.

Referenced by placeGroupInScene().

◆ m_renderThread

RENDER_THREAD* KIGFX::GAL_MODERN::m_renderThread = nullptr
private

Definition at line 374 of file gal_modern.h.

Referenced by drawBitmapGlyphs(), Flush(), SetRenderThread(), submitSpan(), and uploadSceneArena().

◆ m_retiredBuffers

std::vector<std::pair<uint64_t, RHI_BufferHandle> > KIGFX::GAL_MODERN::m_retiredBuffers
private

Definition at line 596 of file gal_modern.h.

Referenced by ReleaseBuffers(), ReleaseRetiredBuffers(), and retireBuffer().

◆ m_retiredTextures

std::vector<std::pair<uint64_t, RHI_TextureHandle> > KIGFX::GAL_MODERN::m_retiredTextures
private

Definition at line 597 of file gal_modern.h.

Referenced by ReleaseBuffers(), ReleaseRetiredBuffers(), and retireTexture().

◆ m_rhiInitialized

bool KIGFX::GAL_MODERN::m_rhiInitialized = false
private

Definition at line 376 of file gal_modern.h.

Referenced by GAL_MODERN(), and IsInitialized().

◆ m_rotation

double KIGFX::GAL::m_rotation
protectedinherited

Rotation transformation (radians)

Definition at line 1561 of file graphics_abstraction_layer.h.

Referenced by ComputeWorldScreenMatrix(), GetRotation(), and SetRotation().

◆ m_scaleLimitAbove

double KIGFX::GAL::m_scaleLimitAbove = std::numeric_limits<double>::max()
mutableprotectedinherited

Definition at line 1567 of file graphics_abstraction_layer.h.

Referenced by TakeWorldScaleLimits(), and WorldScaleBelow().

◆ m_scaleLimitBelow

double KIGFX::GAL::m_scaleLimitBelow = 0.0
mutableprotectedinherited

◆ m_sceneChanged

◆ m_sceneDrawOrdered

bool KIGFX::GAL_MODERN::m_sceneDrawOrdered = false
private

Definition at line 744 of file gal_modern.h.

Referenced by buildSceneRuns(), and SetSceneDrawOrdered().

◆ m_sceneLayers

◆ m_sceneOrder

std::vector<int> KIGFX::GAL_MODERN::m_sceneOrder
private

layer ids in draw order

Definition at line 747 of file gal_modern.h.

Referenced by appendSceneRanges(), flushScene(), SetSceneLayerState(), and sortSceneOrder().

◆ m_sceneOrderStale

bool KIGFX::GAL_MODERN::m_sceneOrderStale = false
private

Definition at line 753 of file gal_modern.h.

Referenced by flushScene(), SetSceneLayerState(), and sortSceneOrder().

◆ m_sceneScale

double KIGFX::GAL_MODERN::m_sceneScale = 1.0
private

Definition at line 751 of file gal_modern.h.

Referenced by SetGroupPlacement(), and SetSceneScale().

◆ m_screenDPI

double KIGFX::GAL::m_screenDPI
protectedinherited

◆ m_screenHeight

int KIGFX::GAL_MODERN::m_screenHeight = 0
private

Definition at line 382 of file gal_modern.h.

Referenced by PopulateCameraUBOs(), PopulateCursorUBO(), and ResizeScreen().

◆ m_screenSize

◆ m_screenSpaceMode

bool KIGFX::GAL_MODERN::m_screenSpaceMode = false
private

Definition at line 387 of file gal_modern.h.

Referenced by addCapsuleInstance(), drawBitmapGlyphs(), and SetScreenSpaceMode().

◆ m_screenWidth

int KIGFX::GAL_MODERN::m_screenWidth = 0
private

Definition at line 381 of file gal_modern.h.

Referenced by PopulateCameraUBOs(), PopulateCursorUBO(), and ResizeScreen().

◆ m_screenWorldMatrix

◆ m_staticDirty

◆ m_staticGroupSlots

std::unordered_map<int, std::vector<STATIC_GROUP_SLOT> > KIGFX::GAL_MODERN::m_staticGroupSlots
private

A group may be drawn into the static pool more than once per build, so a patch touches every slot.

Definition at line 613 of file gal_modern.h.

Referenced by clearStaticSlots(), DrawGroup(), and patchStaticGroup().

◆ m_staticLayerRanges

std::vector<LAYER_RANGE> KIGFX::GAL_MODERN::m_staticLayerRanges
private

Kept per pool so static ranges survive BeginDrawing when m_staticDirty is false.

Definition at line 898 of file gal_modern.h.

Referenced by BeginDrawing(), ClearScreen(), Flush(), GetDrawDesc(), GetStaticDrawDesc(), layerRangesForCurrentTarget(), layerRangesForCurrentTarget(), and SetTarget().

◆ m_staticPatches

std::array<PATCH_SPAN, RHI_SHAPES> KIGFX::GAL_MODERN::m_staticPatches
private

Definition at line 638 of file gal_modern.h.

Referenced by clearStaticSlots(), Flush(), and patchStaticGroup().

◆ m_staticPool

GEOMETRY_BUFFER_SET KIGFX::GAL_MODERN::m_staticPool
private

Pool for TARGET_CACHED.

It survives across frames and is cleared only when m_staticDirty is set, so frames that change only dynamic content do not re-emit the whole board.

Definition at line 567 of file gal_modern.h.

Referenced by BeginDrawing(), ClearScreen(), DestroyBuffers(), DrawGroup(), Flush(), GetDrawDesc(), GetStaticDrawDesc(), keepsRelativeDepth(), patchStaticGroup(), poolForCurrentTarget(), poolForCurrentTarget(), and ReleaseBuffers().

◆ m_staticRebuiltThisFlush

bool KIGFX::GAL_MODERN::m_staticRebuiltThisFlush = false
private

see TakeStaticChanged()

Definition at line 588 of file gal_modern.h.

Referenced by Flush(), and TakeStaticChanged().

◆ m_strokeColor

◆ m_strokeLengthPad

float KIGFX::GAL_MODERN::m_strokeLengthPad = 0.0f
private

see SetStrokeLengthPad(), 0 when off

Definition at line 389 of file gal_modern.h.

Referenced by addCapsuleInstance(), and SetStrokeLengthPad().

◆ m_strokeLod

double KIGFX::GAL_MODERN::m_strokeLod = 0.0
private

see SetStrokeLevelOfDetail(), 0 when off

Definition at line 390 of file gal_modern.h.

Referenced by addCapsuleInstance(), drawBitmapGlyphs(), and SetStrokeLevelOfDetail().

◆ m_strokePixelPad

uint16_t KIGFX::GAL_MODERN::m_strokePixelPad = 0
private

see SetStrokePixelPad(), in sixteenths of a pixel

Definition at line 388 of file gal_modern.h.

Referenced by drawBitmapGlyphs(), makeInstance(), and SetStrokePixelPad().

◆ m_transformIsIdentity

bool KIGFX::GAL_MODERN::m_transformIsIdentity = true
private

The GPU applies world to screen, so most geometry skips the matrix math on the hot path.

Definition at line 398 of file gal_modern.h.

Referenced by BeginDrawing(), recomputeTransformIdentity(), xform(), xformAngle(), and xformScale().

◆ m_transformStack

std::vector<MATRIX3x3D> KIGFX::GAL_MODERN::m_transformStack
private

Definition at line 895 of file gal_modern.h.

Referenced by BeginDrawing(), Restore(), and Save().

◆ m_worldScale

◆ m_worldScaleRead

bool KIGFX::GAL::m_worldScaleRead = false
mutableprotectedinherited

◆ m_worldScreenMatrix

◆ m_worldUnitLength

double KIGFX::GAL::m_worldUnitLength
protectedinherited

◆ m_zoomFactor

double KIGFX::GAL::m_zoomFactor
protectedinherited

◆ MAX_DEPTH

const int GAL::MAX_DEPTH = 2*MAX_LAYERS_FOR_VIEW - 1
staticprotectedinherited

Definition at line 1508 of file graphics_abstraction_layer.h.

Referenced by GAL(), and KIGFX::GAL_MODERN::PopulateCameraUBOs().

◆ MIN_DEPTH

const int GAL::MIN_DEPTH = -2*MAX_LAYERS_FOR_VIEW
staticprotectedinherited

Possible depth range.

Definition at line 1507 of file graphics_abstraction_layer.h.

Referenced by GAL().

◆ SEG_PER_CIRCLE_COUNT

int KIGFX::GAL::SEG_PER_CIRCLE_COUNT = 64
staticconstexprprotectedinherited

The default number of segments approximating a full circle.

Definition at line 1466 of file graphics_abstraction_layer.h.

Referenced by calcAngleStep(), and KIGFX::OPENGL_GAL::DrawArcSegment().


The documentation for this class was generated from the following files: