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

Side by Side Diff: gm/blurrect.cpp

Issue 471473002: Optimize CSS box-shadow performance (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: backed blur mask with a bitmap Created 6 years, 3 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 2012 Google Inc. 2 * Copyright 2012 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 "gm.h" 8 #include "gm.h"
9 #include "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkBlurMaskFilter.h" 10 #include "SkBlurMaskFilter.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 SkAutoCanvasRestore autoRestore(canvas, true); 184 SkAutoCanvasRestore autoRestore(canvas, true);
185 185
186 for (size_t j = 0 ; j < SK_ARRAY_COUNT(radii) ; j++) { 186 for (size_t j = 0 ; j < SK_ARRAY_COUNT(radii) ; j++) {
187 float radius = radii[j]; 187 float radius = radii[j];
188 for (size_t k = 0 ; k < SK_ARRAY_COUNT(styles) ; k++) { 188 for (size_t k = 0 ; k < SK_ARRAY_COUNT(styles) ; k++) {
189 SkBlurStyle style = styles[k]; 189 SkBlurStyle style = styles[k];
190 190
191 SkMask mask; 191 SkMask mask;
192 SkBlurMask::BlurRect(SkBlurMask::ConvertRadiusToSigma(radius ), &mask, r, style); 192 SkBlurMask::BlurRect(SkBlurMask::ConvertRadiusToSigma(radius ), &mask, r, style);
193 193
194 SkAutoMaskFreeImage amfi(mask.fImage);
195
196 SkBitmap bm; 194 SkBitmap bm;
197 bm.installMaskPixels(mask); 195 bm.installMaskPixels(mask);
198 196
199 if (cur_x + bm.width() >= fGMWidth - fMargin) { 197 if (cur_x + bm.width() >= fGMWidth - fMargin) {
200 cur_x = 0; 198 cur_x = 0;
201 cur_y += max_height + fPadding; 199 cur_y += max_height + fPadding;
202 max_height = 0; 200 max_height = 0;
203 } 201 }
204 202
205 canvas->save(); 203 canvas->save();
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 } 383 }
386 private: 384 private:
387 typedef BlurRectCompareGM INHERITED; 385 typedef BlurRectCompareGM INHERITED;
388 }; 386 };
389 387
390 388
391 ////////////////////////////////////////////////////////////////////////////// 389 //////////////////////////////////////////////////////////////////////////////
392 390
393 DEF_GM(return new BlurRectGM("blurrects", 0xFF);) 391 DEF_GM(return new BlurRectGM("blurrects", 0xFF);)
394 DEF_GM(return new BlurRectDirectGM("blurrect_gallery");) 392 DEF_GM(return new BlurRectDirectGM("blurrect_gallery");)
OLDNEW
« no previous file with comments | « bench/BlurRectBench.cpp ('k') | gyp/core.gypi » ('j') | src/core/SkBitmapCache.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698