Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(701)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java

Issue 2686623005: [Android Webapps]: Do not resize homescreen icon when not padding the icon (Closed)
Patch Set: Merge branch 'master' into test2 Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
index 86c69141d79ba80056b577fd539a4469fcdc16f0..e0fc61f9528c3b9e315ba8c0061176c6b5f50dc1 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
@@ -400,8 +400,17 @@ public class ShortcutHelper {
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
int maxInnerSize = Math.round(am.getLauncherLargeIconSize() * MAX_INNER_SIZE_RATIO);
int innerSize = Math.min(maxInnerSize, Math.max(webIcon.getWidth(), webIcon.getHeight()));
- int padding = Math.round(ICON_PADDING_RATIO * innerSize);
- int outerSize = innerSize + 2 * padding;
+
+ int outerSize = innerSize;
+ Rect innerBounds = new Rect(0, 0, innerSize, innerSize);
+
+ // Draw the icon with padding around it if all four corners are not transparent. Otherwise,
+ // don't add padding.
+ if (shouldPadIcon(webIcon)) {
+ int padding = Math.round(ICON_PADDING_RATIO * innerSize);
+ outerSize += 2 * padding;
+ innerBounds.offset(padding, padding);
+ }
Bitmap bitmap = null;
try {
@@ -414,15 +423,6 @@ public class ShortcutHelper {
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setFilterBitmap(true);
- Rect innerBounds;
-
- // Draw the icon with padding around it if all four corners are not transparent. Otherwise,
- // don't add padding.
- if (shouldPadIcon(webIcon)) {
- innerBounds = new Rect(padding, padding, outerSize - padding, outerSize - padding);
- } else {
- innerBounds = new Rect(0, 0, outerSize, outerSize);
- }
canvas.drawBitmap(webIcon, null, innerBounds, paint);
return bitmap;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698