Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(428)

Side by Side Diff: third_party/WebKit/Source/core/paint/NinePieceImageGrid.cpp

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 if (drawInfo.isDrawable) { 175 if (drawInfo.isDrawable) {
176 drawInfo.source = source; 176 drawInfo.source = source;
177 drawInfo.destination = destination; 177 drawInfo.destination = destination;
178 drawInfo.tileScale = FloatSize(edge.scale(), edge.scale()); 178 drawInfo.tileScale = FloatSize(edge.scale(), edge.scale());
179 drawInfo.tileRule = {Image::StretchTile, tileRule}; 179 drawInfo.tileRule = {Image::StretchTile, tileRule};
180 } 180 }
181 } 181 }
182 182
183 void NinePieceImageGrid::setDrawInfoEdge(NinePieceDrawInfo& drawInfo, 183 void NinePieceImageGrid::setDrawInfoEdge(NinePieceDrawInfo& drawInfo,
184 NinePiece piece) const { 184 NinePiece piece) const {
185 IntSize edgeSourceSize = m_imageSize - IntSize(m_left.slice + m_right.slice, 185 IntSize edgeSourceSize =
186 m_top.slice + m_bottom.slice); 186 m_imageSize -
187 IntSize(m_left.slice + m_right.slice, m_top.slice + m_bottom.slice);
187 IntSize edgeDestinationSize = 188 IntSize edgeDestinationSize =
188 m_borderImageArea.size() - 189 m_borderImageArea.size() -
189 IntSize(m_left.width + m_right.width, m_top.width + m_bottom.width); 190 IntSize(m_left.width + m_right.width, m_top.width + m_bottom.width);
190 191
191 switch (piece) { 192 switch (piece) {
192 case LeftPiece: 193 case LeftPiece:
193 setVerticalEdge(drawInfo, m_left, 194 setVerticalEdge(drawInfo, m_left,
194 subrect(m_imageSize, 0, m_top.slice, m_left.slice, 195 subrect(m_imageSize, 0, m_top.slice, m_left.slice,
195 edgeSourceSize.height()), 196 edgeSourceSize.height()),
196 subrect(m_borderImageArea, 0, m_top.width, m_left.width, 197 subrect(m_borderImageArea, 0, m_top.width, m_left.width,
(...skipping 25 matching lines...) Expand all
222 edgeDestinationSize.width(), m_bottom.width), 223 edgeDestinationSize.width(), m_bottom.width),
223 m_horizontalTileRule); 224 m_horizontalTileRule);
224 break; 225 break;
225 default: 226 default:
226 ASSERT_NOT_REACHED(); 227 ASSERT_NOT_REACHED();
227 break; 228 break;
228 } 229 }
229 } 230 }
230 231
231 void NinePieceImageGrid::setDrawInfoMiddle(NinePieceDrawInfo& drawInfo) const { 232 void NinePieceImageGrid::setDrawInfoMiddle(NinePieceDrawInfo& drawInfo) const {
232 IntSize sourceSize = m_imageSize - IntSize(m_left.slice + m_right.slice, 233 IntSize sourceSize =
233 m_top.slice + m_bottom.slice); 234 m_imageSize -
235 IntSize(m_left.slice + m_right.slice, m_top.slice + m_bottom.slice);
234 IntSize destinationSize = 236 IntSize destinationSize =
235 m_borderImageArea.size() - 237 m_borderImageArea.size() -
236 IntSize(m_left.width + m_right.width, m_top.width + m_bottom.width); 238 IntSize(m_left.width + m_right.width, m_top.width + m_bottom.width);
237 239
238 drawInfo.isDrawable = 240 drawInfo.isDrawable =
239 m_fill && !sourceSize.isEmpty() && !destinationSize.isEmpty(); 241 m_fill && !sourceSize.isEmpty() && !destinationSize.isEmpty();
240 if (!drawInfo.isDrawable) 242 if (!drawInfo.isDrawable)
241 return; 243 return;
242 244
243 drawInfo.source = subrect(m_imageSize, m_left.slice, m_top.slice, 245 drawInfo.source = subrect(m_imageSize, m_left.slice, m_top.slice,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 drawInfo.source.scale(imageScaleFactor); 302 drawInfo.source.scale(imageScaleFactor);
301 303
302 // Compensate for source scaling by scaling down the individual tiles. 304 // Compensate for source scaling by scaling down the individual tiles.
303 drawInfo.tileScale.scale(1 / imageScaleFactor); 305 drawInfo.tileScale.scale(1 / imageScaleFactor);
304 } 306 }
305 307
306 return drawInfo; 308 return drawInfo;
307 } 309 }
308 310
309 } // namespace blink 311 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698