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

Side by Side Diff: Source/core/paint/BoxBorderPainter.h

Issue 1154213013: Stateful BoxBorderPainter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: minor optimization Created 5 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/paint/BoxBorderPainter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef BoxBorderPainter_h 5 #ifndef BoxBorderPainter_h
6 #define BoxBorderPainter_h 6 #define BoxBorderPainter_h
7 7
8 #include "core/layout/LayoutBoxModelObject.h" 8 #include "core/layout/LayoutBoxModelObject.h"
9 #include "core/style/BorderEdge.h"
10 #include "platform/geometry/FloatRoundedRect.h"
9 #include "platform/heap/Heap.h" 11 #include "platform/heap/Heap.h"
10 12
11 namespace blink { 13 namespace blink {
12 14
13 class ComputedStyle; 15 class ComputedStyle;
16 class IntRect;
14 class LayoutBox; 17 class LayoutBox;
15 class LayoutRect; 18 class LayoutRect;
16 struct PaintInfo; 19 struct PaintInfo;
17 20
18 // TODO(fmalita): this class will evolve into a stateful painter (merged w/ BoxB orderInfo), with no
19 // static methods.
20 class BoxBorderPainter { 21 class BoxBorderPainter {
21 STACK_ALLOCATED(); 22 STACK_ALLOCATED();
22 public: 23 public:
23 void paintBorder(LayoutBoxModelObject&, const PaintInfo&, const LayoutRect&, const ComputedStyle&, 24 BoxBorderPainter(const LayoutRect& borderRect, const ComputedStyle&, const I ntRect& clipRect,
24 BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogic alRightEdge) const; 25 BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogic alRightEdge);
26
27 void paintBorder(const PaintInfo&, const LayoutRect& borderRect) const;
25 28
26 private: 29 private:
27 static void paintTranslucentBorderSides(GraphicsContext*, const ComputedStyl e&, const FloatRoundedRect& outerBorder, const FloatRoundedRect& innerBorder, 30 bool paintBorderFastPath(GraphicsContext*, const LayoutRect& borderRect) con st;
28 const BorderEdge[], BorderEdgeFlags, BackgroundBleedAvoidance, bool incl udeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias = false); 31 void drawDoubleBorder(GraphicsContext*, const LayoutRect& borderRect) const;
29 static void paintOneBorderSide(GraphicsContext*, const ComputedStyle&, const FloatRoundedRect& outerBorder, const FloatRoundedRect& innerBorder, 32
30 const FloatRect& sideRect, BoxSide, BoxSide adjacentSide1, BoxSide adjac entSide2, const BorderEdge[], 33 void paintTranslucentBorderSides(GraphicsContext*, bool antialias) const;
31 const Path*, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias, const Color* overrideColor = 0); 34 void paintOneBorderSide(GraphicsContext*, const FloatRect& sideRect, BoxSide , BoxSide adjacentSide1,
32 static void paintBorderSides(GraphicsContext*, const ComputedStyle&, const F loatRoundedRect& outerBorder, const FloatRoundedRect& innerBorder, 35 BoxSide adjacentSide2, const Path*, bool antialias, const Color* overrid eColor) const;
33 const BorderEdge[], BorderEdgeFlags, BackgroundBleedAvoidance, bool incl udeLogicalLeftEdge, 36 void paintBorderSides(GraphicsContext*, BorderEdgeFlags edgeSet, bool antial ias,
34 bool includeLogicalRightEdge, bool antialias = false, const Color* overr ideColor = 0); 37 const Color* overrideColor = 0) const;
35 static void drawBoxSideFromPath(GraphicsContext*, const LayoutRect&, const P ath&, const BorderEdge[], 38 void drawBoxSideFromPath(GraphicsContext*, const LayoutRect&, const Path&, f loat thickness,
36 float thickness, float drawThickness, BoxSide, const ComputedStyle&, 39 float drawThickness, BoxSide, Color, EBorderStyle) const;
37 Color, EBorderStyle, BackgroundBleedAvoidance, bool includeLogicalLeftEd ge, bool includeLogicalRightEdge); 40 void clipBorderSidePolygon(GraphicsContext*, BoxSide, bool firstEdgeMatches,
38 static void clipBorderSidePolygon(GraphicsContext*, const FloatRoundedRect& outerBorder, const FloatRoundedRect& innerBorder, 41 bool secondEdgeMatches) const;
39 BoxSide, bool firstEdgeMatches, bool secondEdgeMatches); 42 void clipBorderSideForComplexInnerPath(GraphicsContext*, BoxSide) const;
40 static void clipBorderSideForComplexInnerPath(GraphicsContext*, const FloatR oundedRect&, const FloatRoundedRect&, BoxSide, const BorderEdge[]); 43
44 const BorderEdge& firstEdge() const
45 {
46 ASSERT(m_visibleEdgeSet);
47 return m_edges[m_firstVisibleEdge];
48 }
49
50 // const inputs
51 const ComputedStyle& m_style;
52 const BackgroundBleedAvoidance m_bleedAvoidance;
53 const bool m_includeLogicalLeftEdge;
54 const bool m_includeLogicalRightEdge;
55
56 // computed attributes
57 FloatRoundedRect m_outer;
58 FloatRoundedRect m_inner;
59 BorderEdge m_edges[4];
60
61 unsigned m_visibleEdgeCount;
62 unsigned m_firstVisibleEdge;
63 BorderEdgeFlags m_visibleEdgeSet;
64
65 bool m_isUniformStyle;
66 bool m_isUniformWidth;
67 bool m_isUniformColor;
68 bool m_hasAlpha;
41 }; 69 };
42 70
43 } // namespace blink 71 } // namespace blink
44 72
45 #endif 73 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/paint/BoxBorderPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698