Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #12955 from EverythingMe/908057-hd-icons-1.1
Browse files Browse the repository at this point in the history
[Bug 908057] Fix e.me icons for 1.1 HD [r=ranbena]
  • Loading branch information
evyatron committed Oct 20, 2013
2 parents 914beb7 + 48d6065 commit 1b11c1e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
13 changes: 6 additions & 7 deletions apps/homescreen/everything.me/modules/Apps/Apps.js
Expand Up @@ -534,9 +534,6 @@ Evme.IconGroup = new function Evme_IconGroup() {
elCanvas.width = WIDTH;
elCanvas.height = HEIGHT;

elCanvas.style.width = Evme.Utils.rem(elCanvas.width / window.devicePixelRatio);
elCanvas.style.height = Evme.Utils.rem(elCanvas.height / window.devicePixelRatio);

context.imagesToLoad = icons.length;
context.imagesLoaded = [];

Expand Down Expand Up @@ -776,14 +773,12 @@ Evme.App = function Evme_App(__cfg, __index, __isMore, parent) {
elImage = Evme.$('img', el)[0],
context = canvas.getContext('2d'),
icon = Evme.Utils.formatImageData(cfg.icon) || Evme.Apps.getDefaultIcon(),
image = new Image();
image = new Image(),
ratio = window.devicePixelRatio;

canvas.width = TEXT_WIDTH;
canvas.height = FULL_SIZE + TEXT_MARGIN + TEXT_HEIGHT - 1;

canvas.style.width = Evme.Utils.rem(canvas.width / window.devicePixelRatio);
canvas.style.height = Evme.Utils.rem(canvas.height / window.devicePixelRatio);

Evme.Utils.writeTextToCanvas({
"text": cfg.name,
"context": context,
Expand Down Expand Up @@ -813,6 +808,10 @@ Evme.App = function Evme_App(__cfg, __index, __isMore, parent) {
context.shadowColor = 'rgba(0, 0, 0, 0.6)';
context.drawImage(this, (TEXT_WIDTH-FULL_SIZE)/2, 0);

elImage.style.cssText +=
';width: ' + Evme.Utils.rem(canvas.width / ratio) +
';height: ' + Evme.Utils.rem(canvas.height / ratio);

elImage.src = canvas.toDataURL('image/png');

if (callback instanceof Function) {
Expand Down
8 changes: 7 additions & 1 deletion apps/homescreen/everything.me/modules/Shortcuts/Shortcuts.js
Expand Up @@ -306,7 +306,13 @@ Evme.Shortcut = function Evme_Shortcut() {
this.setImage = function setImage(shortcutIcons) {
if (elThumb && shortcutIcons && shortcutIcons.length > 0) {
var elIconGroup = Evme.IconGroup.get(shortcutIcons, self.getName(), function onReady(elCanvas) {
var img = document.createElement('img');
var img = document.createElement('img'),
ratio = window.devicePixelRatio;

img.style.cssText +=
';width: ' + Evme.Utils.rem(elCanvas.width / ratio) +
';height: ' + Evme.Utils.rem(elCanvas.height / ratio);

img.src = elCanvas.toDataURL();

elThumb.innerHTML = '';
Expand Down

0 comments on commit 1b11c1e

Please sign in to comment.