| 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 #include "core/paint/NinePieceImageGrid.h" | 5 #include "core/paint/NinePieceImageGrid.h" |
| 6 | 6 |
| 7 #include "core/style/ComputedStyle.h" | 7 #include "core/style/ComputedStyle.h" |
| 8 #include "core/style/NinePieceImage.h" | 8 #include "core/style/NinePieceImage.h" |
| 9 #include "platform/LengthFunctions.h" | 9 #include "platform/LengthFunctions.h" |
| 10 #include "platform/geometry/FloatSize.h" | 10 #include "platform/geometry/FloatSize.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 top_.width)); | 140 top_.width)); |
| 141 break; | 141 break; |
| 142 case kBottomRightPiece: | 142 case kBottomRightPiece: |
| 143 SetCornerPiece(draw_info, bottom_.IsDrawable() && right_.IsDrawable(), | 143 SetCornerPiece(draw_info, bottom_.IsDrawable() && right_.IsDrawable(), |
| 144 Subrect(image_size_, -right_.slice, -bottom_.slice, | 144 Subrect(image_size_, -right_.slice, -bottom_.slice, |
| 145 right_.slice, bottom_.slice), | 145 right_.slice, bottom_.slice), |
| 146 Subrect(border_image_area_, -right_.width, -bottom_.width, | 146 Subrect(border_image_area_, -right_.width, -bottom_.width, |
| 147 right_.width, bottom_.width)); | 147 right_.width, bottom_.width)); |
| 148 break; | 148 break; |
| 149 default: | 149 default: |
| 150 ASSERT_NOT_REACHED(); | 150 NOTREACHED(); |
| 151 break; | 151 break; |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 | 154 |
| 155 static inline void SetHorizontalEdge( | 155 static inline void SetHorizontalEdge( |
| 156 NinePieceImageGrid::NinePieceDrawInfo& draw_info, | 156 NinePieceImageGrid::NinePieceDrawInfo& draw_info, |
| 157 const NinePieceImageGrid::Edge& edge, | 157 const NinePieceImageGrid::Edge& edge, |
| 158 const FloatRect& source, | 158 const FloatRect& source, |
| 159 const FloatRect& destination, | 159 const FloatRect& destination, |
| 160 Image::TileRule tile_rule) { | 160 Image::TileRule tile_rule) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 break; | 217 break; |
| 218 case kBottomPiece: | 218 case kBottomPiece: |
| 219 SetHorizontalEdge(draw_info, bottom_, | 219 SetHorizontalEdge(draw_info, bottom_, |
| 220 Subrect(image_size_, left_.slice, -bottom_.slice, | 220 Subrect(image_size_, left_.slice, -bottom_.slice, |
| 221 edge_source_size.Width(), bottom_.slice), | 221 edge_source_size.Width(), bottom_.slice), |
| 222 Subrect(border_image_area_, left_.width, -bottom_.width, | 222 Subrect(border_image_area_, left_.width, -bottom_.width, |
| 223 edge_destination_size.Width(), bottom_.width), | 223 edge_destination_size.Width(), bottom_.width), |
| 224 horizontal_tile_rule_); | 224 horizontal_tile_rule_); |
| 225 break; | 225 break; |
| 226 default: | 226 default: |
| 227 ASSERT_NOT_REACHED(); | 227 NOTREACHED(); |
| 228 break; | 228 break; |
| 229 } | 229 } |
| 230 } | 230 } |
| 231 | 231 |
| 232 void NinePieceImageGrid::SetDrawInfoMiddle(NinePieceDrawInfo& draw_info) const { | 232 void NinePieceImageGrid::SetDrawInfoMiddle(NinePieceDrawInfo& draw_info) const { |
| 233 IntSize source_size = image_size_ - IntSize(left_.slice + right_.slice, | 233 IntSize source_size = image_size_ - IntSize(left_.slice + right_.slice, |
| 234 top_.slice + bottom_.slice); | 234 top_.slice + bottom_.slice); |
| 235 IntSize destination_size = | 235 IntSize destination_size = |
| 236 border_image_area_.Size() - | 236 border_image_area_.Size() - |
| 237 IntSize(left_.width + right_.width, top_.width + bottom_.width); | 237 IntSize(left_.width + right_.width, top_.width + bottom_.width); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 draw_info.source.Scale(image_scale_factor); | 301 draw_info.source.Scale(image_scale_factor); |
| 302 | 302 |
| 303 // Compensate for source scaling by scaling down the individual tiles. | 303 // Compensate for source scaling by scaling down the individual tiles. |
| 304 draw_info.tile_scale.Scale(1 / image_scale_factor); | 304 draw_info.tile_scale.Scale(1 / image_scale_factor); |
| 305 } | 305 } |
| 306 | 306 |
| 307 return draw_info; | 307 return draw_info; |
| 308 } | 308 } |
| 309 | 309 |
| 310 } // namespace blink | 310 } // namespace blink |
| OLD | NEW |