File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
src/backend/renderer/pixman Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -349,6 +349,23 @@ impl PixmanFrame<'_, '_> {
349
349
350
350
Ok ( ( ) )
351
351
}
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
+ /// - The image must still referr to the same memory region after `func` was executed.
360
+ pub unsafe fn with_framebuffer < R , F > ( & mut self , func : F ) -> Result < R , PixmanError >
361
+ where
362
+ F : for < ' a > FnOnce ( & ' a mut Image < ' static , ' static > ) -> R ,
363
+ {
364
+ match & mut self . target . 0 {
365
+ PixmanTargetInternal :: Dmabuf { ref mut image, .. } => image. accessor ( ) ?. with_image ( func) ,
366
+ PixmanTargetInternal :: Image ( ref mut image) => Ok ( func ( * image) ) ,
367
+ }
368
+ }
352
369
}
353
370
354
371
impl Frame for PixmanFrame < ' _ , ' _ > {
You can’t perform that action at this time.
0 commit comments