Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(775)

Side by Side Diff: third_party/WebKit/Source/core/paint/BoxBorderPainter.cpp

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "core/paint/BoxBorderPainter.h" 5 #include "core/paint/BoxBorderPainter.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include "core/paint/BoxPainter.h" 8 #include "core/paint/BoxPainter.h"
9 #include "core/paint/ObjectPainter.h" 9 #include "core/paint/ObjectPainter.h"
10 #include "core/paint/PaintInfo.h" 10 #include "core/paint/PaintInfo.h"
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 borderInfo.opacityGroups[opacityGroupCount - index - 1]; 731 borderInfo.opacityGroups[opacityGroupCount - index - 1];
732 732
733 // Adjust this group's paint opacity to account for ancestor transparency 733 // Adjust this group's paint opacity to account for ancestor transparency
734 // layers (needed in case we avoid creating a layer below). 734 // layers (needed in case we avoid creating a layer below).
735 unsigned paintAlpha = group.alpha / effectiveOpacity; 735 unsigned paintAlpha = group.alpha / effectiveOpacity;
736 DCHECK_LE(paintAlpha, 255u); 736 DCHECK_LE(paintAlpha, 255u);
737 737
738 // For the last (bottom) group, we can skip the layer even in the presence of 738 // For the last (bottom) group, we can skip the layer even in the presence of
739 // opacity iff it contains no adjecent edges (no in-group overdraw 739 // opacity iff it contains no adjecent edges (no in-group overdraw
740 // possibility). 740 // possibility).
741 bool needsLayer = 741 bool needsLayer = group.alpha != 255 &&
742 group.alpha != 255 && (includesAdjacentEdges(group.edgeFlags) || 742 (includesAdjacentEdges(group.edgeFlags) ||
743 (index + 1 < borderInfo.opacityGroups.size())); 743 (index + 1 < borderInfo.opacityGroups.size()));
744 744
745 if (needsLayer) { 745 if (needsLayer) {
746 const float groupOpacity = static_cast<float>(group.alpha) / 255; 746 const float groupOpacity = static_cast<float>(group.alpha) / 255;
747 DCHECK_LT(groupOpacity, effectiveOpacity); 747 DCHECK_LT(groupOpacity, effectiveOpacity);
748 748
749 context.beginLayer(groupOpacity / effectiveOpacity); 749 context.beginLayer(groupOpacity / effectiveOpacity);
750 effectiveOpacity = groupOpacity; 750 effectiveOpacity = groupOpacity;
751 751
752 // Group opacity is applied via a layer => we draw the members using opaque 752 // Group opacity is applied via a layer => we draw the members using opaque
753 // paint. 753 // paint.
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 bool BoxBorderPainter::mitersRequireClipping(MiterType miter1, 885 bool BoxBorderPainter::mitersRequireClipping(MiterType miter1,
886 MiterType miter2, 886 MiterType miter2,
887 EBorderStyle style, 887 EBorderStyle style,
888 bool antialias) { 888 bool antialias) {
889 // Clipping is required if any of the present miters doesn't match the current 889 // Clipping is required if any of the present miters doesn't match the current
890 // AA mode. 890 // AA mode.
891 bool shouldClip = antialias ? miter1 == HardMiter || miter2 == HardMiter 891 bool shouldClip = antialias ? miter1 == HardMiter || miter2 == HardMiter
892 : miter1 == SoftMiter || miter2 == SoftMiter; 892 : miter1 == SoftMiter || miter2 == SoftMiter;
893 893
894 // Some styles require clipping for any type of miter. 894 // Some styles require clipping for any type of miter.
895 shouldClip = shouldClip || ((miter1 != NoMiter || miter2 != NoMiter) && 895 shouldClip = shouldClip ||
896 styleRequiresClipPolygon(style)); 896 ((miter1 != NoMiter || miter2 != NoMiter) &&
897 styleRequiresClipPolygon(style));
897 898
898 return shouldClip; 899 return shouldClip;
899 } 900 }
900 901
901 void BoxBorderPainter::paintOneBorderSide( 902 void BoxBorderPainter::paintOneBorderSide(
902 GraphicsContext& graphicsContext, 903 GraphicsContext& graphicsContext,
903 const FloatRect& sideRect, 904 const FloatRect& sideRect,
904 BoxSide side, 905 BoxSide side,
905 BoxSide adjacentSide1, 906 BoxSide adjacentSide1,
906 BoxSide adjacentSide2, 907 BoxSide adjacentSide2,
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 FloatPoint secondQuad[4]; 1295 FloatPoint secondQuad[4];
1295 secondQuad[0] = quad[0]; 1296 secondQuad[0] = quad[0];
1296 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy); 1297 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy);
1297 secondQuad[2] = quad[2]; 1298 secondQuad[2] = quad[2];
1298 secondQuad[3] = quad[3]; 1299 secondQuad[3] = quad[3];
1299 clipQuad(graphicsContext, secondQuad, secondMiter == SoftMiter); 1300 clipQuad(graphicsContext, secondQuad, secondMiter == SoftMiter);
1300 } 1301 }
1301 } 1302 }
1302 1303
1303 } // namespace blink 1304 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698