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

Side by Side Diff: Source/platform/geometry/Region.cpp

Issue 857973002: Removing Unused method Region::totalArea() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « Source/platform/geometry/Region.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 102 }
103 103
104 bool Region::intersects(const Region& region) const 104 bool Region::intersects(const Region& region) const
105 { 105 {
106 if (!m_bounds.intersects(region.m_bounds)) 106 if (!m_bounds.intersects(region.m_bounds))
107 return false; 107 return false;
108 108
109 return Shape::compareShapes<Shape::CompareIntersectsOperation>(m_shape, regi on.m_shape); 109 return Shape::compareShapes<Shape::CompareIntersectsOperation>(m_shape, regi on.m_shape);
110 } 110 }
111 111
112 unsigned Region::totalArea() const
113 {
114 Vector<IntRect> rects = this->rects();
115 size_t size = rects.size();
116 unsigned totalArea = 0;
117
118 for (size_t i = 0; i < size; ++i) {
119 IntRect rect = rects[i];
120 totalArea += (rect.width() * rect.height());
121 }
122
123 return totalArea;
124 }
125
126 template<typename CompareOperation> 112 template<typename CompareOperation>
127 bool Region::Shape::compareShapes(const Shape& aShape, const Shape& bShape) 113 bool Region::Shape::compareShapes(const Shape& aShape, const Shape& bShape)
128 { 114 {
129 bool result = CompareOperation::defaultResult; 115 bool result = CompareOperation::defaultResult;
130 116
131 Shape::SpanIterator aSpan = aShape.spansBegin(); 117 Shape::SpanIterator aSpan = aShape.spansBegin();
132 Shape::SpanIterator aSpanEnd = aShape.spansEnd(); 118 Shape::SpanIterator aSpanEnd = aShape.spansEnd();
133 Shape::SpanIterator bSpan = bShape.spansBegin(); 119 Shape::SpanIterator bSpan = bShape.spansBegin();
134 Shape::SpanIterator bSpanEnd = bShape.spansEnd(); 120 Shape::SpanIterator bSpanEnd = bShape.spansEnd();
135 121
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 m_bounds = m_shape.bounds(); 608 m_bounds = m_shape.bounds();
623 } 609 }
624 610
625 void Region::translate(const IntSize& offset) 611 void Region::translate(const IntSize& offset)
626 { 612 {
627 m_bounds.move(offset); 613 m_bounds.move(offset);
628 m_shape.translate(offset); 614 m_shape.translate(offset);
629 } 615 }
630 616
631 } // namespace blink 617 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/geometry/Region.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698