File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
src/backend/renderer/pixman Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -349,6 +349,24 @@ impl PixmanFrame<'_, '_> {
349349
350350 Ok ( ( ) )
351351 }
352+
353+ /// Run custom drawing code on the framebuffer used by this frame.
354+ ///
355+ /// You are given mutable access to the underlying [`pixman::Image`].
356+ /// The state of the image is considered an implementation detail, some modifications may have undesired side effects.
357+ ///
358+ /// # Safety
359+ ///
360+ /// - The image must still referr to the same memory region after `func` was executed.
361+ pub unsafe fn with_framebuffer < R , F > ( & mut self , func : F ) -> Result < R , PixmanError >
362+ where
363+ F : for < ' a > FnOnce ( & ' a mut Image < ' static , ' static > ) -> R ,
364+ {
365+ match & mut self . target . 0 {
366+ PixmanTargetInternal :: Dmabuf { ref mut image, .. } => image. accessor ( ) ?. with_image ( func) ,
367+ PixmanTargetInternal :: Image ( ref mut image) => Ok ( func ( * image) ) ,
368+ }
369+ }
352370}
353371
354372impl Frame for PixmanFrame < ' _ , ' _ > {
You can’t perform that action at this time.
0 commit comments