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

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

Issue 104853005: Accept displacement with no displacement input (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update to ToT Created 7 years 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 | « gm/displacement.cpp ('k') | no next file » | 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 2013 Google Inc. 2 * Copyright 2013 Google Inc.
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 "SkDisplacementMapEffect.h" 8 #include "SkDisplacementMapEffect.h"
9 #include "SkFlattenableBuffers.h" 9 #include "SkFlattenableBuffers.h"
10 #include "SkUnPreMultiply.h" 10 #include "SkUnPreMultiply.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 buffer.writeInt((int) fXChannelSelector); 176 buffer.writeInt((int) fXChannelSelector);
177 buffer.writeInt((int) fYChannelSelector); 177 buffer.writeInt((int) fYChannelSelector);
178 buffer.writeScalar(fScale); 178 buffer.writeScalar(fScale);
179 } 179 }
180 180
181 bool SkDisplacementMapEffect::onFilterImage(Proxy* proxy, 181 bool SkDisplacementMapEffect::onFilterImage(Proxy* proxy,
182 const SkBitmap& src, 182 const SkBitmap& src,
183 const SkMatrix& ctm, 183 const SkMatrix& ctm,
184 SkBitmap* dst, 184 SkBitmap* dst,
185 SkIPoint* offset) { 185 SkIPoint* offset) {
186 SkBitmap displ, color = src; 186 SkBitmap displ = src, color = src;
187 SkImageFilter* colorInput = getColorInput(); 187 SkImageFilter* colorInput = getColorInput();
188 SkImageFilter* displacementInput = getDisplacementInput(); 188 SkImageFilter* displacementInput = getDisplacementInput();
189 SkASSERT(NULL != displacementInput);
190 if ((colorInput && !colorInput->filterImage(proxy, src, ctm, &color, offset) ) || 189 if ((colorInput && !colorInput->filterImage(proxy, src, ctm, &color, offset) ) ||
191 !displacementInput || !displacementInput->filterImage(proxy, src, ctm, & displ, offset)) { 190 (displacementInput && !displacementInput->filterImage(proxy, src, ctm, & displ, offset))) {
192 return false; 191 return false;
193 } 192 }
194 if ((displ.config() != SkBitmap::kARGB_8888_Config) || 193 if ((displ.config() != SkBitmap::kARGB_8888_Config) ||
195 (color.config() != SkBitmap::kARGB_8888_Config)) { 194 (color.config() != SkBitmap::kARGB_8888_Config)) {
196 return false; 195 return false;
197 } 196 }
198 197
199 SkAutoLockPixels alp_displacement(displ), alp_color(color); 198 SkAutoLockPixels alp_displacement(displ), alp_color(color);
200 if (!displ.getPixels() || !color.getPixels()) { 199 if (!displ.getPixels() || !color.getPixels()) {
201 return false; 200 return false;
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 const GrGLCaps&) { 539 const GrGLCaps&) {
541 const GrDisplacementMapEffect& displacementMap = 540 const GrDisplacementMapEffect& displacementMap =
542 drawEffect.castEffect<GrDisplacementMapEffect>(); 541 drawEffect.castEffect<GrDisplacementMapEffect>();
543 542
544 EffectKey xKey = displacementMap.xChannelSelector(); 543 EffectKey xKey = displacementMap.xChannelSelector();
545 EffectKey yKey = displacementMap.yChannelSelector() << SkDisplacementMapEffe ct::kKeyBits; 544 EffectKey yKey = displacementMap.yChannelSelector() << SkDisplacementMapEffe ct::kKeyBits;
546 545
547 return xKey | yKey; 546 return xKey | yKey;
548 } 547 }
549 #endif 548 #endif
OLDNEW
« no previous file with comments | « gm/displacement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698