| 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" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 BottomPiece, | 30 BottomPiece, |
| 31 MiddlePiece, | 31 MiddlePiece, |
| 32 MaxPiece | 32 MaxPiece |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 inline NinePiece& operator++(NinePiece& piece) { | 35 inline NinePiece& operator++(NinePiece& piece) { |
| 36 piece = static_cast<NinePiece>(static_cast<int>(piece) + 1); | 36 piece = static_cast<NinePiece>(static_cast<int>(piece) + 1); |
| 37 return piece; | 37 return piece; |
| 38 } | 38 } |
| 39 | 39 |
| 40 // The NinePieceImageGrid class is responsible for computing drawing information
for the nine piece image. | 40 // The NinePieceImageGrid class is responsible for computing drawing information |
| 41 // for the nine piece image. |
| 41 // | 42 // |
| 42 // http://dev.w3.org/csswg/css-backgrounds-3/#border-image-process | 43 // http://dev.w3.org/csswg/css-backgrounds-3/#border-image-process |
| 43 // | 44 // |
| 44 // Given an image, a set of slices and a border area: | 45 // Given an image, a set of slices and a border area: |
| 45 // | 46 // |
| 46 // | | | 47 // | | |
| 47 // +---+---------+---+ +------------------+ | 48 // +---+---------+---+ +------------------+ |
| 48 // | 1 | 7 | 4 | | border | | 49 // | 1 | 7 | 4 | | border | |
| 49 // --+---+---------+---+--- | +------------+ | | 50 // --+---+---------+---+--- | +------------+ | |
| 50 // | | | | | | | | | 51 // | | | | | | | | |
| (...skipping 15 matching lines...) Expand all Loading... |
| 66 IntRect borderImageArea, | 67 IntRect borderImageArea, |
| 67 const IntRectOutsets& borderWidths); | 68 const IntRectOutsets& borderWidths); |
| 68 | 69 |
| 69 struct CORE_EXPORT NinePieceDrawInfo { | 70 struct CORE_EXPORT NinePieceDrawInfo { |
| 70 STACK_ALLOCATED(); | 71 STACK_ALLOCATED(); |
| 71 bool isDrawable; | 72 bool isDrawable; |
| 72 bool isCornerPiece; | 73 bool isCornerPiece; |
| 73 FloatRect destination; | 74 FloatRect destination; |
| 74 FloatRect source; | 75 FloatRect source; |
| 75 | 76 |
| 76 // tileScale and tileRule are only useful for non-corners, i.e. edge and cen
ter pieces. | 77 // tileScale and tileRule are only useful for non-corners, i.e. edge and |
| 78 // center pieces. |
| 77 FloatSize tileScale; | 79 FloatSize tileScale; |
| 78 struct { | 80 struct { |
| 79 Image::TileRule horizontal; | 81 Image::TileRule horizontal; |
| 80 Image::TileRule vertical; | 82 Image::TileRule vertical; |
| 81 } tileRule; | 83 } tileRule; |
| 82 }; | 84 }; |
| 83 NinePieceDrawInfo getNinePieceDrawInfo(NinePiece, float) const; | 85 NinePieceDrawInfo getNinePieceDrawInfo(NinePiece, float) const; |
| 84 | 86 |
| 85 struct Edge { | 87 struct Edge { |
| 86 DISALLOW_NEW(); | 88 DISALLOW_NEW(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 103 | 105 |
| 104 Edge m_top; | 106 Edge m_top; |
| 105 Edge m_right; | 107 Edge m_right; |
| 106 Edge m_bottom; | 108 Edge m_bottom; |
| 107 Edge m_left; | 109 Edge m_left; |
| 108 }; | 110 }; |
| 109 | 111 |
| 110 } // namespace blink | 112 } // namespace blink |
| 111 | 113 |
| 112 #endif // NinePieceImageGrid_h | 114 #endif // NinePieceImageGrid_h |
| OLD | NEW |