OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
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 "SkError.h" | 8 #include "SkError.h" |
9 #include "SkErrorInternals.h" | 9 #include "SkErrorInternals.h" |
10 #include "SkLightingShader.h" | 10 #include "SkLightingShader.h" |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 SkScalar invScalingFactor = SkScalarInvert(SkScalarSqrt(scalingF
actorSquared)); | 273 SkScalar invScalingFactor = SkScalarInvert(SkScalarSqrt(scalingF
actorSquared)); |
274 | 274 |
275 output[i].fX = transformed.fX * invScalingFactor; | 275 output[i].fX = transformed.fX * invScalingFactor; |
276 output[i].fY = transformed.fY * invScalingFactor; | 276 output[i].fY = transformed.fY * invScalingFactor; |
277 output[i].fZ = tempNorm.fZ; | 277 output[i].fZ = tempNorm.fZ; |
278 } else { | 278 } else { |
279 output[i] = {0.0f, 0.0f, tempNorm.fZ}; | 279 output[i] = {0.0f, 0.0f, tempNorm.fZ}; |
280 output[i].normalize(); | 280 output[i].normalize(); |
281 } | 281 } |
282 | 282 |
283 SkASSERT(SkScalarNearlyEqual(output[i].length(), 1.0f)) | 283 SkASSERT(SkScalarNearlyEqual(output[i].length(), 1.0f)); |
284 } | 284 } |
285 | 285 |
286 output += n; | 286 output += n; |
287 x += n; | 287 x += n; |
288 count -= n; | 288 count -= n; |
289 } while (count > 0); | 289 } while (count > 0); |
290 } | 290 } |
291 | 291 |
292 //////////////////////////////////////////////////////////////////////////////// | 292 //////////////////////////////////////////////////////////////////////////////// |
293 | 293 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 //////////////////////////////////////////////////////////////////////////// | 453 //////////////////////////////////////////////////////////////////////////// |
454 | 454 |
455 //////////////////////////////////////////////////////////////////////////// | 455 //////////////////////////////////////////////////////////////////////////// |
456 | 456 |
457 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkNormalSource) | 457 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkNormalSource) |
458 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(NormalMapSourceImpl) | 458 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(NormalMapSourceImpl) |
459 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(NormalFlatSourceImpl) | 459 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(NormalFlatSourceImpl) |
460 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 460 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
461 | 461 |
462 //////////////////////////////////////////////////////////////////////////// | 462 //////////////////////////////////////////////////////////////////////////// |
OLD | NEW |