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

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

Issue 1354923003: Remove kernelUnitLength plumbing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: More TEs Created 5 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/graphics/filters/FESpecularLighting.h ('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) 2013 Google Inc. All rights reserved. 5 * Copyright (C) 2013 Google Inc. 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 11 matching lines...) Expand all
22 22
23 #include "config.h" 23 #include "config.h"
24 #include "platform/graphics/filters/FESpecularLighting.h" 24 #include "platform/graphics/filters/FESpecularLighting.h"
25 25
26 #include "platform/graphics/filters/LightSource.h" 26 #include "platform/graphics/filters/LightSource.h"
27 #include "platform/text/TextStream.h" 27 #include "platform/text/TextStream.h"
28 28
29 namespace blink { 29 namespace blink {
30 30
31 FESpecularLighting::FESpecularLighting(Filter* filter, const Color& lightingColo r, float surfaceScale, 31 FESpecularLighting::FESpecularLighting(Filter* filter, const Color& lightingColo r, float surfaceScale,
32 float specularConstant, float specularExponent, float kernelUnitLengthX, 32 float specularConstant, float specularExponent, PassRefPtr<LightSource> ligh tSource)
33 float kernelUnitLengthY, PassRefPtr<LightSource> lightSource) 33 : FELighting(filter, SpecularLighting, lightingColor, surfaceScale, 0, specu larConstant, specularExponent, lightSource)
34 : FELighting(filter, SpecularLighting, lightingColor, surfaceScale, 0, specu larConstant, specularExponent, kernelUnitLengthX, kernelUnitLengthY, lightSource )
35 { 34 {
36 } 35 }
37 36
38 PassRefPtrWillBeRawPtr<FESpecularLighting> FESpecularLighting::create(Filter* fi lter, const Color& lightingColor, 37 PassRefPtrWillBeRawPtr<FESpecularLighting> FESpecularLighting::create(Filter* fi lter, const Color& lightingColor,
39 float surfaceScale, float specularConstant, float specularExponent, 38 float surfaceScale, float specularConstant, float specularExponent, PassRefP tr<LightSource> lightSource)
40 float kernelUnitLengthX, float kernelUnitLengthY, PassRefPtr<LightSource> li ghtSource)
41 { 39 {
42 return adoptRefWillBeNoop(new FESpecularLighting(filter, lightingColor, surf aceScale, specularConstant, specularExponent, 40 return adoptRefWillBeNoop(new FESpecularLighting(filter, lightingColor, surf aceScale, specularConstant, specularExponent,
43 kernelUnitLengthX, kernelUnitLengthY, lightSource)); 41 lightSource));
44 } 42 }
45 43
46 FESpecularLighting::~FESpecularLighting() 44 FESpecularLighting::~FESpecularLighting()
47 { 45 {
48 } 46 }
49 47
50 Color FESpecularLighting::lightingColor() const 48 Color FESpecularLighting::lightingColor() const
51 { 49 {
52 return m_lightingColor; 50 return m_lightingColor;
53 } 51 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 92
95 bool FESpecularLighting::setSpecularExponent(float specularExponent) 93 bool FESpecularLighting::setSpecularExponent(float specularExponent)
96 { 94 {
97 specularExponent = std::min(std::max(specularExponent, 1.0f), 128.0f); 95 specularExponent = std::min(std::max(specularExponent, 1.0f), 128.0f);
98 if (m_specularExponent == specularExponent) 96 if (m_specularExponent == specularExponent)
99 return false; 97 return false;
100 m_specularExponent = specularExponent; 98 m_specularExponent = specularExponent;
101 return true; 99 return true;
102 } 100 }
103 101
104 float FESpecularLighting::kernelUnitLengthX() const
105 {
106 return m_kernelUnitLengthX;
107 }
108
109 bool FESpecularLighting::setKernelUnitLengthX(float kernelUnitLengthX)
110 {
111 if (m_kernelUnitLengthX == kernelUnitLengthX)
112 return false;
113 m_kernelUnitLengthX = kernelUnitLengthX;
114 return true;
115 }
116
117 float FESpecularLighting::kernelUnitLengthY() const
118 {
119 return m_kernelUnitLengthY;
120 }
121
122 bool FESpecularLighting::setKernelUnitLengthY(float kernelUnitLengthY)
123 {
124 if (m_kernelUnitLengthY == kernelUnitLengthY)
125 return false;
126 m_kernelUnitLengthY = kernelUnitLengthY;
127 return true;
128 }
129
130 const LightSource* FESpecularLighting::lightSource() const 102 const LightSource* FESpecularLighting::lightSource() const
131 { 103 {
132 return m_lightSource.get(); 104 return m_lightSource.get();
133 } 105 }
134 106
135 void FESpecularLighting::setLightSource(PassRefPtr<LightSource> lightSource) 107 void FESpecularLighting::setLightSource(PassRefPtr<LightSource> lightSource)
136 { 108 {
137 m_lightSource = lightSource; 109 m_lightSource = lightSource;
138 } 110 }
139 111
140 TextStream& FESpecularLighting::externalRepresentation(TextStream& ts, int inden t) const 112 TextStream& FESpecularLighting::externalRepresentation(TextStream& ts, int inden t) const
141 { 113 {
142 writeIndent(ts, indent); 114 writeIndent(ts, indent);
143 ts << "[feSpecularLighting"; 115 ts << "[feSpecularLighting";
144 FilterEffect::externalRepresentation(ts); 116 FilterEffect::externalRepresentation(ts);
145 ts << " surfaceScale=\"" << m_surfaceScale << "\" " 117 ts << " surfaceScale=\"" << m_surfaceScale << "\" "
146 << "specualConstant=\"" << m_specularConstant << "\" " 118 << "specualConstant=\"" << m_specularConstant << "\" "
147 << "specularExponent=\"" << m_specularExponent << "\"]\n"; 119 << "specularExponent=\"" << m_specularExponent << "\"]\n";
148 inputEffect(0)->externalRepresentation(ts, indent + 1); 120 inputEffect(0)->externalRepresentation(ts, indent + 1);
149 return ts; 121 return ts;
150 } 122 }
151 123
152 } // namespace blink 124 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/graphics/filters/FESpecularLighting.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698