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/NinePieceImagePainter.h" | 5 #include "core/paint/NinePieceImagePainter.h" |
6 | 6 |
7 #include "core/layout/ImageQualityController.h" | 7 #include "core/layout/ImageQualityController.h" |
8 #include "core/layout/LayoutBoxModelObject.h" | 8 #include "core/layout/LayoutBoxModelObject.h" |
9 #include "core/paint/BoxPainter.h" | 9 #include "core/paint/BoxPainter.h" |
10 #include "core/paint/NinePieceImageGrid.h" | 10 #include "core/paint/NinePieceImageGrid.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 RefPtr<Image> image = styleImage->image(m_layoutObject, imageSize, 1); | 53 RefPtr<Image> image = styleImage->image(m_layoutObject, imageSize, 1); |
54 | 54 |
55 InterpolationQuality interpolationQuality = BoxPainter::chooseInterpolationQ
uality(m_layoutObject, image.get(), 0, rectWithOutsets.size()); | 55 InterpolationQuality interpolationQuality = BoxPainter::chooseInterpolationQ
uality(m_layoutObject, image.get(), 0, rectWithOutsets.size()); |
56 InterpolationQuality previousInterpolationQuality = graphicsContext.imageInt
erpolationQuality(); | 56 InterpolationQuality previousInterpolationQuality = graphicsContext.imageInt
erpolationQuality(); |
57 graphicsContext.setImageInterpolationQuality(interpolationQuality); | 57 graphicsContext.setImageInterpolationQuality(interpolationQuality); |
58 | 58 |
59 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", "
data", | 59 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", "
data", |
60 InspectorPaintImageEvent::data(m_layoutObject, *styleImage)); | 60 InspectorPaintImageEvent::data(m_layoutObject, *styleImage)); |
61 | 61 |
62 for (NinePiece piece = MinPiece; piece < MaxPiece; ++piece) { | 62 for (NinePiece piece = MinPiece; piece < MaxPiece; ++piece) { |
63 NinePieceImageGrid::NinePieceDrawInfo drawInfo = grid.getNinePieceDrawIn
fo(piece); | 63 NinePieceImageGrid::NinePieceDrawInfo drawInfo = grid.getNinePieceDrawIn
fo(piece, styleImage->imageScaleFactor()); |
64 | |
65 // The nine piece grid is computed in unscaled image coordinates but mus
t be drawn using | |
66 // scaled image coordinates. | |
67 drawInfo.source.scale(styleImage->imageScaleFactor()); | |
68 | 64 |
69 if (drawInfo.isDrawable) { | 65 if (drawInfo.isDrawable) { |
70 if (drawInfo.isCornerPiece) { | 66 if (drawInfo.isCornerPiece) { |
71 graphicsContext.drawImage(image.get(), drawInfo.destination, dra
wInfo.source, op); | 67 graphicsContext.drawImage(image.get(), drawInfo.destination, dra
wInfo.source, op); |
72 } else { | 68 } else { |
73 graphicsContext.drawTiledImage(image.get(), drawInfo.destination
, | 69 graphicsContext.drawTiledImage(image.get(), drawInfo.destination
, |
74 drawInfo.source, drawInfo.tileScale, drawInfo.tileRule.horiz
ontal, | 70 drawInfo.source, drawInfo.tileScale, drawInfo.tileRule.horiz
ontal, |
75 drawInfo.tileRule.vertical, op); | 71 drawInfo.tileRule.vertical, op); |
76 } | 72 } |
77 } | 73 } |
78 } | 74 } |
79 | 75 |
80 graphicsContext.setImageInterpolationQuality(previousInterpolationQuality); | 76 graphicsContext.setImageInterpolationQuality(previousInterpolationQuality); |
81 return true; | 77 return true; |
82 } | 78 } |
83 | 79 |
84 } // namespace blink | 80 } // namespace blink |
OLD | NEW |