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 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1650 BoundaryMode boundaryMode, | 1650 BoundaryMode boundaryMode, |
1651 const SkIRect* srcBounds) | 1651 const SkIRect* srcBounds) |
1652 : INHERITED(texture, GrCoordTransform::MakeDivByTextureWHMatrix(texture)) | 1652 : INHERITED(texture, GrCoordTransform::MakeDivByTextureWHMatrix(texture)) |
1653 , fLight(light) | 1653 , fLight(light) |
1654 , fSurfaceScale(surfaceScale) | 1654 , fSurfaceScale(surfaceScale) |
1655 , fFilterMatrix(matrix) | 1655 , fFilterMatrix(matrix) |
1656 , fBoundaryMode(boundaryMode) | 1656 , fBoundaryMode(boundaryMode) |
1657 , fDomain(create_domain(texture, srcBounds, GrTextureDomain::kDecal_Mode)) { | 1657 , fDomain(create_domain(texture, srcBounds, GrTextureDomain::kDecal_Mode)) { |
1658 fLight->ref(); | 1658 fLight->ref(); |
1659 if (light->requiresFragmentPosition()) { | 1659 if (light->requiresFragmentPosition()) { |
1660 this->setWillReadFragmentPosition(); | 1660 this->enableBuiltInState(kFragmentPosition_BuiltInState); |
1661 } | 1661 } |
1662 } | 1662 } |
1663 | 1663 |
1664 GrLightingEffect::~GrLightingEffect() { | 1664 GrLightingEffect::~GrLightingEffect() { |
1665 fLight->unref(); | 1665 fLight->unref(); |
1666 } | 1666 } |
1667 | 1667 |
1668 bool GrLightingEffect::onIsEqual(const GrFragmentProcessor& sBase) const { | 1668 bool GrLightingEffect::onIsEqual(const GrFragmentProcessor& sBase) const { |
1669 const GrLightingEffect& s = sBase.cast<GrLightingEffect>(); | 1669 const GrLightingEffect& s = sBase.cast<GrLightingEffect>(); |
1670 return fLight->isEqual(*s.fLight) && | 1670 return fLight->isEqual(*s.fLight) && |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2118 | 2118 |
2119 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 2119 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
2120 } | 2120 } |
2121 | 2121 |
2122 #endif | 2122 #endif |
2123 | 2123 |
2124 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 2124 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
2125 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 2125 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
2126 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 2126 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
2127 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 2127 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |