| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 NinePieceImageGrid_h | 5 #ifndef NinePieceImageGrid_h |
| 6 #define NinePieceImageGrid_h | 6 #define NinePieceImageGrid_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "platform/geometry/FloatRect.h" | 9 #include "platform/geometry/FloatRect.h" |
| 10 #include "platform/geometry/FloatSize.h" | 10 #include "platform/geometry/FloatSize.h" |
| 11 #include "platform/geometry/IntRect.h" | 11 #include "platform/geometry/LayoutRect.h" |
| 12 #include "platform/geometry/IntSize.h" | 12 #include "platform/geometry/LayoutSize.h" |
| 13 #include "platform/graphics/Image.h" | 13 #include "platform/graphics/Image.h" |
| 14 #include "platform/heap/Heap.h" | 14 #include "platform/heap/Heap.h" |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 class IntRectOutsets; | 18 class IntRectOutsets; |
| 19 class NinePieceImage; | 19 class NinePieceImage; |
| 20 | 20 |
| 21 enum NinePiece { | 21 enum NinePiece { |
| 22 MinPiece = 0, | 22 MinPiece = 0, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // --+---+---------+---+--- | | | | | 55 // --+---+---------+---+--- | | | | |
| 56 // | 2 | 8 | 5 | | +------------+ | | 56 // | 2 | 8 | 5 | | +------------+ | |
| 57 // +---+---------+---+ | | | 57 // +---+---------+---+ | | |
| 58 // | | +------------------+ | 58 // | | +------------------+ |
| 59 // | 59 // |
| 60 // it generates drawing information for the nine border pieces. | 60 // it generates drawing information for the nine border pieces. |
| 61 class CORE_EXPORT NinePieceImageGrid { | 61 class CORE_EXPORT NinePieceImageGrid { |
| 62 STACK_ALLOCATED(); | 62 STACK_ALLOCATED(); |
| 63 | 63 |
| 64 public: | 64 public: |
| 65 NinePieceImageGrid(const NinePieceImage&, IntSize imageSize, IntRect borderI
mageArea, | 65 NinePieceImageGrid(const NinePieceImage&, LayoutSize imageSize, LayoutRect b
orderImageArea, |
| 66 const IntRectOutsets& borderWidths); | 66 const IntRectOutsets& borderWidths); |
| 67 | 67 |
| 68 struct CORE_EXPORT NinePieceDrawInfo { | 68 struct CORE_EXPORT NinePieceDrawInfo { |
| 69 STACK_ALLOCATED(); | 69 STACK_ALLOCATED(); |
| 70 bool isDrawable; | 70 bool isDrawable; |
| 71 bool isCornerPiece; | 71 bool isCornerPiece; |
| 72 FloatRect destination; | 72 FloatRect destination; |
| 73 FloatRect source; | 73 FloatRect source; |
| 74 | 74 |
| 75 // tileScale and tileRule are only useful for non-corners, i.e. edge and
center pieces. | 75 // tileScale and tileRule are only useful for non-corners, i.e. edge and
center pieces. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 87 float scale() const { return isDrawable() ? (float)width / slice : 1; } | 87 float scale() const { return isDrawable() ? (float)width / slice : 1; } |
| 88 int slice; | 88 int slice; |
| 89 int width; | 89 int width; |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 private: | 92 private: |
| 93 void setDrawInfoCorner(NinePieceDrawInfo&, NinePiece) const; | 93 void setDrawInfoCorner(NinePieceDrawInfo&, NinePiece) const; |
| 94 void setDrawInfoEdge(NinePieceDrawInfo&, NinePiece) const; | 94 void setDrawInfoEdge(NinePieceDrawInfo&, NinePiece) const; |
| 95 void setDrawInfoMiddle(NinePieceDrawInfo&) const; | 95 void setDrawInfoMiddle(NinePieceDrawInfo&) const; |
| 96 | 96 |
| 97 IntRect m_borderImageArea; | 97 LayoutRect m_borderImageArea; |
| 98 IntSize m_imageSize; | 98 LayoutSize m_imageSize; |
| 99 Image::TileRule m_horizontalTileRule; | 99 Image::TileRule m_horizontalTileRule; |
| 100 Image::TileRule m_verticalTileRule; | 100 Image::TileRule m_verticalTileRule; |
| 101 bool m_fill; | 101 bool m_fill; |
| 102 | 102 |
| 103 Edge m_top; | 103 Edge m_top; |
| 104 Edge m_right; | 104 Edge m_right; |
| 105 Edge m_bottom; | 105 Edge m_bottom; |
| 106 Edge m_left; | 106 Edge m_left; |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 } // namespace blink | 109 } // namespace blink |
| 110 | 110 |
| 111 #endif // NinePieceImageGrid_h | 111 #endif // NinePieceImageGrid_h |
| OLD | NEW |