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

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

Issue 471473002: Optimize CSS box-shadow performance (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: store SkMask and SkCachedData in cache Created 6 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 "SkEmbossMaskFilter.h" 8 #include "SkEmbossMaskFilter.h"
9 #include "SkBlurMaskFilter.h" 9 #include "SkBlurMaskFilter.h"
10 #include "SkBlurMask.h" 10 #include "SkBlurMask.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 SkEmbossMaskFilter::SkEmbossMaskFilter(SkScalar blurSigma, const Light& light) 68 SkEmbossMaskFilter::SkEmbossMaskFilter(SkScalar blurSigma, const Light& light)
69 : fLight(light), fBlurSigma(blurSigma) { 69 : fLight(light), fBlurSigma(blurSigma) {
70 normalize(fLight.fDirection); 70 normalize(fLight.fDirection);
71 } 71 }
72 72
73 SkMask::Format SkEmbossMaskFilter::getFormat() const { 73 SkMask::Format SkEmbossMaskFilter::getFormat() const {
74 return SkMask::k3D_Format; 74 return SkMask::k3D_Format;
75 } 75 }
76 76
77 bool SkEmbossMaskFilter::filterMask(SkMask* dst, const SkMask& src, 77 bool SkEmbossMaskFilter::filterMask(SkMask* dst, const SkMask& src,
78 const SkMatrix& matrix, SkIPoint* margin) co nst { 78 const SkMatrix& matrix, SkIPoint* margin, Sk CachedData** data) const {
79 SkScalar sigma = matrix.mapRadius(fBlurSigma); 79 SkScalar sigma = matrix.mapRadius(fBlurSigma);
80 80
81 if (!SkBlurMask::BoxBlur(dst, src, sigma, kInner_SkBlurStyle, kLow_SkBlurQua lity)) { 81 if (!SkBlurMask::BoxBlur(dst, NULL, src, sigma, kInner_SkBlurStyle, kLow_SkB lurQuality)) {
82 return false; 82 return false;
83 } 83 }
84 84
85 dst->fFormat = SkMask::k3D_Format; 85 dst->fFormat = SkMask::k3D_Format;
86 if (margin) { 86 if (margin) {
87 margin->set(SkScalarCeilToInt(3*sigma), SkScalarCeilToInt(3*sigma)); 87 margin->set(SkScalarCeilToInt(3*sigma), SkScalarCeilToInt(3*sigma));
88 } 88 }
89 89
90 if (src.fImage == NULL) { 90 if (src.fImage == NULL) {
91 return true; 91 return true;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 str->append(") "); 163 str->append(") ");
164 164
165 str->appendf("ambient: %d specular: %d ", 165 str->appendf("ambient: %d specular: %d ",
166 fLight.fAmbient, fLight.fSpecular); 166 fLight.fAmbient, fLight.fSpecular);
167 167
168 str->append("blurSigma: "); 168 str->append("blurSigma: ");
169 str->appendScalar(fBlurSigma); 169 str->appendScalar(fBlurSigma);
170 str->append(")"); 170 str->append(")");
171 } 171 }
172 #endif 172 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698