This repository has been archived by the owner on Oct 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #311 (Ensure icons are always 16px*16px even when DPI is higher…
… than normal); 1.4.4b1
- Loading branch information
Showing
7 changed files
with
68 additions
and
15 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
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 |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
<Description about="urn:mozilla:install-manifest"> | ||
<em:id>[email protected]</em:id> | ||
<em:version>1.4.3</em:version> | ||
<em:version>1.4.4b1</em:version> | ||
<em:type>2</em:type> | ||
<em:unpack>true</em:unpack> | ||
|
||
|
@@ -19,7 +19,7 @@ | |
<!-- Firefox --> | ||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> | ||
<em:minVersion>17.0</em:minVersion> | ||
<em:maxVersion>33.*</em:maxVersion> | ||
<em:maxVersion>35.*</em:maxVersion> | ||
</Description> | ||
</em:targetApplication> | ||
|
||
|
@@ -28,7 +28,7 @@ | |
<!-- Thunderbird --> | ||
<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id> | ||
<em:minVersion>17.0</em:minVersion> | ||
<em:maxVersion>33.*</em:maxVersion> | ||
<em:maxVersion>35.*</em:maxVersion> | ||
</Description> | ||
</em:targetApplication> | ||
|
||
|
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
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,49 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.Specialized; | ||
using System.Text; | ||
using System.Drawing; | ||
using System.Drawing.Drawing2D; | ||
using System.Drawing.Imaging; | ||
using System.Windows.Forms; | ||
using System.IO; | ||
using System.Diagnostics; | ||
|
||
namespace KeePassRPC | ||
{ | ||
public static class DpiFix | ||
{ | ||
|
||
public static Image ScaleImageTo16x16(Image img, bool bForceNewObject) | ||
{ | ||
if (img == null) { Debug.Assert(false); return null; } | ||
|
||
int w = img.Width; | ||
int h = img.Height; | ||
int sw = 16; | ||
int sh = 16; | ||
|
||
if ((w == sw) && (h == sh) && !bForceNewObject) | ||
return img; | ||
|
||
Bitmap bmp = new Bitmap(sw, sh, img.PixelFormat); | ||
using (Graphics g = Graphics.FromImage(bmp)) | ||
{ | ||
g.SmoothingMode = SmoothingMode.HighQuality; | ||
g.InterpolationMode = InterpolationMode.HighQualityBicubic; | ||
|
||
RectangleF rSource = new RectangleF(0, 0, w, h); | ||
RectangleF rDest = new RectangleF(0, 0, sw, sh); | ||
|
||
// Prevent border drawing bug | ||
rSource.Offset(-0.5f, -0.5f); | ||
|
||
g.DrawImage(img, rDest, rSource, GraphicsUnit.Pixel); | ||
} | ||
|
||
return bmp; | ||
} | ||
} | ||
|
||
|
||
} |
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
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
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