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

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

Issue 1820303002: Revert of switch colorfilters to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « src/effects/SkColorMatrixFilter.cpp ('k') | src/effects/SkLayerDrawLooper.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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 if (nullptr == device.get()) { 72 if (nullptr == device.get()) {
73 return false; 73 return false;
74 } 74 }
75 SkCanvas canvas(device.get()); 75 SkCanvas canvas(device.get());
76 76
77 SkVector sigma = SkVector::Make(fSigmaX, fSigmaY); 77 SkVector sigma = SkVector::Make(fSigmaX, fSigmaY);
78 ctx.ctm().mapVectors(&sigma, 1); 78 ctx.ctm().mapVectors(&sigma, 1);
79 sigma.fX = SkMaxScalar(0, sigma.fX); 79 sigma.fX = SkMaxScalar(0, sigma.fX);
80 sigma.fY = SkMaxScalar(0, sigma.fY); 80 sigma.fY = SkMaxScalar(0, sigma.fY);
81 SkAutoTUnref<SkImageFilter> blurFilter(SkBlurImageFilter::Create(sigma.fX, s igma.fY)); 81 SkAutoTUnref<SkImageFilter> blurFilter(SkBlurImageFilter::Create(sigma.fX, s igma.fY));
82 SkAutoTUnref<SkColorFilter> colorFilter(
83 SkColorFilter::CreateModeFilter(fColor, SkXfermode::kSrcIn_Mode));
82 SkPaint paint; 84 SkPaint paint;
83 paint.setImageFilter(blurFilter.get()); 85 paint.setImageFilter(blurFilter.get());
84 paint.setColorFilter(SkColorFilter::MakeModeFilter(fColor, SkXfermode::kSrcI n_Mode)); 86 paint.setColorFilter(colorFilter.get());
85 paint.setXfermodeMode(SkXfermode::kSrcOver_Mode); 87 paint.setXfermodeMode(SkXfermode::kSrcOver_Mode);
86 SkVector offsetVec = SkVector::Make(fDx, fDy); 88 SkVector offsetVec = SkVector::Make(fDx, fDy);
87 ctx.ctm().mapVectors(&offsetVec, 1); 89 ctx.ctm().mapVectors(&offsetVec, 1);
88 canvas.translate(SkIntToScalar(srcOffset.fX - bounds.fLeft), 90 canvas.translate(SkIntToScalar(srcOffset.fX - bounds.fLeft),
89 SkIntToScalar(srcOffset.fY - bounds.fTop)); 91 SkIntToScalar(srcOffset.fY - bounds.fTop));
90 canvas.drawBitmap(src, offsetVec.fX, offsetVec.fY, &paint); 92 canvas.drawBitmap(src, offsetVec.fX, offsetVec.fY, &paint);
91 if (fShadowMode == kDrawShadowAndForeground_ShadowMode) { 93 if (fShadowMode == kDrawShadowAndForeground_ShadowMode) {
92 canvas.drawBitmap(src, 0, 0); 94 canvas.drawBitmap(src, 0, 0);
93 } 95 }
94 *result = device->accessBitmap(false); 96 *result = device->accessBitmap(false);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 "kDrawShadowAndForeground", "kDrawShadowOnly" 148 "kDrawShadowAndForeground", "kDrawShadowOnly"
147 }; 149 };
148 150
149 static_assert(kShadowModeCount == SK_ARRAY_COUNT(gModeStrings), "enum_mismat ch"); 151 static_assert(kShadowModeCount == SK_ARRAY_COUNT(gModeStrings), "enum_mismat ch");
150 152
151 str->appendf(" mode: %s", gModeStrings[fShadowMode]); 153 str->appendf(" mode: %s", gModeStrings[fShadowMode]);
152 154
153 str->append(")"); 155 str->append(")");
154 } 156 }
155 #endif 157 #endif
OLDNEW
« no previous file with comments | « src/effects/SkColorMatrixFilter.cpp ('k') | src/effects/SkLayerDrawLooper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698