1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-15 18:22:08 -04:00

colorpick/screenshot: make color-format aware

This commit is contained in:
bbedward
2025-12-05 17:26:38 -05:00
parent 22b2b69413
commit f9a6b4ce2c
8 changed files with 137 additions and 64 deletions

View File

@@ -25,6 +25,7 @@ type CaptureResult struct {
Buffer *ShmBuffer
Region Region
YInverted bool
Format uint32
}
type Screenshoter struct {
@@ -206,6 +207,7 @@ func (s *Screenshoter) captureAllScreens() (*CaptureResult, error) {
composite.Clear()
var format uint32
for _, output := range outputs {
result, err := s.captureWholeOutput(output)
if err != nil {
@@ -213,6 +215,9 @@ func (s *Screenshoter) captureAllScreens() (*CaptureResult, error) {
continue
}
if format == 0 {
format = result.Format
}
s.blitBuffer(composite, result.Buffer, int(output.x-minX), int(output.y-minY), result.YInverted)
result.Buffer.Close()
}
@@ -220,6 +225,7 @@ func (s *Screenshoter) captureAllScreens() (*CaptureResult, error) {
return &CaptureResult{
Buffer: composite,
Region: Region{X: minX, Y: minY, Width: totalW, Height: totalH},
Format: format,
}, nil
}
@@ -379,6 +385,7 @@ func (s *Screenshoter) processFrame(frame *wlr_screencopy.ZwlrScreencopyFrameV1,
Buffer: buf,
Region: region,
YInverted: yInverted,
Format: uint32(format),
}, nil
}