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

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

Issue 1404743005: Image Filters: refactor all CPU input processing into a filterInput helper function. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Tweak comment Created 5 years, 2 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
« 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 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 void SkDiffuseLightingImageFilter::flatten(SkWriteBuffer& buffer) const { 1165 void SkDiffuseLightingImageFilter::flatten(SkWriteBuffer& buffer) const {
1166 this->INHERITED::flatten(buffer); 1166 this->INHERITED::flatten(buffer);
1167 buffer.writeScalar(fKD); 1167 buffer.writeScalar(fKD);
1168 } 1168 }
1169 1169
1170 bool SkDiffuseLightingImageFilter::onFilterImage(Proxy* proxy, 1170 bool SkDiffuseLightingImageFilter::onFilterImage(Proxy* proxy,
1171 const SkBitmap& source, 1171 const SkBitmap& source,
1172 const Context& ctx, 1172 const Context& ctx,
1173 SkBitmap* dst, 1173 SkBitmap* dst,
1174 SkIPoint* offset) const { 1174 SkIPoint* offset) const {
1175 SkImageFilter* input = getInput(0);
1176 SkBitmap src = source; 1175 SkBitmap src = source;
1177 SkIPoint srcOffset = SkIPoint::Make(0, 0); 1176 SkIPoint srcOffset = SkIPoint::Make(0, 0);
1178 if (input && !input->filterImage(proxy, source, ctx, &src, &srcOffset)) { 1177 if (!this->filterInput(0, proxy, source, ctx, &src, &srcOffset)) {
1179 return false; 1178 return false;
1180 } 1179 }
1181 1180
1182 if (src.colorType() != kN32_SkColorType) { 1181 if (src.colorType() != kN32_SkColorType) {
1183 return false; 1182 return false;
1184 } 1183 }
1185 SkIRect bounds; 1184 SkIRect bounds;
1186 if (!this->applyCropRect(ctx, proxy, src, &srcOffset, &bounds, &src)) { 1185 if (!this->applyCropRect(ctx, proxy, src, &srcOffset, &bounds, &src)) {
1187 return false; 1186 return false;
1188 } 1187 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 this->INHERITED::flatten(buffer); 1305 this->INHERITED::flatten(buffer);
1307 buffer.writeScalar(fKS); 1306 buffer.writeScalar(fKS);
1308 buffer.writeScalar(fShininess); 1307 buffer.writeScalar(fShininess);
1309 } 1308 }
1310 1309
1311 bool SkSpecularLightingImageFilter::onFilterImage(Proxy* proxy, 1310 bool SkSpecularLightingImageFilter::onFilterImage(Proxy* proxy,
1312 const SkBitmap& source, 1311 const SkBitmap& source,
1313 const Context& ctx, 1312 const Context& ctx,
1314 SkBitmap* dst, 1313 SkBitmap* dst,
1315 SkIPoint* offset) const { 1314 SkIPoint* offset) const {
1316 SkImageFilter* input = getInput(0);
1317 SkBitmap src = source; 1315 SkBitmap src = source;
1318 SkIPoint srcOffset = SkIPoint::Make(0, 0); 1316 SkIPoint srcOffset = SkIPoint::Make(0, 0);
1319 if (input && !input->filterImage(proxy, source, ctx, &src, &srcOffset)) { 1317 if (!this->filterInput(0, proxy, source, ctx, &src, &srcOffset)) {
1320 return false; 1318 return false;
1321 } 1319 }
1322 1320
1323 if (src.colorType() != kN32_SkColorType) { 1321 if (src.colorType() != kN32_SkColorType) {
1324 return false; 1322 return false;
1325 } 1323 }
1326 1324
1327 SkIRect bounds; 1325 SkIRect bounds;
1328 if (!this->applyCropRect(ctx, proxy, src, &srcOffset, &bounds, &src)) { 1326 if (!this->applyCropRect(ctx, proxy, src, &srcOffset, &bounds, &src)) {
1329 return false; 1327 return false;
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
2011 2009
2012 fsBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); 2010 fsBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight);
2013 } 2011 }
2014 2012
2015 #endif 2013 #endif
2016 2014
2017 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) 2015 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter)
2018 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) 2016 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter)
2019 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) 2017 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter)
2020 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 2018 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