Commit c82dfa31 authored by fmalita@chromium.org's avatar fmalita@chromium.org

Use the stateless GC::fillRect variant when possible.

This reduces deferred paint save pressure and allows us to remove a
couple of GC state savers.

R=schenney@chromium.org,senorblanco@chromium.org
TBR=esprehn@chromium.org
BUG=424655

Review URL: https://codereview.chromium.org/671813002

git-svn-id: svn://svn.chromium.org/blink/trunk@184318 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent e935ac3a
...@@ -138,8 +138,7 @@ void LayerPainter::beginTransparencyLayers(GraphicsContext* context, const Rende ...@@ -138,8 +138,7 @@ void LayerPainter::beginTransparencyLayers(GraphicsContext* context, const Rende
if (m_renderLayer.paintsWithBlendMode()) if (m_renderLayer.paintsWithBlendMode())
context->setCompositeOperation(context->compositeOperation(), WebBlendModeNormal); context->setCompositeOperation(context->compositeOperation(), WebBlendModeNormal);
#ifdef REVEAL_TRANSPARENCY_LAYERS #ifdef REVEAL_TRANSPARENCY_LAYERS
context->setFillColor(Color(0.0f, 0.0f, 0.5f, 0.2f)); context->fillRect(clipRect, Color(0.0f, 0.0f, 0.5f, 0.2f));
context->fillRect(clipRect);
#endif #endif
} }
} }
......
...@@ -875,8 +875,6 @@ void RenderTheme::paintSliderTicks(RenderObject* o, const PaintInfo& paintInfo, ...@@ -875,8 +875,6 @@ void RenderTheme::paintSliderTicks(RenderObject* o, const PaintInfo& paintInfo,
tickRegionWidth = trackBounds.height() - thumbSize.width(); tickRegionWidth = trackBounds.height() - thumbSize.width();
} }
RefPtrWillBeRawPtr<HTMLDataListOptionsCollection> options = dataList->options(); RefPtrWillBeRawPtr<HTMLDataListOptionsCollection> options = dataList->options();
GraphicsContextStateSaver stateSaver(*paintInfo.context);
paintInfo.context->setFillColor(o->resolveColor(CSSPropertyColor));
for (unsigned i = 0; HTMLOptionElement* optionElement = options->item(i); i++) { for (unsigned i = 0; HTMLOptionElement* optionElement = options->item(i); i++) {
String value = optionElement->value(); String value = optionElement->value();
if (!input->isValidValue(value)) if (!input->isValidValue(value))
...@@ -889,7 +887,7 @@ void RenderTheme::paintSliderTicks(RenderObject* o, const PaintInfo& paintInfo, ...@@ -889,7 +887,7 @@ void RenderTheme::paintSliderTicks(RenderObject* o, const PaintInfo& paintInfo,
tickRect.setX(tickPosition); tickRect.setX(tickPosition);
else else
tickRect.setY(tickPosition); tickRect.setY(tickPosition);
paintInfo.context->fillRect(tickRect); paintInfo.context->fillRect(tickRect, o->resolveColor(CSSPropertyColor));
} }
} }
......
...@@ -116,13 +116,11 @@ void ScrollbarThemeNonMacCommon::paintTickmarks(GraphicsContext* context, Scroll ...@@ -116,13 +116,11 @@ void ScrollbarThemeNonMacCommon::paintTickmarks(GraphicsContext* context, Scroll
// Calculate how far down (in pixels) the tick-mark should appear. // Calculate how far down (in pixels) the tick-mark should appear.
const int yPos = rect.y() + (rect.height() * percent); const int yPos = rect.y() + (rect.height() * percent);
context->setFillColor(Color(0xCC, 0xAA, 0x00, 0xFF));
FloatRect tickRect(rect.x(), yPos, rect.width(), 3); FloatRect tickRect(rect.x(), yPos, rect.width(), 3);
context->fillRect(tickRect); context->fillRect(tickRect, Color(0xCC, 0xAA, 0x00, 0xFF));
context->setFillColor(Color(0xFF, 0xDD, 0x00, 0xFF));
FloatRect tickStroke(rect.x(), yPos + 1, rect.width(), 1); FloatRect tickStroke(rect.x(), yPos + 1, rect.width(), 1);
context->fillRect(tickStroke); context->fillRect(tickStroke, Color(0xFF, 0xDD, 0x00, 0xFF));
} }
} }
......
...@@ -353,8 +353,7 @@ public: ...@@ -353,8 +353,7 @@ public:
int totalHeight = numPages * (pageSizeInPixels.height() + 1) - 1; int totalHeight = numPages * (pageSizeInPixels.height() + 1) - 1;
// Fill the whole background by white. // Fill the whole background by white.
graphicsContext.setFillColor(Color::white); graphicsContext.fillRect(FloatRect(0, 0, pageWidth, totalHeight), Color::white);
graphicsContext.fillRect(FloatRect(0, 0, pageWidth, totalHeight));
int currentHeight = 0; int currentHeight = 0;
for (size_t pageIndex = 0; pageIndex < numPages; pageIndex++) { for (size_t pageIndex = 0; pageIndex < numPages; pageIndex++) {
......
...@@ -662,11 +662,9 @@ void WebPluginContainerImpl::willEndLiveResize() ...@@ -662,11 +662,9 @@ void WebPluginContainerImpl::willEndLiveResize()
bool WebPluginContainerImpl::paintCustomOverhangArea(GraphicsContext* context, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect) bool WebPluginContainerImpl::paintCustomOverhangArea(GraphicsContext* context, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect)
{ {
context->save(); Color fillColor(0xCC, 0xCC, 0xCC);
context->setFillColor(Color(0xCC, 0xCC, 0xCC)); context->fillRect(intersection(horizontalOverhangArea, dirtyRect), fillColor);
context->fillRect(intersection(horizontalOverhangArea, dirtyRect)); context->fillRect(intersection(verticalOverhangArea, dirtyRect), fillColor);
context->fillRect(intersection(verticalOverhangArea, dirtyRect));
context->restore();
return true; return true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment