Index: third_party/WebKit/Source/core/paint/NinePieceImageGrid.cpp |
diff --git a/third_party/WebKit/Source/core/paint/NinePieceImageGrid.cpp b/third_party/WebKit/Source/core/paint/NinePieceImageGrid.cpp |
index 16c1dadda9d6cbaab9c559e9835eeb250d7c2f19..2980a044f67b6ca7012a3d99efd0dfacf941c165 100644 |
--- a/third_party/WebKit/Source/core/paint/NinePieceImageGrid.cpp |
+++ b/third_party/WebKit/Source/core/paint/NinePieceImageGrid.cpp |
@@ -226,8 +226,10 @@ void NinePieceImageGrid::setDrawInfoMiddle(NinePieceDrawInfo& drawInfo) const |
drawInfo.tileRule = { m_horizontalTileRule, m_verticalTileRule }; |
} |
-NinePieceImageGrid::NinePieceDrawInfo NinePieceImageGrid::getNinePieceDrawInfo(NinePiece piece) const |
+NinePieceImageGrid::NinePieceDrawInfo NinePieceImageGrid::getNinePieceDrawInfo(NinePiece piece, float imageScaleFactor) const |
{ |
+ DCHECK_NE(imageScaleFactor, 0); |
+ |
NinePieceDrawInfo drawInfo; |
drawInfo.isCornerPiece = |
piece == TopLeftPiece || piece == TopRightPiece || piece == BottomLeftPiece || piece == BottomRightPiece; |
@@ -239,6 +241,15 @@ NinePieceImageGrid::NinePieceDrawInfo NinePieceImageGrid::getNinePieceDrawInfo(N |
else |
setDrawInfoMiddle(drawInfo); |
+ if (imageScaleFactor != 1) { |
+ // The nine piece grid is computed in unscaled image coordinates but must be drawn using |
+ // scaled image coordinates. |
+ drawInfo.source.scale(imageScaleFactor); |
+ |
+ // Compensate for source scaling by scaling down the individual tiles. |
+ drawInfo.tileScale.scale(1 / imageScaleFactor); |
+ } |
+ |
return drawInfo; |
} |