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

Side by Side Diff: Source/platform/graphics/filters/FEFlood.cpp

Issue 126033003: Support colors w/ alpha in SVG 'stop' elements and 'feFlood' (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase; Prebake expected colors. Created 6 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
« no previous file with comments | « Source/platform/graphics/Color.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
6 * Copyright (C) 2013 Google Inc. All rights reserved. 6 * Copyright (C) 2013 Google Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 m_floodOpacity = floodOpacity; 72 m_floodOpacity = floodOpacity;
73 return true; 73 return true;
74 } 74 }
75 75
76 void FEFlood::applySoftware() 76 void FEFlood::applySoftware()
77 { 77 {
78 ImageBuffer* resultImage = createImageBufferResult(); 78 ImageBuffer* resultImage = createImageBufferResult();
79 if (!resultImage) 79 if (!resultImage)
80 return; 80 return;
81 81
82 Color color = colorWithOverrideAlpha(floodColor().rgb(), floodOpacity()); 82 Color color = floodColor().combineWithAlpha(floodOpacity());
83 resultImage->context()->fillRect(FloatRect(FloatPoint(), absolutePaintRect() .size()), color); 83 resultImage->context()->fillRect(FloatRect(FloatPoint(), absolutePaintRect() .size()), color);
84 FilterEffect::setResultColorSpace(ColorSpaceDeviceRGB); 84 FilterEffect::setResultColorSpace(ColorSpaceDeviceRGB);
85 } 85 }
86 86
87 PassRefPtr<SkImageFilter> FEFlood::createImageFilter(SkiaImageFilterBuilder* bui lder) 87 PassRefPtr<SkImageFilter> FEFlood::createImageFilter(SkiaImageFilterBuilder* bui lder)
88 { 88 {
89 Color color = colorWithOverrideAlpha(floodColor().rgb(), floodOpacity()); 89 Color color = floodColor().combineWithAlpha(floodOpacity());
90 90
91 SkImageFilter::CropRect rect = getCropRect(builder->cropOffset()); 91 SkImageFilter::CropRect rect = getCropRect(builder->cropOffset());
92 SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(color.rgb(), SkXfermode::kSrc_Mode)); 92 SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(color.rgb(), SkXfermode::kSrc_Mode));
93 return adoptRef(SkColorFilterImageFilter::Create(cf, 0, &rect)); 93 return adoptRef(SkColorFilterImageFilter::Create(cf, 0, &rect));
94 } 94 }
95 95
96 TextStream& FEFlood::externalRepresentation(TextStream& ts, int indent) const 96 TextStream& FEFlood::externalRepresentation(TextStream& ts, int indent) const
97 { 97 {
98 writeIndent(ts, indent); 98 writeIndent(ts, indent);
99 ts << "[feFlood"; 99 ts << "[feFlood";
100 FilterEffect::externalRepresentation(ts); 100 FilterEffect::externalRepresentation(ts);
101 ts << " flood-color=\"" << floodColor().nameForRenderTreeAsText() << "\" " 101 ts << " flood-color=\"" << floodColor().nameForRenderTreeAsText() << "\" "
102 << "flood-opacity=\"" << floodOpacity() << "\"]\n"; 102 << "flood-opacity=\"" << floodOpacity() << "\"]\n";
103 return ts; 103 return ts;
104 } 104 }
105 105
106 } // namespace WebCore 106 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/platform/graphics/Color.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698