Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGResourcePaintServer.cpp

Issue 1331533002: [poc] curve-filter Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix CanvasRenderingContext2D::createPattern crash for #40 Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } 42 }
43 43
44 SVGPaintServer::SVGPaintServer(PassRefPtr<Pattern> pattern) 44 SVGPaintServer::SVGPaintServer(PassRefPtr<Pattern> pattern)
45 : m_pattern(pattern) 45 : m_pattern(pattern)
46 , m_color(Color::black) 46 , m_color(Color::black)
47 { 47 {
48 } 48 }
49 49
50 void SVGPaintServer::applyToSkPaint(SkPaint& paint, float paintAlpha) 50 void SVGPaintServer::applyToSkPaint(SkPaint& paint, float paintAlpha)
51 { 51 {
52 SkColor baseColor = m_gradient || m_pattern ? SK_ColorBLACK : m_color.rgb(); 52 SkColor color = m_gradient || m_pattern ? SK_ColorBLACK : m_color.rgb();
53 paint.setColor(scaleAlpha(baseColor, paintAlpha)); 53 color = scaleAlpha(color, paintAlpha);
54
55 paint.setColor(Color::toDeviceColor(color).rgb());
54 if (m_pattern) { 56 if (m_pattern) {
55 m_pattern->applyToPaint(paint); 57 m_pattern->applyToPaint(paint);
56 } else if (m_gradient) { 58 } else if (m_gradient) {
57 m_gradient->applyToPaint(paint); 59 m_gradient->applyToPaint(paint);
58 } else { 60 } else {
59 paint.setShader(nullptr); 61 paint.setShader(nullptr);
60 } 62 }
61 } 63 }
62 64
63 void SVGPaintServer::prependTransform(const AffineTransform& transform) 65 void SVGPaintServer::prependTransform(const AffineTransform& transform)
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 LayoutSVGResourcePaintServer::~LayoutSVGResourcePaintServer() 177 LayoutSVGResourcePaintServer::~LayoutSVGResourcePaintServer()
176 { 178 {
177 } 179 }
178 180
179 SVGPaintDescription LayoutSVGResourcePaintServer::requestPaintDescription(const LayoutObject& layoutObject, const ComputedStyle& style, LayoutSVGResourceMode re sourceMode) 181 SVGPaintDescription LayoutSVGResourcePaintServer::requestPaintDescription(const LayoutObject& layoutObject, const ComputedStyle& style, LayoutSVGResourceMode re sourceMode)
180 { 182 {
181 return requestPaint(layoutObject, style, resourceMode); 183 return requestPaint(layoutObject, style, resourceMode);
182 } 184 }
183 185
184 } 186 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698