Skip to content

Commit

Permalink
optimize hex->rgb converstion. also explicitly define src variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish authored and Dave Shea committed Aug 18, 2010
1 parent c576bd6 commit 9bd7364
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions paintbrush-0.1.js
Expand Up @@ -82,9 +82,11 @@ function addFilter(filterType) {
}
// we need to figure out RGB values for tint, let's do that ahead and not waste time in the loop
if (filterType == "filter-tint") {
src = createColor(params.tintColor);
var dest = getRGB(parseInt(src.substring(0, 2), 16), parseInt(src.substring(2, 4), 16), parseInt(src.substring(4, 6), 16));
var src = parseInt(createColor(params.tintColor), 16),
dest = getRGB(((src & 0xFF0000) >> 16), ((src & 0x00FF00) >> 8), (src & 0x0000FF));
}



// the main loop through every pixel to apply effects
// (data is per-byte, and there are 4 bytes per pixel, so lets only loop through each pixel and save a few cycles)
Expand Down

0 comments on commit 9bd7364

Please sign in to comment.