OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkLightingImageFilter.h" | 8 #include "SkLightingImageFilter.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 namespace { | 29 namespace { |
30 | 30 |
31 const SkScalar gOneThird = SkScalarInvert(SkIntToScalar(3)); | 31 const SkScalar gOneThird = SkScalarInvert(SkIntToScalar(3)); |
32 const SkScalar gTwoThirds = SkScalarDiv(SkIntToScalar(2), SkIntToScalar(3)); | 32 const SkScalar gTwoThirds = SkScalarDiv(SkIntToScalar(2), SkIntToScalar(3)); |
33 const SkScalar gOneHalf = SkFloatToScalar(0.5f); | 33 const SkScalar gOneHalf = SkFloatToScalar(0.5f); |
34 const SkScalar gOneQuarter = SkFloatToScalar(0.25f); | 34 const SkScalar gOneQuarter = SkFloatToScalar(0.25f); |
35 | 35 |
36 #if SK_SUPPORT_GPU | 36 #if SK_SUPPORT_GPU |
37 void setUniformPoint3(const GrGLUniformManager& uman, UniformHandle uni, const S
kPoint3& point) { | 37 void setUniformPoint3(const GrGLUniformManager& uman, UniformHandle uni, const S
kPoint3& point) { |
38 GR_STATIC_ASSERT(sizeof(SkPoint3) == 3 * sizeof(GrGLfloat)); | 38 GR_STATIC_ASSERT(sizeof(SkPoint3) == 3 * sizeof(GrGLfloat)); |
39 uman.set3fv(uni, 0, 1, &point.fX); | 39 uman.set3fv(uni, 1, &point.fX); |
40 } | 40 } |
41 | 41 |
42 void setUniformNormal3(const GrGLUniformManager& uman, UniformHandle uni, const
SkPoint3& point) { | 42 void setUniformNormal3(const GrGLUniformManager& uman, UniformHandle uni, const
SkPoint3& point) { |
43 setUniformPoint3(uman, uni, SkPoint3(point.fX, point.fY, point.fZ)); | 43 setUniformPoint3(uman, uni, SkPoint3(point.fX, point.fY, point.fZ)); |
44 } | 44 } |
45 #endif | 45 #endif |
46 | 46 |
47 // Shift matrix components to the left, as we advance pixels to the right. | 47 // Shift matrix components to the left, as we advance pixels to the right. |
48 inline void shiftMatrixLeft(int m[9]) { | 48 inline void shiftMatrixLeft(int m[9]) { |
49 m[0] = m[1]; | 49 m[0] = m[1]; |
(...skipping 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1593 | 1593 |
1594 builder->fsCodeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 1594 builder->fsCodeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
1595 } | 1595 } |
1596 | 1596 |
1597 #endif | 1597 #endif |
1598 | 1598 |
1599 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 1599 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
1600 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 1600 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
1601 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 1601 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
1602 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1602 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |