| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2007 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> | 4 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> |
| 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "platform/graphics/paint/PaintFlags.h" | 29 #include "platform/graphics/paint/PaintFlags.h" |
| 30 #include "platform/graphics/skia/SkiaUtils.h" | 30 #include "platform/graphics/skia/SkiaUtils.h" |
| 31 #include "third_party/skia/include/core/SkPaint.h" | 31 #include "third_party/skia/include/core/SkPaint.h" |
| 32 | 32 |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 SVGPaintServer::SVGPaintServer(Color color) : m_color(color) {} | 35 SVGPaintServer::SVGPaintServer(Color color) : m_color(color) {} |
| 36 | 36 |
| 37 SVGPaintServer::SVGPaintServer(PassRefPtr<Gradient> gradient, | 37 SVGPaintServer::SVGPaintServer(PassRefPtr<Gradient> gradient, |
| 38 const AffineTransform& transform) | 38 const AffineTransform& transform) |
| 39 : m_gradient(gradient), m_transform(transform), m_color(Color::black) {} | 39 : m_gradient(std::move(gradient)), |
| 40 m_transform(transform), |
| 41 m_color(Color::black) {} |
| 40 | 42 |
| 41 SVGPaintServer::SVGPaintServer(PassRefPtr<Pattern> pattern, | 43 SVGPaintServer::SVGPaintServer(PassRefPtr<Pattern> pattern, |
| 42 const AffineTransform& transform) | 44 const AffineTransform& transform) |
| 43 : m_pattern(pattern), m_transform(transform), m_color(Color::black) {} | 45 : m_pattern(std::move(pattern)), |
| 46 m_transform(transform), |
| 47 m_color(Color::black) {} |
| 44 | 48 |
| 45 void SVGPaintServer::applyToPaintFlags(PaintFlags& flags, float alpha) { | 49 void SVGPaintServer::applyToPaintFlags(PaintFlags& flags, float alpha) { |
| 46 SkColor baseColor = m_gradient || m_pattern ? SK_ColorBLACK : m_color.rgb(); | 50 SkColor baseColor = m_gradient || m_pattern ? SK_ColorBLACK : m_color.rgb(); |
| 47 flags.setColor(scaleAlpha(baseColor, alpha)); | 51 flags.setColor(scaleAlpha(baseColor, alpha)); |
| 48 if (m_pattern) { | 52 if (m_pattern) { |
| 49 m_pattern->applyToFlags(flags, affineTransformToSkMatrix(m_transform)); | 53 m_pattern->applyToFlags(flags, affineTransformToSkMatrix(m_transform)); |
| 50 } else if (m_gradient) { | 54 } else if (m_gradient) { |
| 51 m_gradient->applyToFlags(flags, affineTransformToSkMatrix(m_transform)); | 55 m_gradient->applyToFlags(flags, affineTransformToSkMatrix(m_transform)); |
| 52 } else { | 56 } else { |
| 53 flags.setShader(nullptr); | 57 flags.setShader(nullptr); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 LayoutSVGResourcePaintServer::~LayoutSVGResourcePaintServer() {} | 188 LayoutSVGResourcePaintServer::~LayoutSVGResourcePaintServer() {} |
| 185 | 189 |
| 186 SVGPaintDescription LayoutSVGResourcePaintServer::requestPaintDescription( | 190 SVGPaintDescription LayoutSVGResourcePaintServer::requestPaintDescription( |
| 187 const LayoutObject& layoutObject, | 191 const LayoutObject& layoutObject, |
| 188 const ComputedStyle& style, | 192 const ComputedStyle& style, |
| 189 LayoutSVGResourceMode resourceMode) { | 193 LayoutSVGResourceMode resourceMode) { |
| 190 return requestPaint(layoutObject, style, resourceMode); | 194 return requestPaint(layoutObject, style, resourceMode); |
| 191 } | 195 } |
| 192 | 196 |
| 193 } // namespace blink | 197 } // namespace blink |
| OLD | NEW |