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/SkDropShadowImageFilter.cpp

Issue 137053003: Apply the CTM to filter parameters for 4 pixel-moving filters. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fixed 100-col issues Created 6 years, 11 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 if (!this->applyCropRect(&bounds, matrix)) { 70 if (!this->applyCropRect(&bounds, matrix)) {
71 return false; 71 return false;
72 } 72 }
73 73
74 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds .height())); 74 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds .height()));
75 if (NULL == device.get()) { 75 if (NULL == device.get()) {
76 return false; 76 return false;
77 } 77 }
78 SkCanvas canvas(device.get()); 78 SkCanvas canvas(device.get());
79 79
80 SkAutoTUnref<SkImageFilter> blurFilter(new SkBlurImageFilter(fSigmaX, fSigma Y)); 80 SkVector sigma, localSigma = SkVector::Make(fSigmaX, fSigmaY);
81 matrix.mapVectors(&sigma, &localSigma, 1);
82 SkAutoTUnref<SkImageFilter> blurFilter(new SkBlurImageFilter(sigma.fX, sigma .fY));
81 SkAutoTUnref<SkColorFilter> colorFilter(SkColorFilter::CreateModeFilter(fCol or, SkXfermode::kSrcIn_Mode)); 83 SkAutoTUnref<SkColorFilter> colorFilter(SkColorFilter::CreateModeFilter(fCol or, SkXfermode::kSrcIn_Mode));
82 SkPaint paint; 84 SkPaint paint;
83 paint.setImageFilter(blurFilter.get()); 85 paint.setImageFilter(blurFilter.get());
84 paint.setColorFilter(colorFilter.get()); 86 paint.setColorFilter(colorFilter.get());
85 paint.setXfermodeMode(SkXfermode::kSrcOver_Mode); 87 paint.setXfermodeMode(SkXfermode::kSrcOver_Mode);
88 SkVector offsetVec, localOffsetVec = SkVector::Make(fDx, fDy);
89 matrix.mapVectors(&offsetVec, &localOffsetVec, 1);
86 canvas.translate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop)); 90 canvas.translate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop));
87 canvas.drawBitmap(src, fDx, fDy, &paint); 91 canvas.drawBitmap(src, offsetVec.fX, offsetVec.fY, &paint);
88 canvas.drawBitmap(src, 0, 0); 92 canvas.drawBitmap(src, 0, 0);
89 *result = device->accessBitmap(false); 93 *result = device->accessBitmap(false);
90 offset->fX = bounds.fLeft; 94 offset->fX = bounds.fLeft;
91 offset->fY = bounds.fTop; 95 offset->fY = bounds.fTop;
92 return true; 96 return true;
93 } 97 }
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