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

Unified Diff: Source/core/paint/BoxBorderPainter.h

Issue 1156663008: Anti-aliased box borders (overdraw) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: split impl, RTEF Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/paint/BoxBorderPainter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/BoxBorderPainter.h
diff --git a/Source/core/paint/BoxBorderPainter.h b/Source/core/paint/BoxBorderPainter.h
new file mode 100644
index 0000000000000000000000000000000000000000..21af6d97084823ce95e62b7536e22b07b813a790
--- /dev/null
+++ b/Source/core/paint/BoxBorderPainter.h
@@ -0,0 +1,80 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BoxBorderPainter_h
+#define BoxBorderPainter_h
+
+#include "core/layout/LayoutBoxModelObject.h"
+#include "core/style/BorderEdge.h"
+
+namespace blink {
+
+enum BorderEdgeFlag {
+ TopBorderEdge = 1 << BSTop,
+ RightBorderEdge = 1 << BSRight,
+ BottomBorderEdge = 1 << BSBottom,
+ LeftBorderEdge = 1 << BSLeft,
+ AllBorderEdges = TopBorderEdge | BottomBorderEdge | LeftBorderEdge | RightBorderEdge
+};
+
+struct BoxBorderInfo {
+ STACK_ALLOCATED();
+public:
+ BoxBorderInfo(const ComputedStyle&, BackgroundBleedAvoidance,
+ bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
+
+ const ComputedStyle& style;
+ const BackgroundBleedAvoidance bleedAvoidance;
+ const bool includeLogicalLeftEdge;
+ const bool includeLogicalRightEdge;
+
+ BorderEdge edges[4];
+
+ unsigned visibleEdgeCount;
+ unsigned firstVisibleEdge;
+ BorderEdgeFlags visibleEdgeSet;
+
+ bool isUniformStyle;
+ bool isUniformWidth;
+ bool isUniformColor;
+ bool hasAlpha;
+};
+
+class BoxBorderPainter {
+ STACK_ALLOCATED();
+public:
+ BoxBorderPainter(const BoxBorderInfo&, const FloatRoundedRect& outer,
+ const FloatRoundedRect& inner);
+
+ void paint(GraphicsContext*) const;
+
+private:
+ struct OpacityGroup {
+ Vector<BoxSide, 4> sides;
+ BorderEdgeFlags edgeFlags;
+ unsigned alpha;
+ };
+
+ enum MitreType { NoMitre, AntiAliasedMitre, NonAntiAliasedMitre };
+
+ MitreType computeMitre(BoxSide, BoxSide adjacentSide, BorderEdgeFlags paintedSides) const;
+ bool colorNeedsAntiAliasAtCorner(BoxSide, BoxSide adjacentSide, Color) const;
+ void paintSide(GraphicsContext*, BoxSide, unsigned alpha, BorderEdgeFlags paintedSides) const;
+
+ BorderEdgeFlags paintGroup(GraphicsContext*, unsigned index, float opacity) const;
+ void clipBorderSidePolygon(GraphicsContext*, BoxSide, MitreType mitre1, MitreType mitre2) const;
+
+ const BoxBorderInfo& m_borderInfo;
+ const FloatRoundedRect& m_outer;
+ const FloatRoundedRect& m_inner;
+
+ Path m_roundedPath;
+ Vector<OpacityGroup, 4> m_opacityGroups;
+ Vector<size_t, 4> m_opacityGroupIndices;
+ bool m_hasRadii[4]; // TopLeft, TopRight, BottomRight, BottomLeft
+};
+
+} // namespace blink
+
+#endif
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/paint/BoxBorderPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698