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

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

Issue 305133006: use colortype instead of config (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 6 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/SkBlurImageFilter.cpp ('k') | src/effects/SkLightingImageFilter.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 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 "SkReadBuffer.h" 9 #include "SkReadBuffer.h"
10 #include "SkWriteBuffer.h" 10 #include "SkWriteBuffer.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 return false; 220 return false;
221 } 221 }
222 if (!bounds.intersect(displBounds)) { 222 if (!bounds.intersect(displBounds)) {
223 return false; 223 return false;
224 } 224 }
225 SkAutoLockPixels alp_displacement(displ), alp_color(color); 225 SkAutoLockPixels alp_displacement(displ), alp_color(color);
226 if (!displ.getPixels() || !color.getPixels()) { 226 if (!displ.getPixels() || !color.getPixels()) {
227 return false; 227 return false;
228 } 228 }
229 229
230 dst->setConfig(color.config(), bounds.width(), bounds.height()); 230 if (!dst->allocPixels(color.info().makeWH(bounds.width(), bounds.height()))) {
231 if (!dst->allocPixels()) {
232 return false; 231 return false;
233 } 232 }
234 233
235 SkVector scale = SkVector::Make(fScale, fScale); 234 SkVector scale = SkVector::Make(fScale, fScale);
236 ctx.ctm().mapVectors(&scale, 1); 235 ctx.ctm().mapVectors(&scale, 1);
237 SkIRect colorBounds = bounds; 236 SkIRect colorBounds = bounds;
238 colorBounds.offset(-colorOffset); 237 colorBounds.offset(-colorOffset);
239 238
240 computeDisplacement(fXChannelSelector, fYChannelSelector, scale, dst, 239 computeDisplacement(fXChannelSelector, fYChannelSelector, scale, dst,
241 &displ, colorOffset - displOffset, &color, colorBounds); 240 &displ, colorOffset - displOffset, &color, colorBounds);
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 const GrGLCaps&) { 605 const GrGLCaps&) {
607 const GrDisplacementMapEffect& displacementMap = 606 const GrDisplacementMapEffect& displacementMap =
608 drawEffect.castEffect<GrDisplacementMapEffect>(); 607 drawEffect.castEffect<GrDisplacementMapEffect>();
609 608
610 EffectKey xKey = displacementMap.xChannelSelector(); 609 EffectKey xKey = displacementMap.xChannelSelector();
611 EffectKey yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBi ts; 610 EffectKey yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBi ts;
612 611
613 return xKey | yKey; 612 return xKey | yKey;
614 } 613 }
615 #endif 614 #endif
OLDNEW
« no previous file with comments | « src/effects/SkBlurImageFilter.cpp ('k') | src/effects/SkLightingImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698