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 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 const Context& ctx, | 936 const Context& ctx, |
937 SkBitmap* dst, | 937 SkBitmap* dst, |
938 SkIPoint* offset) const { | 938 SkIPoint* offset) const { |
939 SkImageFilter* input = getInput(0); | 939 SkImageFilter* input = getInput(0); |
940 SkBitmap src = source; | 940 SkBitmap src = source; |
941 SkIPoint srcOffset = SkIPoint::Make(0, 0); | 941 SkIPoint srcOffset = SkIPoint::Make(0, 0); |
942 if (input && !input->filterImage(proxy, source, ctx, &src, &srcOffset)) { | 942 if (input && !input->filterImage(proxy, source, ctx, &src, &srcOffset)) { |
943 return false; | 943 return false; |
944 } | 944 } |
945 | 945 |
946 if (src.colorType() != kN32_SkColorType) { | 946 if (src.colorType() != kPMColor_SkColorType) { |
947 return false; | 947 return false; |
948 } | 948 } |
949 SkIRect bounds; | 949 SkIRect bounds; |
950 if (!this->applyCropRect(ctx, proxy, src, &srcOffset, &bounds, &src)) { | 950 if (!this->applyCropRect(ctx, proxy, src, &srcOffset, &bounds, &src)) { |
951 return false; | 951 return false; |
952 } | 952 } |
953 | 953 |
954 if (bounds.width() < 2 || bounds.height() < 2) { | 954 if (bounds.width() < 2 || bounds.height() < 2) { |
955 return false; | 955 return false; |
956 } | 956 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 const Context& ctx, | 1027 const Context& ctx, |
1028 SkBitmap* dst, | 1028 SkBitmap* dst, |
1029 SkIPoint* offset) const { | 1029 SkIPoint* offset) const { |
1030 SkImageFilter* input = getInput(0); | 1030 SkImageFilter* input = getInput(0); |
1031 SkBitmap src = source; | 1031 SkBitmap src = source; |
1032 SkIPoint srcOffset = SkIPoint::Make(0, 0); | 1032 SkIPoint srcOffset = SkIPoint::Make(0, 0); |
1033 if (input && !input->filterImage(proxy, source, ctx, &src, &srcOffset)) { | 1033 if (input && !input->filterImage(proxy, source, ctx, &src, &srcOffset)) { |
1034 return false; | 1034 return false; |
1035 } | 1035 } |
1036 | 1036 |
1037 if (src.colorType() != kN32_SkColorType) { | 1037 if (src.colorType() != kPMColor_SkColorType) { |
1038 return false; | 1038 return false; |
1039 } | 1039 } |
1040 | 1040 |
1041 SkIRect bounds; | 1041 SkIRect bounds; |
1042 if (!this->applyCropRect(ctx, proxy, src, &srcOffset, &bounds, &src)) { | 1042 if (!this->applyCropRect(ctx, proxy, src, &srcOffset, &bounds, &src)) { |
1043 return false; | 1043 return false; |
1044 } | 1044 } |
1045 | 1045 |
1046 if (bounds.width() < 2 || bounds.height() < 2) { | 1046 if (bounds.width() < 2 || bounds.height() < 2) { |
1047 return false; | 1047 return false; |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1615 | 1615 |
1616 builder->fsCodeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 1616 builder->fsCodeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
1617 } | 1617 } |
1618 | 1618 |
1619 #endif | 1619 #endif |
1620 | 1620 |
1621 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 1621 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
1622 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 1622 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
1623 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 1623 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
1624 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1624 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |