You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to debug an issue outside the realm of PresentationCore, so I would like to know, for example, when a DependencyProperty is updated, where the call stack travels to arrive at the UI repainting.
My guess is at the Visual level, but I can't find it in source which leads me to think that Visual is a "managed" repainting i.e DrawingContext.RenderOpen is for clients whereas there is internal repainting with DirectX in some other assembly. Any ideas?
Ok, I have answered some of my questions. I'm going to update this thread with info to help you learn what I learn.
I'm going to work through the example of drawing a single line.
Given a DrawingVisual, you call DrawingVisual.RenderOpen() which returns a DrawingContext object. This is actually a trick move for the API because DrawingContext is abstract with no public inheritance. What you actually get is an instance of RenderDataDrawingContext which is the only internal implementation of DrawingContext.
You publicly call DrawingContext.DrawLine(Pen,Point,Point) which is implemented in RenderDataDrawingContext. So the internal method opens an unsafe code block and creates a MIL struct MILCMD_DRAW_LINE from the above arguments.
An internal field _renderData of type RenderData is stored in RenderDataDrawingContext._renderData and the above unsafe code ends by calling _renderData.WriteDataRecord(MILCMD.MilDrawLine, (byte*)&record, 40); which I'm guessing is the buffer into which the pixels are painted. But this is as far as I got for now.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I would like to debug an issue outside the realm of PresentationCore, so I would like to know, for example, when a DependencyProperty is updated, where the call stack travels to arrive at the UI repainting.
My guess is at the Visual level, but I can't find it in source which leads me to think that Visual is a "managed" repainting i.eDrawingContext.RenderOpen
is for clients whereas there is internal repainting with DirectX in some other assembly. Any ideas?Ok, I have answered some of my questions. I'm going to update this thread with info to help you learn what I learn.
TLDR: PresentationCore => MIL ("Media Integration Layer") assemblies => Graphics assemblies.
I'm going to work through the example of drawing a single line.
Given a
DrawingVisual
, you callDrawingVisual.RenderOpen()
which returns aDrawingContext
object. This is actually a trick move for the API becauseDrawingContext
is abstract with no public inheritance. What you actually get is an instance ofRenderDataDrawingContext
which is the only internal implementation of DrawingContext.src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/RenderDataDrawingContext.cs
src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/RenderDataDrawingContext.cs
You publicly call
DrawingContext.DrawLine(Pen,Point,Point)
which is implemented inRenderDataDrawingContext
. So the internal method opens an unsafe code block and creates a MIL structMILCMD_DRAW_LINE
from the above arguments.An internal field _renderData of type
RenderData
is stored inRenderDataDrawingContext._renderData
and the above unsafe code ends by calling_renderData.WriteDataRecord(MILCMD.MilDrawLine, (byte*)&record, 40);
which I'm guessing is the buffer into which the pixels are painted. But this is as far as I got for now.Beta Was this translation helpful? Give feedback.
All reactions