Skip to content

Commit

Permalink
Cleanup the code
Browse files Browse the repository at this point in the history
  • Loading branch information
dend committed Jul 20, 2021
1 parent 51c1217 commit d1a3b47
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ public void ExecuteOnActivation(CommandMapping mappedCommand, ConnectedDevice ma
{
try
{
var icon = ImageHelpers.GetFileIcon(mappedCommand.CommandArguments, 256, 256, SIIGBF.SIIGBF_ICONONLY);
var icon = ImageHelpers.GetFileIcon(mappedCommand.CommandArguments, DeviceConstants.XLButtonSize, DeviceConstants.XLButtonSize, SIIGBF.SIIGBF_ICONONLY | SIIGBF.SIIGBF_CROPTOSQUARE);
var byteContent = ImageHelpers.GetImageBuffer(icon);
var targetImage = ImageHelpers.ResizeImage(byteContent, DeviceConstants.XLButtonSize, DeviceConstants.XLButtonSize);
DeviceManager.SetKey(mappedDevice, mappedCommand.ButtonIndex, targetImage);
DeviceManager.SetKey(mappedDevice, mappedCommand.ButtonIndex, byteContent);
}
catch
{
Expand Down
8 changes: 4 additions & 4 deletions src/Deck.Surf/Deck.Surf.SDK/Util/ImageHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ private static Bitmap CreateAlphaBitmap(Bitmap sourceBitmap, PixelFormat targetP

private static IntPtr GetBitmapPointer(string fileName, int width, int height, SIIGBF options)
{
Guid shellItem2Guid = new(WindowsAPIHelpers.IID_IShellItem2);
int retCode = WindowsAPIHelpers.SHCreateItemFromParsingName(fileName, IntPtr.Zero, ref shellItem2Guid, out IShellItem nativeShellItem);
Guid itemIdentifier = new(WindowsAPIHelpers.IID_IShellItem2);
int returnCode = WindowsAPIHelpers.SHCreateItemFromParsingName(fileName, IntPtr.Zero, ref itemIdentifier, out IShellItem nativeShellItem);

if (retCode != 0)
if (returnCode != 0)
{
throw Marshal.GetExceptionForHR(retCode);
throw Marshal.GetExceptionForHR(returnCode);
}

SIZE nativeSize = default;
Expand Down

0 comments on commit d1a3b47

Please sign in to comment.