OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2013 Adobe Systems Incorporated. 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 * | 7 * |
8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
10 * disclaimer. | 10 * disclaimer. |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "wtf/Assertions.h" | 36 #include "wtf/Assertions.h" |
37 #include "wtf/Vector.h" | 37 #include "wtf/Vector.h" |
38 | 38 |
39 namespace WebCore { | 39 namespace WebCore { |
40 | 40 |
41 class RasterShapeIntervals { | 41 class RasterShapeIntervals { |
42 public: | 42 public: |
43 RasterShapeIntervals(unsigned size, int offset = 0) | 43 RasterShapeIntervals(unsigned size, int offset = 0) |
44 : m_offset(offset) | 44 : m_offset(offset) |
45 { | 45 { |
46 m_intervals.resize(size); | 46 m_intervals.resize(clampTo<int>(size)); |
47 } | 47 } |
48 | 48 |
49 void initializeBounds(); | 49 void initializeBounds(); |
50 const IntRect& bounds() const { return m_bounds; } | 50 const IntRect& bounds() const { return m_bounds; } |
51 bool isEmpty() const { return m_bounds.isEmpty(); } | 51 bool isEmpty() const { return m_bounds.isEmpty(); } |
52 | 52 |
53 IntShapeInterval& intervalAt(int y) | 53 IntShapeInterval& intervalAt(int y) |
54 { | 54 { |
55 ASSERT(y + m_offset >= 0 && static_cast<unsigned>(y + m_offset) < m_inte
rvals.size()); | 55 ASSERT(y + m_offset >= 0 && static_cast<unsigned>(y + m_offset) < m_inte
rvals.size()); |
56 return m_intervals[y + m_offset]; | 56 return m_intervals[y + m_offset]; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 const RasterShapeIntervals& marginIntervals() const; | 101 const RasterShapeIntervals& marginIntervals() const; |
102 | 102 |
103 OwnPtr<RasterShapeIntervals> m_intervals; | 103 OwnPtr<RasterShapeIntervals> m_intervals; |
104 mutable OwnPtr<RasterShapeIntervals> m_marginIntervals; | 104 mutable OwnPtr<RasterShapeIntervals> m_marginIntervals; |
105 IntSize m_marginRectSize; | 105 IntSize m_marginRectSize; |
106 }; | 106 }; |
107 | 107 |
108 } // namespace WebCore | 108 } // namespace WebCore |
109 | 109 |
110 #endif // RasterShape_h | 110 #endif // RasterShape_h |
OLD | NEW |