| 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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 SkMatrix fFilterMatrix; | 332 SkMatrix fFilterMatrix; |
| 333 }; | 333 }; |
| 334 | 334 |
| 335 class GrDiffuseLightingEffect : public GrLightingEffect { | 335 class GrDiffuseLightingEffect : public GrLightingEffect { |
| 336 public: | 336 public: |
| 337 static GrEffectRef* Create(GrTexture* texture, | 337 static GrEffectRef* Create(GrTexture* texture, |
| 338 const SkLight* light, | 338 const SkLight* light, |
| 339 SkScalar surfaceScale, | 339 SkScalar surfaceScale, |
| 340 const SkMatrix& matrix, | 340 const SkMatrix& matrix, |
| 341 SkScalar kd) { | 341 SkScalar kd) { |
| 342 AutoEffectUnref effect(SkNEW_ARGS(GrDiffuseLightingEffect, (texture, | 342 return SkNEW_ARGS(GrDiffuseLightingEffect, (texture, |
| 343 light, | 343 light, |
| 344 surfaceScale
, | 344 surfaceScale, |
| 345 matrix, | 345 matrix, |
| 346 kd))); | 346 kd)); |
| 347 return CreateEffectRef(effect); | |
| 348 } | 347 } |
| 349 | 348 |
| 350 static const char* Name() { return "DiffuseLighting"; } | 349 static const char* Name() { return "DiffuseLighting"; } |
| 351 | 350 |
| 352 typedef GrGLDiffuseLightingEffect GLEffect; | 351 typedef GrGLDiffuseLightingEffect GLEffect; |
| 353 | 352 |
| 354 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; | 353 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; |
| 355 SkScalar kd() const { return fKD; } | 354 SkScalar kd() const { return fKD; } |
| 356 | 355 |
| 357 private: | 356 private: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 369 }; | 368 }; |
| 370 | 369 |
| 371 class GrSpecularLightingEffect : public GrLightingEffect { | 370 class GrSpecularLightingEffect : public GrLightingEffect { |
| 372 public: | 371 public: |
| 373 static GrEffectRef* Create(GrTexture* texture, | 372 static GrEffectRef* Create(GrTexture* texture, |
| 374 const SkLight* light, | 373 const SkLight* light, |
| 375 SkScalar surfaceScale, | 374 SkScalar surfaceScale, |
| 376 const SkMatrix& matrix, | 375 const SkMatrix& matrix, |
| 377 SkScalar ks, | 376 SkScalar ks, |
| 378 SkScalar shininess) { | 377 SkScalar shininess) { |
| 379 AutoEffectUnref effect(SkNEW_ARGS(GrSpecularLightingEffect, (texture, | 378 return SkNEW_ARGS(GrSpecularLightingEffect, (texture, |
| 380 light, | 379 light, |
| 381 surfaceScal
e, | 380 surfaceScale, |
| 382 matrix, | 381 matrix, |
| 383 ks, | 382 ks, |
| 384 shininess))
); | 383 shininess)); |
| 385 return CreateEffectRef(effect); | |
| 386 } | 384 } |
| 387 static const char* Name() { return "SpecularLighting"; } | 385 static const char* Name() { return "SpecularLighting"; } |
| 388 | 386 |
| 389 typedef GrGLSpecularLightingEffect GLEffect; | 387 typedef GrGLSpecularLightingEffect GLEffect; |
| 390 | 388 |
| 391 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; | 389 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; |
| 392 SkScalar ks() const { return fKS; } | 390 SkScalar ks() const { return fKS; } |
| 393 SkScalar shininess() const { return fShininess; } | 391 SkScalar shininess() const { return fShininess; } |
| 394 | 392 |
| 395 private: | 393 private: |
| (...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1612 | 1610 |
| 1613 builder->fsCodeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 1611 builder->fsCodeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
| 1614 } | 1612 } |
| 1615 | 1613 |
| 1616 #endif | 1614 #endif |
| 1617 | 1615 |
| 1618 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 1616 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
| 1619 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 1617 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
| 1620 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 1618 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
| 1621 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1619 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
| OLD | NEW |