Source/WebCore/ChangeLog

 12011-11-03 David Barr <davidbarr@chromium.org>
 2
 3 Optimize outline rendering to avoid transparency layers
 4 https://bugs.webkit.org/show_bug.cgi?id=60750
 5
 6 Add fast path for solid block outlines with alpha.
 7 Improve readability of piecewise path while at it.
 8
 9 Reviewed by NOBODY (OOPS!).
 10
 11 No intended change in behaviour, no new tests.
 12
 13 * rendering/RenderObject.cpp:
 14 (WebCore::RenderObject::paintOutline):
 15
1162011-11-03 Ben Wells <benwells@chromium.org>
217
318 Optimize canvas fills / drawImage when covering entire canvas

Source/WebCore/rendering/RenderObject.cpp

@@void RenderObject::paintOutline(GraphicsContext* graphicsContext, const LayoutRe
11331133 if (styleToUse->outlineStyleIsAuto() || styleToUse->outlineStyle() == BNONE)
11341134 return;
11351135
1136  LayoutRect adjustedPaintRec = paintRect;
1137  adjustedPaintRec.inflate(offset);
 1136 LayoutRect inner = paintRect;
 1137 inner.inflate(offset);
11381138
1139  if (adjustedPaintRec.isEmpty())
 1139 if (inner.isEmpty())
11401140 return;
11411141
 1142 LayoutRect outer = inner;
 1143 outer.inflate(outlineWidth);
 1144
 1145 if (outlineStyle == SOLID && outlineColor.hasAlpha()) {
 1146 Path path;
 1147 path.addRect(outer);
 1148 path.addRect(inner);
 1149 graphicsContext->setFillRule(RULE_EVENODD);
 1150 graphicsContext->setFillColor(outlineColor, styleToUse->colorSpace());
 1151 graphicsContext->fillPath(path);
 1152 return;
 1153 }
 1154
11421155 bool useTransparencyLayer = outlineColor.hasAlpha();
11431156 if (useTransparencyLayer) {
11441157 graphicsContext->beginTransparencyLayer(static_cast<float>(outlineColor.alpha()) / 255);
11451158 outlineColor = Color(outlineColor.red(), outlineColor.green(), outlineColor.blue());
11461159 }
11471160
1148  LayoutUnit leftOuter = adjustedPaintRec.x() - outlineWidth;
1149  LayoutUnit leftInner = adjustedPaintRec.x();
1150  LayoutUnit rightOuter = adjustedPaintRec.maxX() + outlineWidth;
1151  LayoutUnit rightInner = adjustedPaintRec.maxX();
1152  LayoutUnit topOuter = adjustedPaintRec.y() - outlineWidth;
1153  LayoutUnit topInner = adjustedPaintRec.y();
1154  LayoutUnit bottomOuter = adjustedPaintRec.maxY() + outlineWidth;
1155  LayoutUnit bottomInner = adjustedPaintRec.maxY();
 1161 LayoutUnit leftOuter = outer.x();
 1162 LayoutUnit leftInner = inner.x();
 1163 LayoutUnit rightOuter = outer.maxX();
 1164 LayoutUnit rightInner = inner.maxX();
 1165 LayoutUnit topOuter = outer.y();
 1166 LayoutUnit topInner = inner.y();
 1167 LayoutUnit bottomOuter = outer.maxY();
 1168 LayoutUnit bottomInner = inner.maxY();
11561169
11571170 drawLineForBoxSide(graphicsContext, leftOuter, topOuter, leftInner, bottomOuter, BSLeft, outlineColor, outlineStyle, outlineWidth, outlineWidth);
11581171 drawLineForBoxSide(graphicsContext, leftOuter, topOuter, rightOuter, topInner, BSTop, outlineColor, outlineStyle, outlineWidth, outlineWidth);