Skip to content

Commit

Permalink
Increased speed and reduced memory usage
Browse files Browse the repository at this point in the history
No tests for that, just believe me ;-)
  • Loading branch information
ebuster committed Jun 25, 2015
1 parent 67488eb commit c24d6a2
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions jquery.borderradiusinset.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,21 @@
radiusBottomRight = Math.abs(options.radius[2]);
radiusBottomleft = Math.abs(options.radius[3]);
}

var imageWidth = $(this).width();
var imageHeight = $(this).height();

var $sourceImage = $(this);
var imageWidth = $sourceImage.width();
var imageHeight = $sourceImage.height();

var canvas = document.createElement("canvas");
canvas.width = imageWidth;
canvas.height = imageHeight;

var ctx = canvas.getContext("2d");
$(this).before(canvas);
$(this).css("display","none");
$sourceImage.before(canvas);
$sourceImage.css("display","none");

var img = new Image();
img.src = $(this).attr("src");
img.src = $sourceImage.attr("src");

img.onload = function () {

Expand Down Expand Up @@ -95,4 +96,4 @@
});
};

})(jQuery);
})(jQuery);

0 comments on commit c24d6a2

Please sign in to comment.