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

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

Issue 1422493003: Change Widget subclasses to use a CullRect instead of an IntRect for painting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "config.h" 5 #include "config.h"
6 #include "core/paint/PaintInfo.h" 6 #include "core/paint/PaintInfo.h"
7 7
8 namespace blink { 8 namespace blink {
9 9
10 void PaintInfo::updatePaintingRootForChildren(const LayoutObject* layoutObject) 10 void PaintInfo::updatePaintingRootForChildren(const LayoutObject* layoutObject)
11 { 11 {
12 if (!paintingRoot) 12 if (!paintingRoot)
13 return; 13 return;
14 14
15 // If we're the painting root, kids draw normally, and see root of nullptr. 15 // If we're the painting root, kids draw normally, and see root of nullptr.
16 if (paintingRoot == layoutObject) { 16 if (paintingRoot == layoutObject) {
17 paintingRoot = nullptr; 17 paintingRoot = nullptr;
18 return; 18 return;
19 } 19 }
20 } 20 }
21 21
22 bool PaintInfo::shouldPaintWithinRoot(const LayoutObject* layoutObject) const 22 bool PaintInfo::shouldPaintWithinRoot(const LayoutObject* layoutObject) const
23 { 23 {
24 return !paintingRoot || paintingRoot == layoutObject; 24 return !paintingRoot || paintingRoot == layoutObject;
25 } 25 }
26 26
27 CullRect::CullRect(const CullRect& cullRect, const IntPoint& offset)
28 {
29 m_rect = cullRect.m_rect;
30 m_rect.moveBy(offset);
31 }
32
33 bool CullRect::intersectsCullRect(const IntRect& boundingBox) const
34 {
35 return boundingBox.intersects(m_rect);
36 }
37
38 bool CullRect::intersectsCullRect(const AffineTransform& transform, const FloatR ect& boundingBox) const
39 {
40 return transform.mapRect(boundingBox).intersects(m_rect);
41 }
42
43 bool CullRect::intersectsCullRect(const LayoutRect& rectArg) const
44 {
45 return m_rect.intersects(enclosingIntRect(rectArg));
46 }
47
48 bool CullRect::intersectsHorizontalRange(LayoutUnit lo, LayoutUnit hi) const
49 {
50 return !(lo >= m_rect.maxX() || hi <= m_rect.x());
51 }
52
53 bool CullRect::intersectsVerticalRange(LayoutUnit lo, LayoutUnit hi) const
54 {
55 return !(lo >= m_rect.maxY() || hi <= m_rect.y());
56 }
57
58 void PaintInfo::updateCullRect(const AffineTransform& localToParentTransform) 27 void PaintInfo::updateCullRect(const AffineTransform& localToParentTransform)
59 { 28 {
60 m_cullRect.updateCullRect(localToParentTransform); 29 m_cullRect.updateCullRect(localToParentTransform);
61 } 30 }
62 31
63 void CullRect::updateCullRect(const AffineTransform& localToParentTransform)
64 {
65 if (m_rect != LayoutRect::infiniteIntRect())
66 m_rect = localToParentTransform.inverse().mapRect(m_rect);
67 }
68
69 } // namespace blink 32 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintInfo.h ('k') | third_party/WebKit/Source/core/paint/PartPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698