-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a58f2b
commit 971cec0
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright © Clinton Ingram and Contributors | ||
// SPDX-License-Identifier: MIT | ||
|
||
using PhotoSauce.MagicScaler.Converters; | ||
|
||
namespace PhotoSauce.MagicScaler.Transforms; | ||
|
||
internal sealed class InvertTransform(PixelSource source) : ChainedPixelSource(source) | ||
{ | ||
protected override unsafe void CopyPixelsInternal(in PixelArea prc, int cbStride, int cbBufferSize, byte* pbBuffer) | ||
{ | ||
Profiler.PauseTiming(); | ||
PrevSource.CopyPixels(prc, cbStride, cbBufferSize, pbBuffer); | ||
Profiler.ResumeTiming(); | ||
|
||
nint cb = prc.Width * PrevSource.Format.BytesPerPixel; | ||
for (int y = 0; y < prc.Height; y++) | ||
{ | ||
InvertConverter.InvertLine(pbBuffer, cb); | ||
pbBuffer += cbStride; | ||
} | ||
} | ||
|
||
public override string ToString() => nameof(InvertTransform); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters