| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef BoxBorderPainter_h |
| 6 #define BoxBorderPainter_h |
| 7 |
| 8 #include "core/layout/LayoutBoxModelObject.h" |
| 9 #include "core/style/BorderEdge.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 enum BorderEdgeFlag { |
| 14 TopBorderEdge = 1 << BSTop, |
| 15 RightBorderEdge = 1 << BSRight, |
| 16 BottomBorderEdge = 1 << BSBottom, |
| 17 LeftBorderEdge = 1 << BSLeft, |
| 18 AllBorderEdges = TopBorderEdge | BottomBorderEdge | LeftBorderEdge | RightBo
rderEdge |
| 19 }; |
| 20 |
| 21 struct BoxBorderInfo { |
| 22 STACK_ALLOCATED(); |
| 23 public: |
| 24 BoxBorderInfo(const ComputedStyle&, BackgroundBleedAvoidance, |
| 25 bool includeLogicalLeftEdge, bool includeLogicalRightEdge); |
| 26 |
| 27 const ComputedStyle& style; |
| 28 const BackgroundBleedAvoidance bleedAvoidance; |
| 29 const bool includeLogicalLeftEdge; |
| 30 const bool includeLogicalRightEdge; |
| 31 |
| 32 BorderEdge edges[4]; |
| 33 |
| 34 unsigned visibleEdgeCount; |
| 35 unsigned firstVisibleEdge; |
| 36 BorderEdgeFlags visibleEdgeSet; |
| 37 |
| 38 bool isUniformStyle; |
| 39 bool isUniformWidth; |
| 40 bool isUniformColor; |
| 41 bool hasAlpha; |
| 42 }; |
| 43 |
| 44 class BoxBorderPainter { |
| 45 STACK_ALLOCATED(); |
| 46 public: |
| 47 BoxBorderPainter(const BoxBorderInfo&, const FloatRoundedRect& outer, |
| 48 const FloatRoundedRect& inner); |
| 49 |
| 50 void paint(GraphicsContext*) const; |
| 51 |
| 52 private: |
| 53 struct OpacityGroup { |
| 54 Vector<BoxSide, 4> sides; |
| 55 BorderEdgeFlags edgeFlags; |
| 56 unsigned alpha; |
| 57 }; |
| 58 |
| 59 enum MitreType { NoMitre, AntiAliasedMitre, NonAntiAliasedMitre }; |
| 60 |
| 61 MitreType computeMitre(BoxSide, BoxSide adjacentSide, BorderEdgeFlags painte
dSides) const; |
| 62 bool colorNeedsAntiAliasAtCorner(BoxSide, BoxSide adjacentSide, Color) const
; |
| 63 void paintSide(GraphicsContext*, BoxSide, unsigned alpha, BorderEdgeFlags pa
intedSides) const; |
| 64 |
| 65 BorderEdgeFlags paintGroup(GraphicsContext*, unsigned index, float opacity)
const; |
| 66 void clipBorderSidePolygon(GraphicsContext*, BoxSide, MitreType mitre1, Mitr
eType mitre2) const; |
| 67 |
| 68 const BoxBorderInfo& m_borderInfo; |
| 69 const FloatRoundedRect& m_outer; |
| 70 const FloatRoundedRect& m_inner; |
| 71 |
| 72 Path m_roundedPath; |
| 73 Vector<OpacityGroup, 4> m_opacityGroups; |
| 74 Vector<size_t, 4> m_opacityGroupIndices; |
| 75 bool m_hasRadii[4]; // TopLeft, TopRight, BottomRight, BottomLeft |
| 76 }; |
| 77 |
| 78 } // namespace blink |
| 79 |
| 80 #endif |
| OLD | NEW |