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 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1297 this->setWillReadFragmentPosition(); | 1297 this->setWillReadFragmentPosition(); |
1298 } | 1298 } |
1299 } | 1299 } |
1300 | 1300 |
1301 GrLightingEffect::~GrLightingEffect() { | 1301 GrLightingEffect::~GrLightingEffect() { |
1302 fLight->unref(); | 1302 fLight->unref(); |
1303 } | 1303 } |
1304 | 1304 |
1305 bool GrLightingEffect::onIsEqual(const GrFragmentProcessor& sBase) const { | 1305 bool GrLightingEffect::onIsEqual(const GrFragmentProcessor& sBase) const { |
1306 const GrLightingEffect& s = sBase.cast<GrLightingEffect>(); | 1306 const GrLightingEffect& s = sBase.cast<GrLightingEffect>(); |
1307 return this->texture(0) == s.texture(0) && | 1307 return fLight->isEqual(*s.fLight) && |
1308 fLight->isEqual(*s.fLight) && | |
1309 fSurfaceScale == s.fSurfaceScale; | 1308 fSurfaceScale == s.fSurfaceScale; |
1310 } | 1309 } |
1311 | 1310 |
1312 /////////////////////////////////////////////////////////////////////////////// | 1311 /////////////////////////////////////////////////////////////////////////////// |
1313 | 1312 |
1314 GrDiffuseLightingEffect::GrDiffuseLightingEffect(GrTexture* texture, | 1313 GrDiffuseLightingEffect::GrDiffuseLightingEffect(GrTexture* texture, |
1315 const SkLight* light, | 1314 const SkLight* light, |
1316 SkScalar surfaceScale, | 1315 SkScalar surfaceScale, |
1317 const SkMatrix& matrix, | 1316 const SkMatrix& matrix, |
1318 SkScalar kd) | 1317 SkScalar kd) |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1718 | 1717 |
1719 fsBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 1718 fsBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
1720 } | 1719 } |
1721 | 1720 |
1722 #endif | 1721 #endif |
1723 | 1722 |
1724 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 1723 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
1725 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 1724 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
1726 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 1725 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
1727 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1726 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |