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

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

Issue 137423005: Implement a computeFastBounds() traversal for SkImageFilter. This allows for correct culling of pri… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix Win build; update to ToT Created 6 years, 10 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/SkDropShadowImageFilter.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 "SkFlattenableBuffers.h" 9 #include "SkFlattenableBuffers.h"
10 #include "SkUnPreMultiply.h" 10 #include "SkUnPreMultiply.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 colorBounds.offset(-colorOffset); 239 colorBounds.offset(-colorOffset);
240 240
241 computeDisplacement(fXChannelSelector, fYChannelSelector, scale, dst, 241 computeDisplacement(fXChannelSelector, fYChannelSelector, scale, dst,
242 &displ, colorOffset - displOffset, &color, colorBounds); 242 &displ, colorOffset - displOffset, &color, colorBounds);
243 243
244 offset->fX = bounds.left(); 244 offset->fX = bounds.left();
245 offset->fY = bounds.top(); 245 offset->fY = bounds.top();
246 return true; 246 return true;
247 } 247 }
248 248
249 void SkDisplacementMapEffect::computeFastBounds(const SkRect& src, SkRect* dst) const {
250 if (getColorInput()) {
251 getColorInput()->computeFastBounds(src, dst);
252 } else {
253 *dst = src;
254 }
255 }
256
249 /////////////////////////////////////////////////////////////////////////////// 257 ///////////////////////////////////////////////////////////////////////////////
250 258
251 #if SK_SUPPORT_GPU 259 #if SK_SUPPORT_GPU
252 class GrGLDisplacementMapEffect : public GrGLEffect { 260 class GrGLDisplacementMapEffect : public GrGLEffect {
253 public: 261 public:
254 GrGLDisplacementMapEffect(const GrBackendEffectFactory& factory, 262 GrGLDisplacementMapEffect(const GrBackendEffectFactory& factory,
255 const GrDrawEffect& drawEffect); 263 const GrDrawEffect& drawEffect);
256 virtual ~GrGLDisplacementMapEffect(); 264 virtual ~GrGLDisplacementMapEffect();
257 265
258 virtual void emitCode(GrGLShaderBuilder*, 266 virtual void emitCode(GrGLShaderBuilder*,
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 const GrGLCaps&) { 589 const GrGLCaps&) {
582 const GrDisplacementMapEffect& displacementMap = 590 const GrDisplacementMapEffect& displacementMap =
583 drawEffect.castEffect<GrDisplacementMapEffect>(); 591 drawEffect.castEffect<GrDisplacementMapEffect>();
584 592
585 EffectKey xKey = displacementMap.xChannelSelector(); 593 EffectKey xKey = displacementMap.xChannelSelector();
586 EffectKey yKey = displacementMap.yChannelSelector() << SkDisplacementMapEffe ct::kKeyBits; 594 EffectKey yKey = displacementMap.yChannelSelector() << SkDisplacementMapEffe ct::kKeyBits;
587 595
588 return xKey | yKey; 596 return xKey | yKey;
589 } 597 }
590 #endif 598 #endif
OLDNEW
« no previous file with comments | « src/effects/SkBlurImageFilter.cpp ('k') | src/effects/SkDropShadowImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698