bug 329593, canvas returned .fillStyle string doesn't follow the spec when it's in rgba notation. Patch by asqueella@gmail.com, r+sr=vlad
git-svn-id: svn://10.0.0.236/trunk@213646 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
5071f8a52b
commit
366a6775da
@ -609,11 +609,14 @@ nsCanvasRenderingContext2D::StyleColorToString(const nscolor& aColor, nsAString&
|
||||
NS_GET_B(aColor)),
|
||||
aStr);
|
||||
} else {
|
||||
CopyUTF8toUTF16(nsPrintfCString(100, "rgba(%d,%d,%d,%0.2f)",
|
||||
// "%0.5f" in nsPrintfCString would use the locale-specific
|
||||
// decimal separator. That's why we have to do this:
|
||||
PRUint32 alpha = NS_GET_A(aColor) * 100000 / 255;
|
||||
CopyUTF8toUTF16(nsPrintfCString(100, "rgba(%d, %d, %d, 0.%d)",
|
||||
NS_GET_R(aColor),
|
||||
NS_GET_G(aColor),
|
||||
NS_GET_B(aColor),
|
||||
NS_GET_A(aColor) / 255.0f),
|
||||
alpha),
|
||||
aStr);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user