| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/paint/BoxBorderPainter.h" | 6 #include "core/paint/BoxBorderPainter.h" |
| 7 | 7 |
| 8 #include "core/paint/BoxPainter.h" | 8 #include "core/paint/BoxPainter.h" |
| 9 #include "core/paint/PaintInfo.h" | 9 #include "core/paint/PaintInfo.h" |
| 10 #include "core/style/BorderEdge.h" | 10 #include "core/style/BorderEdge.h" |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 context->strokeRect(strokeRect, borderWidth); | 266 context->strokeRect(strokeRect, borderWidth); |
| 267 | 267 |
| 268 if (!wasAntialias) | 268 if (!wasAntialias) |
| 269 context->setShouldAntialias(false); | 269 context->setShouldAntialias(false); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void drawBleedAdjustedDRRect(GraphicsContext* context, BackgroundBleedAvoidance
bleedAvoidance, | 272 void drawBleedAdjustedDRRect(GraphicsContext* context, BackgroundBleedAvoidance
bleedAvoidance, |
| 273 const FloatRoundedRect& outer, const FloatRoundedRect& inner, Color color) | 273 const FloatRoundedRect& outer, const FloatRoundedRect& inner, Color color) |
| 274 { | 274 { |
| 275 switch (bleedAvoidance) { | 275 switch (bleedAvoidance) { |
| 276 case BackgroundBleedBackgroundOverBorder: | |
| 277 // BackgroundBleedBackgroundOverBorder draws an opaque background over t
he inner rrect, | |
| 278 // so we can simply fill the outer rect here to avoid backdrop bleeding. | |
| 279 context->fillRoundedRect(outer, color); | |
| 280 break; | |
| 281 case BackgroundBleedClipLayer: { | 276 case BackgroundBleedClipLayer: { |
| 282 // BackgroundBleedClipLayer clips the outer rrect for the whole layer. B
ased on this, | 277 // BackgroundBleedClipLayer clips the outer rrect for the whole layer. B
ased on this, |
| 283 // we can avoid background bleeding by filling the *outside* of inner rr
ect, all the | 278 // we can avoid background bleeding by filling the *outside* of inner rr
ect, all the |
| 284 // way to the layer bounds (enclosing int rect for the clip, in device s
pace). | 279 // way to the layer bounds (enclosing int rect for the clip, in device s
pace). |
| 285 ASSERT(outer.isRounded()); | 280 ASSERT(outer.isRounded()); |
| 286 | 281 |
| 287 SkPath path; | 282 SkPath path; |
| 288 path.addRRect(inner); | 283 path.addRRect(inner); |
| 289 path.setFillType(SkPath::kInverseWinding_FillType); | 284 path.setFillType(SkPath::kInverseWinding_FillType); |
| 290 | 285 |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 if (paintBorderFastPath(graphicsContext, rect)) | 587 if (paintBorderFastPath(graphicsContext, rect)) |
| 593 return; | 588 return; |
| 594 | 589 |
| 595 bool clipToOuterBorder = m_outer.isRounded(); | 590 bool clipToOuterBorder = m_outer.isRounded(); |
| 596 GraphicsContextStateSaver stateSaver(*graphicsContext, clipToOuterBorder); | 591 GraphicsContextStateSaver stateSaver(*graphicsContext, clipToOuterBorder); |
| 597 if (clipToOuterBorder) { | 592 if (clipToOuterBorder) { |
| 598 // For BackgroundBleedClip{Only,Layer}, the outer rrect clip is already
applied. | 593 // For BackgroundBleedClip{Only,Layer}, the outer rrect clip is already
applied. |
| 599 if (!bleedAvoidanceIsClipping(m_bleedAvoidance)) | 594 if (!bleedAvoidanceIsClipping(m_bleedAvoidance)) |
| 600 graphicsContext->clipRoundedRect(m_outer); | 595 graphicsContext->clipRoundedRect(m_outer); |
| 601 | 596 |
| 602 // For BackgroundBleedBackgroundOverBorder, we're going to draw an opaqu
e background over | 597 if (m_inner.isRenderable() && !m_inner.isEmpty()) |
| 603 // the inner rrect - so clipping is not needed (nor desirable due to bac
kdrop bleeding). | |
| 604 if (m_bleedAvoidance != BackgroundBleedBackgroundOverBorder && m_inner.i
sRenderable() && !m_inner.isEmpty()) | |
| 605 graphicsContext->clipOutRoundedRect(m_inner); | 598 graphicsContext->clipOutRoundedRect(m_inner); |
| 606 } | 599 } |
| 607 | 600 |
| 608 bool antialias = | 601 bool antialias = |
| 609 RuntimeEnabledFeatures::slimmingPaintEnabled() | 602 RuntimeEnabledFeatures::slimmingPaintEnabled() |
| 610 || m_visibleEdgeCount == 1 | 603 || m_visibleEdgeCount == 1 |
| 611 || BoxPainter::shouldAntialiasLines(graphicsContext); | 604 || BoxPainter::shouldAntialiasLines(graphicsContext); |
| 612 | 605 |
| 613 const ComplexBorderInfo borderInfo(*this, antialias); | 606 const ComplexBorderInfo borderInfo(*this, antialias); |
| 614 paintOpacityGroup(graphicsContext, borderInfo, 0, 1); | 607 paintOpacityGroup(graphicsContext, borderInfo, 0, 1); |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1189 FloatPoint secondQuad[4]; | 1182 FloatPoint secondQuad[4]; |
| 1190 secondQuad[0] = quad[0]; | 1183 secondQuad[0] = quad[0]; |
| 1191 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy)
; | 1184 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy)
; |
| 1192 secondQuad[2] = quad[2]; | 1185 secondQuad[2] = quad[2]; |
| 1193 secondQuad[3] = quad[3]; | 1186 secondQuad[3] = quad[3]; |
| 1194 graphicsContext->clipPolygon(4, secondQuad, secondMiter == SoftMiter); | 1187 graphicsContext->clipPolygon(4, secondQuad, secondMiter == SoftMiter); |
| 1195 } | 1188 } |
| 1196 } | 1189 } |
| 1197 | 1190 |
| 1198 } // namespace blink | 1191 } // namespace blink |
| OLD | NEW |