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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintInfo.h

Issue 1512803004: Use refs for GraphicsContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ScrollbarTheme
Patch Set: Created 5 years 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 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include <limits> 44 #include <limits>
45 45
46 namespace blink { 46 namespace blink {
47 47
48 class LayoutInline; 48 class LayoutInline;
49 class LayoutBoxModelObject; 49 class LayoutBoxModelObject;
50 class LayoutObject; 50 class LayoutObject;
51 class PaintInvalidationState; 51 class PaintInvalidationState;
52 52
53 struct CORE_EXPORT PaintInfo { 53 struct CORE_EXPORT PaintInfo {
54 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 54 PaintInfo(GraphicsContext& newContext, const IntRect& cullRect, PaintPhase n ewPhase, GlobalPaintFlags globalPaintFlags, PaintLayerFlags paintFlags,
55 PaintInfo(GraphicsContext* newContext, const IntRect& cullRect, PaintPhase n ewPhase, GlobalPaintFlags globalPaintFlags, PaintLayerFlags paintFlags,
56 LayoutObject* newPaintingRoot = nullptr, const LayoutBoxModelObject* new PaintContainer = nullptr) 55 LayoutObject* newPaintingRoot = nullptr, const LayoutBoxModelObject* new PaintContainer = nullptr)
57 : context(newContext) 56 : context(newContext)
58 , phase(newPhase) 57 , phase(newPhase)
59 , paintingRoot(newPaintingRoot) 58 , paintingRoot(newPaintingRoot)
60 , paintInvalidationState(nullptr)
61 , m_cullRect(cullRect) 59 , m_cullRect(cullRect)
62 , m_paintContainer(newPaintContainer) 60 , m_paintContainer(newPaintContainer)
63 , m_paintFlags(paintFlags) 61 , m_paintFlags(paintFlags)
64 , m_globalPaintFlags(globalPaintFlags) 62 , m_globalPaintFlags(globalPaintFlags)
65 { 63 {
66 } 64 }
67 65
66 PaintInfo(GraphicsContext& newContext, const PaintInfo& copyOtherFieldsFrom)
67 : context(newContext)
68 , phase(copyOtherFieldsFrom.phase)
69 , paintingRoot(copyOtherFieldsFrom.paintingRoot)
70 , m_cullRect(copyOtherFieldsFrom.m_cullRect)
71 , m_paintContainer(copyOtherFieldsFrom.m_paintContainer)
72 , m_paintFlags(copyOtherFieldsFrom.m_paintFlags)
73 , m_globalPaintFlags(copyOtherFieldsFrom.m_globalPaintFlags)
74 { }
75
68 void updatePaintingRootForChildren(const LayoutObject*); 76 void updatePaintingRootForChildren(const LayoutObject*);
69 77
70 bool shouldPaintWithinRoot(const LayoutObject*) const; 78 bool shouldPaintWithinRoot(const LayoutObject*) const;
71 79
72 bool isRenderingClipPathAsMaskImage() const { return m_paintFlags & PaintLay erPaintingRenderingClipPathAsMask; } 80 bool isRenderingClipPathAsMaskImage() const { return m_paintFlags & PaintLay erPaintingRenderingClipPathAsMask; }
73 81
74 bool skipRootBackground() const { return m_paintFlags & PaintLayerPaintingSk ipRootBackground; } 82 bool skipRootBackground() const { return m_paintFlags & PaintLayerPaintingSk ipRootBackground; }
75 bool paintRootBackgroundOnly() const { return m_paintFlags & PaintLayerPaint ingRootBackgroundOnly; } 83 bool paintRootBackgroundOnly() const { return m_paintFlags & PaintLayerPaint ingRootBackgroundOnly; }
76 84
77 bool isPrinting() const { return m_globalPaintFlags & GlobalPaintPrinting; } 85 bool isPrinting() const { return m_globalPaintFlags & GlobalPaintPrinting; }
78 86
79 DisplayItem::Type displayItemTypeForClipping() const { return DisplayItem::p aintPhaseToClipBoxType(phase); } 87 DisplayItem::Type displayItemTypeForClipping() const { return DisplayItem::p aintPhaseToClipBoxType(phase); }
80 88
81 const LayoutBoxModelObject* paintContainer() const { return m_paintContainer ; } 89 const LayoutBoxModelObject* paintContainer() const { return m_paintContainer ; }
82 90
83 GlobalPaintFlags globalPaintFlags() const { return m_globalPaintFlags; } 91 GlobalPaintFlags globalPaintFlags() const { return m_globalPaintFlags; }
84 92
85 PaintLayerFlags paintFlags() const { return m_paintFlags; } 93 PaintLayerFlags paintFlags() const { return m_paintFlags; }
86 94
87 const CullRect& cullRect() const { return m_cullRect; } 95 const CullRect& cullRect() const { return m_cullRect; }
88 96
89 void updateCullRect(const AffineTransform& localToParentTransform); 97 void updateCullRect(const AffineTransform& localToParentTransform);
90 98
91 // FIXME: Introduce setters/getters at some point. Requires a lot of changes throughout layout/. 99 // FIXME: Introduce setters/getters at some point. Requires a lot of changes throughout layout/.
92 GraphicsContext* context; 100 GraphicsContext& context;
93 PaintPhase phase; 101 PaintPhase phase;
94 LayoutObject* paintingRoot; // used to draw just one element and its visual kids 102 LayoutObject* paintingRoot; // used to draw just one element and its visual kids
95 // TODO(wangxianzhu): Populate it.
96 PaintInvalidationState* paintInvalidationState;
97 103
98 private: 104 private:
99 CullRect m_cullRect; 105 CullRect m_cullRect;
100 const LayoutBoxModelObject* m_paintContainer; // the box model object that o riginates the current painting 106 const LayoutBoxModelObject* m_paintContainer; // the box model object that o riginates the current painting
101 107
102 const PaintLayerFlags m_paintFlags; 108 const PaintLayerFlags m_paintFlags;
103 const GlobalPaintFlags m_globalPaintFlags; 109 const GlobalPaintFlags m_globalPaintFlags;
104 110
105 // TODO(chrishtr): temporary while we implement CullRect everywhere. 111 // TODO(chrishtr): temporary while we implement CullRect everywhere.
106 friend class SVGPaintContext; 112 friend class SVGPaintContext;
107 friend class SVGShapePainter; 113 friend class SVGShapePainter;
108 }; 114 };
109 115
110 } // namespace blink 116 } // namespace blink
111 117
112 #endif // PaintInfo_h 118 #endif // PaintInfo_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698