Chromium Code Reviews| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 || (style.borderTopWidth() && (style.borderTop().style() == BorderStyleN one || style.borderTop().style() == BorderStyleHidden)) | 42 || (style.borderTopWidth() && (style.borderTop().style() == BorderStyleN one || style.borderTop().style() == BorderStyleHidden)) |
| 43 || (style.borderBottomWidth() && (style.borderBottom().style() == Border StyleNone || style.borderBottom().style() == BorderStyleHidden))) | 43 || (style.borderBottomWidth() && (style.borderBottom().style() == Border StyleNone || style.borderBottom().style() == BorderStyleHidden))) |
| 44 Deprecation::countDeprecation(m_layoutObject.document(), UseCounter::Bor derImageWithBorderStyleNone); | 44 Deprecation::countDeprecation(m_layoutObject.document(), UseCounter::Bor derImageWithBorderStyleNone); |
| 45 | 45 |
| 46 // FIXME: border-image is broken with full page zooming when tiling has to h appen, since the tiling function | 46 // FIXME: border-image is broken with full page zooming when tiling has to h appen, since the tiling function |
| 47 // doesn't have any understanding of the zoom that is in effect on the tile. | 47 // doesn't have any understanding of the zoom that is in effect on the tile. |
| 48 LayoutRect rectWithOutsets = rect; | 48 LayoutRect rectWithOutsets = rect; |
| 49 rectWithOutsets.expand(style.imageOutsets(ninePieceImage)); | 49 rectWithOutsets.expand(style.imageOutsets(ninePieceImage)); |
| 50 LayoutRect borderImageRect = rectWithOutsets; | 50 LayoutRect borderImageRect = rectWithOutsets; |
| 51 | 51 |
| 52 IntSize imageSize = roundedIntSize(styleImage->imageSize(m_layoutObject, 1, borderImageRect.size())); | 52 LayoutSize defaultObjectSize = borderImageRect.size(); |
| 53 defaultObjectSize.scale(1 / style.effectiveZoom()); | |
| 54 IntSize imageSize = roundedIntSize(styleImage->imageSize(m_layoutObject, 1, defaultObjectSize)); | |
| 53 | 55 |
| 54 IntRectOutsets borderWidths(style.borderTopWidth(), style.borderRightWidth() , | 56 IntRectOutsets borderWidths(style.borderTopWidth(), style.borderRightWidth() , |
| 55 style.borderBottomWidth(), style.borderLeftWidth()); | 57 style.borderBottomWidth(), style.borderLeftWidth()); |
| 56 NinePieceImageGrid grid(ninePieceImage, imageSize, pixelSnappedIntRect(borde rImageRect), borderWidths); | 58 NinePieceImageGrid grid(ninePieceImage, imageSize, pixelSnappedIntRect(borde rImageRect), borderWidths); |
| 57 | 59 |
| 58 RefPtr<Image> image = styleImage->image(m_layoutObject, imageSize, style.eff ectiveZoom()); | 60 RefPtr<Image> image = styleImage->image(m_layoutObject, imageSize, 1); |
|
fs
2016/03/22 14:07:23
Maybe add a comment (or two) about why the zoom/sc
davve
2016/03/22 14:29:00
I added two lines to the follow-up documentation p
| |
| 59 | 61 |
| 60 InterpolationQuality interpolationQuality = BoxPainter::chooseInterpolationQ uality(m_layoutObject, image.get(), 0, rectWithOutsets.size()); | 62 InterpolationQuality interpolationQuality = BoxPainter::chooseInterpolationQ uality(m_layoutObject, image.get(), 0, rectWithOutsets.size()); |
| 61 InterpolationQuality previousInterpolationQuality = graphicsContext.imageInt erpolationQuality(); | 63 InterpolationQuality previousInterpolationQuality = graphicsContext.imageInt erpolationQuality(); |
| 62 graphicsContext.setImageInterpolationQuality(interpolationQuality); | 64 graphicsContext.setImageInterpolationQuality(interpolationQuality); |
| 63 | 65 |
| 64 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", " data", | 66 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", " data", |
| 65 InspectorPaintImageEvent::data(m_layoutObject, *styleImage)); | 67 InspectorPaintImageEvent::data(m_layoutObject, *styleImage)); |
| 66 | 68 |
| 67 for (NinePiece piece = MinPiece; piece < MaxPiece; ++piece) { | 69 for (NinePiece piece = MinPiece; piece < MaxPiece; ++piece) { |
| 68 NinePieceImageGrid::NinePieceDrawInfo drawInfo = grid.getNinePieceDrawIn fo(piece); | 70 NinePieceImageGrid::NinePieceDrawInfo drawInfo = grid.getNinePieceDrawIn fo(piece); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 80 drawInfo.tileRule.vertical, op); | 82 drawInfo.tileRule.vertical, op); |
| 81 } | 83 } |
| 82 } | 84 } |
| 83 } | 85 } |
| 84 | 86 |
| 85 graphicsContext.setImageInterpolationQuality(previousInterpolationQuality); | 87 graphicsContext.setImageInterpolationQuality(previousInterpolationQuality); |
| 86 return true; | 88 return true; |
| 87 } | 89 } |
| 88 | 90 |
| 89 } // namespace blink | 91 } // namespace blink |
| OLD | NEW |