| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ImagePainter.h" | 5 #include "core/paint/ImagePainter.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/Element.h" | 8 #include "core/dom/Element.h" |
| 9 #include "core/editing/FrameSelection.h" | 9 #include "core/editing/FrameSelection.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 return; | 54 return; |
| 55 | 55 |
| 56 Path path = areaElement.getPath(&m_layoutImage); | 56 Path path = areaElement.getPath(&m_layoutImage); |
| 57 if (path.isEmpty()) | 57 if (path.isEmpty()) |
| 58 return; | 58 return; |
| 59 | 59 |
| 60 LayoutPoint adjustedPaintOffset = paintOffset; | 60 LayoutPoint adjustedPaintOffset = paintOffset; |
| 61 adjustedPaintOffset.moveBy(m_layoutImage.location()); | 61 adjustedPaintOffset.moveBy(m_layoutImage.location()); |
| 62 path.translate(FloatSize(adjustedPaintOffset.x(), adjustedPaintOffset.y())); | 62 path.translate(FloatSize(adjustedPaintOffset.x(), adjustedPaintOffset.y())); |
| 63 | 63 |
| 64 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex
t, m_layoutImage, DisplayItem::ImageAreaFocusRing)) | 64 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex
t, m_layoutImage, DisplayItem::kImageAreaFocusRing)) |
| 65 return; | 65 return; |
| 66 | 66 |
| 67 LayoutRect focusRect = m_layoutImage.contentBoxRect(); | 67 LayoutRect focusRect = m_layoutImage.contentBoxRect(); |
| 68 focusRect.moveBy(adjustedPaintOffset); | 68 focusRect.moveBy(adjustedPaintOffset); |
| 69 LayoutObjectDrawingRecorder drawingRecorder(paintInfo.context, m_layoutImage
, DisplayItem::ImageAreaFocusRing, focusRect); | 69 LayoutObjectDrawingRecorder drawingRecorder(paintInfo.context, m_layoutImage
, DisplayItem::kImageAreaFocusRing, focusRect); |
| 70 | 70 |
| 71 // FIXME: Clip path instead of context when Skia pathops is ready. | 71 // FIXME: Clip path instead of context when Skia pathops is ready. |
| 72 // https://crbug.com/251206 | 72 // https://crbug.com/251206 |
| 73 | 73 |
| 74 paintInfo.context.save(); | 74 paintInfo.context.save(); |
| 75 paintInfo.context.clip(pixelSnappedIntRect(focusRect)); | 75 paintInfo.context.clip(pixelSnappedIntRect(focusRect)); |
| 76 paintInfo.context.drawFocusRing(path, outlineWidth, | 76 paintInfo.context.drawFocusRing(path, outlineWidth, |
| 77 areaElementStyle.outlineOffset(), | 77 areaElementStyle.outlineOffset(), |
| 78 m_layoutImage.resolveColor(areaElementStyle, CSSPropertyOutlineColor)); | 78 m_layoutImage.resolveColor(areaElementStyle, CSSPropertyOutlineColor)); |
| 79 paintInfo.context.restore(); | 79 paintInfo.context.restore(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", "
data", InspectorPaintImageEvent::data(m_layoutImage)); | 144 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", "
data", InspectorPaintImageEvent::data(m_layoutImage)); |
| 145 | 145 |
| 146 InterpolationQuality previousInterpolationQuality = context.imageInterpolati
onQuality(); | 146 InterpolationQuality previousInterpolationQuality = context.imageInterpolati
onQuality(); |
| 147 context.setImageInterpolationQuality(interpolationQuality); | 147 context.setImageInterpolationQuality(interpolationQuality); |
| 148 context.drawImage(image.get(), pixelSnappedDestRect, &srcRect, SkXfermode::k
SrcOver_Mode, | 148 context.drawImage(image.get(), pixelSnappedDestRect, &srcRect, SkXfermode::k
SrcOver_Mode, |
| 149 LayoutObject::shouldRespectImageOrientation(&m_layoutImage)); | 149 LayoutObject::shouldRespectImageOrientation(&m_layoutImage)); |
| 150 context.setImageInterpolationQuality(previousInterpolationQuality); | 150 context.setImageInterpolationQuality(previousInterpolationQuality); |
| 151 } | 151 } |
| 152 | 152 |
| 153 } // namespace blink | 153 } // namespace blink |
| OLD | NEW |