OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 University of Szeged | 2 * Copyright (C) 2010 University of Szeged |
3 * Copyright (C) 2010 Zoltan Herczeg | 3 * Copyright (C) 2010 Zoltan Herczeg |
4 * Copyright (C) 2013 Google Inc. All rights reserved. | 4 * Copyright (C) 2013 Google Inc. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 29 matching lines...) Expand all Loading... |
40 FELighting::FELighting(Filter* filter, LightingType lightingType, const Color& l
ightingColor, float surfaceScale, | 40 FELighting::FELighting(Filter* filter, LightingType lightingType, const Color& l
ightingColor, float surfaceScale, |
41 float diffuseConstant, float specularConstant, float specularExponent, | 41 float diffuseConstant, float specularConstant, float specularExponent, |
42 PassRefPtr<LightSource> lightSource) | 42 PassRefPtr<LightSource> lightSource) |
43 : FilterEffect(filter) | 43 : FilterEffect(filter) |
44 , m_lightingType(lightingType) | 44 , m_lightingType(lightingType) |
45 , m_lightSource(lightSource) | 45 , m_lightSource(lightSource) |
46 , m_lightingColor(lightingColor) | 46 , m_lightingColor(lightingColor) |
47 , m_surfaceScale(surfaceScale) | 47 , m_surfaceScale(surfaceScale) |
48 , m_diffuseConstant(std::max(diffuseConstant, 0.0f)) | 48 , m_diffuseConstant(std::max(diffuseConstant, 0.0f)) |
49 , m_specularConstant(std::max(specularConstant, 0.0f)) | 49 , m_specularConstant(std::max(specularConstant, 0.0f)) |
50 , m_specularExponent(std::min(std::max(specularExponent, 1.0f), 128.0f)) | 50 , m_specularExponent(clampTo(specularExponent, 1.0f, 128.0f)) |
51 { | 51 { |
52 } | 52 } |
53 | 53 |
54 FloatRect FELighting::mapPaintRect(const FloatRect& rect, bool) | 54 FloatRect FELighting::mapPaintRect(const FloatRect& rect, bool) |
55 { | 55 { |
56 FloatRect result = rect; | 56 FloatRect result = rect; |
57 // The areas affected need to be a pixel bigger to accommodate the Sobel ker
nel. | 57 // The areas affected need to be a pixel bigger to accommodate the Sobel ker
nel. |
58 result.inflate(1); | 58 result.inflate(1); |
59 return result; | 59 return result; |
60 } | 60 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 return adoptRef(SkLightingImageFilter::CreateSpotLitSpecular(locatio
n, target, specularExponent, limitingConeAngle, lightColor.rgb(), m_surfaceScale
, m_specularConstant, m_specularExponent, input.get(), &rect)); | 97 return adoptRef(SkLightingImageFilter::CreateSpotLitSpecular(locatio
n, target, specularExponent, limitingConeAngle, lightColor.rgb(), m_surfaceScale
, m_specularConstant, m_specularExponent, input.get(), &rect)); |
98 return adoptRef(SkLightingImageFilter::CreateSpotLitDiffuse(location, ta
rget, specularExponent, limitingConeAngle, lightColor.rgb(), m_surfaceScale, m_d
iffuseConstant, input.get(), &rect)); | 98 return adoptRef(SkLightingImageFilter::CreateSpotLitDiffuse(location, ta
rget, specularExponent, limitingConeAngle, lightColor.rgb(), m_surfaceScale, m_d
iffuseConstant, input.get(), &rect)); |
99 } | 99 } |
100 default: | 100 default: |
101 ASSERT_NOT_REACHED(); | 101 ASSERT_NOT_REACHED(); |
102 return nullptr; | 102 return nullptr; |
103 } | 103 } |
104 } | 104 } |
105 | 105 |
106 } // namespace blink | 106 } // namespace blink |
OLD | NEW |