| 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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 } | 542 } |
| 543 | 543 |
| 544 virtual void onFlattenLight(SkFlattenableWriteBuffer& buffer) const = 0; | 544 virtual void onFlattenLight(SkFlattenableWriteBuffer& buffer) const = 0; |
| 545 | 545 |
| 546 | 546 |
| 547 private: | 547 private: |
| 548 typedef SkRefCnt INHERITED; | 548 typedef SkRefCnt INHERITED; |
| 549 SkPoint3 fColor; | 549 SkPoint3 fColor; |
| 550 }; | 550 }; |
| 551 | 551 |
| 552 SK_DEFINE_INST_COUNT(SkLight) | |
| 553 | |
| 554 /////////////////////////////////////////////////////////////////////////////// | 552 /////////////////////////////////////////////////////////////////////////////// |
| 555 | 553 |
| 556 class SkDistantLight : public SkLight { | 554 class SkDistantLight : public SkLight { |
| 557 public: | 555 public: |
| 558 SkDistantLight(const SkPoint3& direction, SkColor color) | 556 SkDistantLight(const SkPoint3& direction, SkColor color) |
| 559 : INHERITED(color), fDirection(direction) { | 557 : INHERITED(color), fDirection(direction) { |
| 560 } | 558 } |
| 561 | 559 |
| 562 SkPoint3 surfaceToLight(int x, int y, int z, SkScalar surfaceScale) const { | 560 SkPoint3 surfaceToLight(int x, int y, int z, SkScalar surfaceScale) const { |
| 563 return fDirection; | 561 return fDirection; |
| (...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1597 | 1595 |
| 1598 builder->fsCodeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 1596 builder->fsCodeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
| 1599 } | 1597 } |
| 1600 | 1598 |
| 1601 #endif | 1599 #endif |
| 1602 | 1600 |
| 1603 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 1601 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
| 1604 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 1602 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
| 1605 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 1603 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
| 1606 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1604 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
| OLD | NEW |