Bug 1207944 (part 1) - Pass a gfx::Color& instead of a gfxRGBA& to SetDeviceColor(). r=jwatt.

This avoids a gfxRGBA-to-Color conversion in SetDeviceColor() itself.

--HG--
extra : rebase_source : b458a63b950ad0bfebdd7496a64c67a5dd92b9ea
This commit is contained in:
Nicholas Nethercote 2015-09-23 23:33:31 -07:00
Родитель 34d1e72ec2
Коммит 2d94bd2f65
3 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -46,7 +46,7 @@ static void DrawDebugOverlay(mozilla::gfx::DrawTarget* dt, int x, int y, int wid
// Draw border // Draw border
c.NewPath(); c.NewPath();
c.SetDeviceColor(gfxRGBA(0.0, 0.0, 0.0, 1.0)); c.SetDeviceColor(Color(0.f, 0.f, 0.f));
c.Rectangle(gfxRect(0, 0, width, height)); c.Rectangle(gfxRect(0, 0, width, height));
c.Stroke(); c.Stroke();
@ -63,12 +63,12 @@ static void DrawDebugOverlay(mozilla::gfx::DrawTarget* dt, int x, int y, int wid
int textWidth = extents.width + 6; int textWidth = extents.width + 6;
c.NewPath(); c.NewPath();
c.SetDeviceColor(gfxRGBA(0.0, 0.0, 0.0, 1.0)); c.SetDeviceColor(Color(0.f, 0.f, 0.f));
c.Rectangle(gfxRect(gfxPoint(2,2),gfxSize(textWidth, 30))); c.Rectangle(gfxRect(gfxPoint(2,2),gfxSize(textWidth, 30)));
c.Fill(); c.Fill();
c.NewPath(); c.NewPath();
c.SetDeviceColor(gfxRGBA(1.0, 0.0, 0.0, 1.0)); c.SetDeviceColor(Color(1.0, 0.0, 0.0));
c.Rectangle(gfxRect(gfxPoint(2,2),gfxSize(textWidth, 30))); c.Rectangle(gfxRect(gfxPoint(2,2),gfxSize(textWidth, 30)));
c.Stroke(); c.Stroke();

Просмотреть файл

@ -716,12 +716,12 @@ gfxContext::SetColor(const gfxRGBA& c)
} }
void void
gfxContext::SetDeviceColor(const gfxRGBA& c) gfxContext::SetDeviceColor(const Color& aColor)
{ {
CurrentState().pattern = nullptr; CurrentState().pattern = nullptr;
CurrentState().sourceSurfCairo = nullptr; CurrentState().sourceSurfCairo = nullptr;
CurrentState().sourceSurface = nullptr; CurrentState().sourceSurface = nullptr;
CurrentState().color = ToColor(c); CurrentState().color = aColor;
} }
bool bool

Просмотреть файл

@ -255,7 +255,7 @@ public:
* Set a solid color to use for drawing. This color is in the device color space * Set a solid color to use for drawing. This color is in the device color space
* and is not transformed. * and is not transformed.
*/ */
void SetDeviceColor(const gfxRGBA& c); void SetDeviceColor(const mozilla::gfx::Color& aColor);
/** /**
* Gets the current color. It's returned in the device color space. * Gets the current color. It's returned in the device color space.