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