Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: src/effects/SkLightingImageFilter.cpp

Issue 196353021: Revert "Implement support for expanding crop rects in image filters" (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/effects/SkDropShadowImageFilter.cpp ('k') | src/effects/SkMatrixConvolutionImageFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
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() != kPMColor_SkColorType) { 946 if (src.colorType() != kPMColor_SkColorType) {
947 return false; 947 return false;
948 } 948 }
949 SkAutoLockPixels alp(src);
950 if (!src.getPixels()) {
951 return false;
952 }
953
949 SkIRect bounds; 954 SkIRect bounds;
950 if (!this->applyCropRect(ctx, proxy, src, &srcOffset, &bounds, &src)) { 955 src.getBounds(&bounds);
956 bounds.offset(srcOffset);
957 if (!this->applyCropRect(&bounds, ctx.ctm())) {
951 return false; 958 return false;
952 } 959 }
953 960
954 if (bounds.width() < 2 || bounds.height() < 2) { 961 if (bounds.width() < 2 || bounds.height() < 2) {
955 return false; 962 return false;
956 } 963 }
957 964
958 SkAutoLockPixels alp(src);
959 if (!src.getPixels()) {
960 return false;
961 }
962
963 dst->setConfig(src.config(), bounds.width(), bounds.height()); 965 dst->setConfig(src.config(), bounds.width(), bounds.height());
964 if (!dst->allocPixels()) { 966 if (!dst->allocPixels()) {
965 return false; 967 return false;
966 } 968 }
967 969
968 SkAutoTUnref<SkLight> transformedLight(light()->transform(ctx.ctm())); 970 SkAutoTUnref<SkLight> transformedLight(light()->transform(ctx.ctm()));
969 971
970 DiffuseLightingType lightingType(fKD); 972 DiffuseLightingType lightingType(fKD);
971 offset->fX = bounds.left(); 973 offset->fX = bounds.left();
972 offset->fY = bounds.top(); 974 offset->fY = bounds.top();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 SkImageFilter* input = getInput(0); 1032 SkImageFilter* input = getInput(0);
1031 SkBitmap src = source; 1033 SkBitmap src = source;
1032 SkIPoint srcOffset = SkIPoint::Make(0, 0); 1034 SkIPoint srcOffset = SkIPoint::Make(0, 0);
1033 if (input && !input->filterImage(proxy, source, ctx, &src, &srcOffset)) { 1035 if (input && !input->filterImage(proxy, source, ctx, &src, &srcOffset)) {
1034 return false; 1036 return false;
1035 } 1037 }
1036 1038
1037 if (src.colorType() != kPMColor_SkColorType) { 1039 if (src.colorType() != kPMColor_SkColorType) {
1038 return false; 1040 return false;
1039 } 1041 }
1042 SkAutoLockPixels alp(src);
1043 if (!src.getPixels()) {
1044 return false;
1045 }
1040 1046
1041 SkIRect bounds; 1047 SkIRect bounds;
1042 if (!this->applyCropRect(ctx, proxy, src, &srcOffset, &bounds, &src)) { 1048 src.getBounds(&bounds);
1049 bounds.offset(srcOffset);
1050 if (!this->applyCropRect(&bounds, ctx.ctm())) {
1043 return false; 1051 return false;
1044 } 1052 }
1045 1053
1046 if (bounds.width() < 2 || bounds.height() < 2) { 1054 if (bounds.width() < 2 || bounds.height() < 2) {
1047 return false; 1055 return false;
1048 } 1056 }
1049 1057
1050 SkAutoLockPixels alp(src);
1051 if (!src.getPixels()) {
1052 return false;
1053 }
1054
1055 dst->setConfig(src.config(), bounds.width(), bounds.height()); 1058 dst->setConfig(src.config(), bounds.width(), bounds.height());
1056 dst->allocPixels(); 1059 dst->allocPixels();
1057 if (!dst->getPixels()) { 1060 if (!dst->getPixels()) {
1058 return false; 1061 return false;
1059 } 1062 }
1060 1063
1061 SpecularLightingType lightingType(fKS, fShininess); 1064 SpecularLightingType lightingType(fKS, fShininess);
1062 offset->fX = bounds.left(); 1065 offset->fX = bounds.left();
1063 offset->fY = bounds.top(); 1066 offset->fY = bounds.top();
1064 bounds.offset(-srcOffset); 1067 bounds.offset(-srcOffset);
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 1618
1616 builder->fsCodeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); 1619 builder->fsCodeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight);
1617 } 1620 }
1618 1621
1619 #endif 1622 #endif
1620 1623
1621 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) 1624 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter)
1622 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) 1625 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter)
1623 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) 1626 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter)
1624 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1627 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/effects/SkDropShadowImageFilter.cpp ('k') | src/effects/SkMatrixConvolutionImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698