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

Side by Side Diff: src/core/SkDraw.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 "SkDraw.h" 8 #include "SkDraw.h"
9 #include "SkBlitter.h" 9 #include "SkBlitter.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 873
874 void SkDraw::drawDevMask(const SkMask& srcM, const SkPaint& paint) const { 874 void SkDraw::drawDevMask(const SkMask& srcM, const SkPaint& paint) const {
875 if (srcM.fBounds.isEmpty()) { 875 if (srcM.fBounds.isEmpty()) {
876 return; 876 return;
877 } 877 }
878 878
879 const SkMask* mask = &srcM; 879 const SkMask* mask = &srcM;
880 880
881 SkMask dstM; 881 SkMask dstM;
882 if (paint.getMaskFilter() && 882 if (paint.getMaskFilter() &&
883 paint.getMaskFilter()->filterMask(&dstM, srcM, *fMatrix, NULL)) { 883 paint.getMaskFilter()->filterMask(&dstM, srcM, *fMatrix, NULL, NULL) ) {
884 mask = &dstM; 884 mask = &dstM;
885 } else { 885 } else {
886 dstM.fImage = NULL; 886 dstM.fImage = NULL;
887 } 887 }
888 SkAutoMaskFreeImage ami(dstM.fImage); 888 SkAutoMaskFreeImage ami(dstM.fImage);
889 889
890 SkAutoBlitterChoose blitterChooser(*fBitmap, *fMatrix, paint); 890 SkAutoBlitterChoose blitterChooser(*fBitmap, *fMatrix, paint);
891 SkBlitter* blitter = blitterChooser.get(); 891 SkBlitter* blitter = blitterChooser.get();
892 892
893 SkAAClipBlitterWrapper wrapper; 893 SkAAClipBlitterWrapper wrapper;
(...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after
2299 2299
2300 SkIPoint margin = SkIPoint::Make(0, 0); 2300 SkIPoint margin = SkIPoint::Make(0, 0);
2301 if (filter) { 2301 if (filter) {
2302 SkASSERT(filterMatrix); 2302 SkASSERT(filterMatrix);
2303 2303
2304 SkMask srcM, dstM; 2304 SkMask srcM, dstM;
2305 2305
2306 srcM.fBounds = *bounds; 2306 srcM.fBounds = *bounds;
2307 srcM.fFormat = SkMask::kA8_Format; 2307 srcM.fFormat = SkMask::kA8_Format;
2308 srcM.fImage = NULL; 2308 srcM.fImage = NULL;
2309 if (!filter->filterMask(&dstM, srcM, *filterMatrix, &margin)) { 2309 if (!filter->filterMask(&dstM, srcM, *filterMatrix, &margin, NULL)) {
2310 return false; 2310 return false;
2311 } 2311 }
2312 } 2312 }
2313 2313
2314 // (possibly) trim the bounds to reflect the clip 2314 // (possibly) trim the bounds to reflect the clip
2315 // (plus whatever slop the filter needs) 2315 // (plus whatever slop the filter needs)
2316 if (clipBounds) { 2316 if (clipBounds) {
2317 SkIRect tmp = *clipBounds; 2317 SkIRect tmp = *clipBounds;
2318 // Ugh. Guard against gigantic margins from wacky filters. Without this 2318 // Ugh. Guard against gigantic margins from wacky filters. Without this
2319 // check we can request arbitrary amounts of slop beyond our visible 2319 // check we can request arbitrary amounts of slop beyond our visible
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2376 mask->fImage = SkMask::AllocImage(size); 2376 mask->fImage = SkMask::AllocImage(size);
2377 memset(mask->fImage, 0, mask->computeImageSize()); 2377 memset(mask->fImage, 0, mask->computeImageSize());
2378 } 2378 }
2379 2379
2380 if (SkMask::kJustComputeBounds_CreateMode != mode) { 2380 if (SkMask::kJustComputeBounds_CreateMode != mode) {
2381 draw_into_mask(*mask, devPath, style); 2381 draw_into_mask(*mask, devPath, style);
2382 } 2382 }
2383 2383
2384 return true; 2384 return true;
2385 } 2385 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698