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

Side by Side Diff: src/effects/SkDropShadowImageFilter.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/SkDisplacementMapEffect.cpp ('k') | src/effects/SkMorphologyImageFilter.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 "SkDropShadowImageFilter.h" 8 #include "SkDropShadowImageFilter.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 SkVector offsetVec, localOffsetVec = SkVector::Make(fDx, fDy); 88 SkVector offsetVec, localOffsetVec = SkVector::Make(fDx, fDy);
89 matrix.mapVectors(&offsetVec, &localOffsetVec, 1); 89 matrix.mapVectors(&offsetVec, &localOffsetVec, 1);
90 canvas.translate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop)); 90 canvas.translate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop));
91 canvas.drawBitmap(src, offsetVec.fX, offsetVec.fY, &paint); 91 canvas.drawBitmap(src, offsetVec.fX, offsetVec.fY, &paint);
92 canvas.drawBitmap(src, 0, 0); 92 canvas.drawBitmap(src, 0, 0);
93 *result = device->accessBitmap(false); 93 *result = device->accessBitmap(false);
94 offset->fX = bounds.fLeft; 94 offset->fX = bounds.fLeft;
95 offset->fY = bounds.fTop; 95 offset->fY = bounds.fTop;
96 return true; 96 return true;
97 } 97 }
98
99 void SkDropShadowImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) const {
100 if (getInput(0)) {
101 getInput(0)->computeFastBounds(src, dst);
102 } else {
103 *dst = src;
104 }
105
106 SkRect shadowBounds = *dst;
107 shadowBounds.offset(fDx, fDy);
108 shadowBounds.outset(SkScalarMul(fSigmaX, SkIntToScalar(3)),
109 SkScalarMul(fSigmaY, SkIntToScalar(3)));
110 dst->join(shadowBounds);
111 }
112
OLDNEW
« no previous file with comments | « src/effects/SkDisplacementMapEffect.cpp ('k') | src/effects/SkMorphologyImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698