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

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

Issue 1756763004: Merge image sizing algorithms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unused variable 'styleImage' in release Created 4 years, 9 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 17 matching lines...) Expand all
28 } 28 }
29 29
30 NinePieceImageGrid::NinePieceImageGrid(const NinePieceImage& ninePieceImage, Int Size imageSize, IntRect borderImageArea, 30 NinePieceImageGrid::NinePieceImageGrid(const NinePieceImage& ninePieceImage, Int Size imageSize, IntRect borderImageArea,
31 const IntRectOutsets& borderWidths) 31 const IntRectOutsets& borderWidths)
32 : m_borderImageArea(borderImageArea) 32 : m_borderImageArea(borderImageArea)
33 , m_imageSize(imageSize) 33 , m_imageSize(imageSize)
34 , m_horizontalTileRule((Image::TileRule)ninePieceImage.horizontalRule()) 34 , m_horizontalTileRule((Image::TileRule)ninePieceImage.horizontalRule())
35 , m_verticalTileRule((Image::TileRule)ninePieceImage.verticalRule()) 35 , m_verticalTileRule((Image::TileRule)ninePieceImage.verticalRule())
36 , m_fill(ninePieceImage.fill()) 36 , m_fill(ninePieceImage.fill())
37 { 37 {
38 StyleImage* styleImage = ninePieceImage.image(); 38 m_top.slice = computeEdgeSlice(ninePieceImage.imageSlices().top(), imageSize .height());
39 ASSERT(styleImage); 39 m_right.slice = computeEdgeSlice(ninePieceImage.imageSlices().right(), image Size.width());
40 40 m_bottom.slice = computeEdgeSlice(ninePieceImage.imageSlices().bottom(), ima geSize.height());
41 float imageScaleFactor = styleImage->imageScaleFactor(); 41 m_left.slice = computeEdgeSlice(ninePieceImage.imageSlices().left(), imageSi ze.width());
42 m_top.slice = computeEdgeSlice(ninePieceImage.imageSlices().top(), imageSize .height()) * imageScaleFactor;
43 m_right.slice = computeEdgeSlice(ninePieceImage.imageSlices().right(), image Size.width()) * imageScaleFactor;
44 m_bottom.slice = computeEdgeSlice(ninePieceImage.imageSlices().bottom(), ima geSize.height()) * imageScaleFactor;
45 m_left.slice = computeEdgeSlice(ninePieceImage.imageSlices().left(), imageSi ze.width()) * imageScaleFactor;
46 42
47 m_top.width = computeEdgeWidth(ninePieceImage.borderSlices().top(), borderWi dths.top(), m_top.slice, 43 m_top.width = computeEdgeWidth(ninePieceImage.borderSlices().top(), borderWi dths.top(), m_top.slice,
48 borderImageArea.height()); 44 borderImageArea.height());
49 m_right.width = computeEdgeWidth(ninePieceImage.borderSlices().right(), bord erWidths.right(), m_right.slice, 45 m_right.width = computeEdgeWidth(ninePieceImage.borderSlices().right(), bord erWidths.right(), m_right.slice,
50 borderImageArea.width()); 46 borderImageArea.width());
51 m_bottom.width = computeEdgeWidth(ninePieceImage.borderSlices().bottom(), bo rderWidths.bottom(), m_bottom.slice, 47 m_bottom.width = computeEdgeWidth(ninePieceImage.borderSlices().bottom(), bo rderWidths.bottom(), m_bottom.slice,
52 borderImageArea.height()); 48 borderImageArea.height());
53 m_left.width = computeEdgeWidth(ninePieceImage.borderSlices().left(), border Widths.left(), m_left.slice, 49 m_left.width = computeEdgeWidth(ninePieceImage.borderSlices().left(), border Widths.left(), m_left.slice,
54 borderImageArea.width()); 50 borderImageArea.width());
55 51
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 setDrawInfoCorner(drawInfo, piece); 236 setDrawInfoCorner(drawInfo, piece);
241 else if (piece != MiddlePiece) 237 else if (piece != MiddlePiece)
242 setDrawInfoEdge(drawInfo, piece); 238 setDrawInfoEdge(drawInfo, piece);
243 else 239 else
244 setDrawInfoMiddle(drawInfo); 240 setDrawInfoMiddle(drawInfo);
245 241
246 return drawInfo; 242 return drawInfo;
247 } 243 }
248 244
249 } // namespace blink 245 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/BoxPainter.cpp ('k') | third_party/WebKit/Source/core/paint/NinePieceImagePainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698