change color name lookup api to use nsString

This commit is contained in:
peterl%netscape.com 1999-07-18 00:10:59 +00:00
parent 023143a55b
commit b76f16233c
4 changed files with 8 additions and 17 deletions

View File

@ -828,12 +828,9 @@ NS_IMETHODIMP nsRenderingContextOS2::GetColor( nsString &aColor)
NS_IMETHODIMP nsRenderingContextOS2::SetColor(const nsString& aColor)
{
nscolor rgb;
char cbuf[40];
aColor.ToCString( cbuf, sizeof(cbuf));
if( NS_ColorNameToRGB( cbuf, &rgb))
if( NS_ColorNameToRGB(aColor, &rgb))
SetColor(rgb);
else if( NS_HexToRGB( cbuf, &rgb))
else if( NS_HexToRGB(aColor, &rgb))
SetColor(rgb);
return NS_OK;

View File

@ -1328,12 +1328,10 @@ NS_IMETHODIMP
nsRenderingContextPS::SetColor(const nsString& aColor)
{
nscolor rgb;
char cbuf[40];
aColor.ToCString(cbuf, sizeof(cbuf));
if (NS_ColorNameToRGB(cbuf, &rgb)) {
if (NS_ColorNameToRGB(aColor, &rgb)) {
SetColor(rgb);
}
else if (NS_HexToRGB(cbuf, &rgb)) {
else if (NS_HexToRGB(aColor, &rgb)) {
SetColor(rgb);
}
return NS_OK;

View File

@ -1990,12 +1990,10 @@ NS_IMETHODIMP
nsRenderingContextWin::SetColor(const nsString& aColor)
{
nscolor rgb;
char cbuf[40];
aColor.ToCString(cbuf, sizeof(cbuf));
if (NS_ColorNameToRGB(cbuf, &rgb)) {
if (NS_ColorNameToRGB(aColor, &rgb)) {
SetColor(rgb);
}
else if (NS_HexToRGB(cbuf, &rgb)) {
else if (NS_HexToRGB(aColor, &rgb)) {
SetColor(rgb);
}
return NS_OK;

View File

@ -570,12 +570,10 @@ NS_IMETHODIMP
nsRenderingContextXlib::SetColor(const nsString &aColor)
{
nscolor rgb;
char cbuf[40];
aColor.ToCString(cbuf, sizeof(cbuf));
if (NS_ColorNameToRGB(cbuf, &rgb)) {
if (NS_ColorNameToRGB(aColor, &rgb)) {
SetColor(rgb);
}
else if (NS_HexToRGB(cbuf, &rgb)) {
else if (NS_HexToRGB(aColor, &rgb)) {
SetColor(rgb);
}
return NS_OK;