OLD | NEW |
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 #ifndef BackgroundImageGeometry_h | 5 #ifndef BackgroundImageGeometry_h |
6 #define BackgroundImageGeometry_h | 6 #define BackgroundImageGeometry_h |
7 | 7 |
8 #include "platform/geometry/IntPoint.h" | 8 #include "platform/geometry/IntPoint.h" |
9 #include "platform/geometry/IntRect.h" | 9 #include "platform/geometry/IntRect.h" |
10 #include "platform/geometry/IntSize.h" | 10 #include "platform/geometry/IntSize.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class BackgroundImageGeometry { | 14 class BackgroundImageGeometry { |
15 public: | 15 public: |
16 BackgroundImageGeometry() | 16 BackgroundImageGeometry() |
17 : m_hasNonLocalGeometry(false) | 17 : m_hasNonLocalGeometry(false) |
18 { } | 18 { } |
19 | 19 |
20 IntPoint destOrigin() const { return m_destOrigin; } | |
21 void setDestOrigin(const IntPoint& destOrigin) | |
22 { | |
23 m_destOrigin = destOrigin; | |
24 } | |
25 | |
26 IntRect destRect() const { return m_destRect; } | 20 IntRect destRect() const { return m_destRect; } |
27 void setDestRect(const IntRect& destRect) | 21 void setDestRect(const IntRect& destRect) |
28 { | 22 { |
29 m_destRect = destRect; | 23 m_destRect = destRect; |
30 } | 24 } |
31 | 25 |
32 // Returns the phase relative to the destination rectangle. | |
33 IntPoint relativePhase() const; | |
34 | |
35 IntPoint phase() const { return m_phase; } | 26 IntPoint phase() const { return m_phase; } |
36 void setPhase(const IntPoint& phase) | 27 void setPhase(const IntPoint& phase) |
37 { | 28 { |
38 m_phase = phase; | 29 m_phase = phase; |
39 } | 30 } |
40 | 31 |
41 IntSize tileSize() const { return m_tileSize; } | 32 IntSize tileSize() const { return m_tileSize; } |
42 void setTileSize(const IntSize& tileSize) | 33 void setTileSize(const IntSize& tileSize) |
43 { | 34 { |
44 m_tileSize = tileSize; | 35 m_tileSize = tileSize; |
(...skipping 15 matching lines...) Expand all Loading... |
60 | 51 |
61 void useFixedAttachment(const IntPoint& attachmentPoint); | 52 void useFixedAttachment(const IntPoint& attachmentPoint); |
62 | 53 |
63 void clip(const IntRect&); | 54 void clip(const IntRect&); |
64 | 55 |
65 void setHasNonLocalGeometry(bool hasNonLocalGeometry = true) { m_hasNonLocal
Geometry = hasNonLocalGeometry; } | 56 void setHasNonLocalGeometry(bool hasNonLocalGeometry = true) { m_hasNonLocal
Geometry = hasNonLocalGeometry; } |
66 bool hasNonLocalGeometry() const { return m_hasNonLocalGeometry; } | 57 bool hasNonLocalGeometry() const { return m_hasNonLocalGeometry; } |
67 | 58 |
68 private: | 59 private: |
69 IntRect m_destRect; | 60 IntRect m_destRect; |
70 IntPoint m_destOrigin; | |
71 IntPoint m_phase; | 61 IntPoint m_phase; |
72 IntSize m_tileSize; | 62 IntSize m_tileSize; |
73 IntSize m_repeatSpacing; | 63 IntSize m_repeatSpacing; |
74 bool m_hasNonLocalGeometry; // Has background-attachment: fixed. Implies tha
t we can't always cheaply compute destRect. | 64 bool m_hasNonLocalGeometry; // Has background-attachment: fixed. Implies tha
t we can't always cheaply compute destRect. |
75 }; | 65 }; |
76 | 66 |
77 } // namespace blink | 67 } // namespace blink |
78 | 68 |
79 #endif // BackgroundImageGeometry_h | 69 #endif // BackgroundImageGeometry_h |
OLD | NEW |