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

Side by Side Diff: src/effects/SkBlurMaskFilter.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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkBlurMaskFilter.h" 9 #include "SkBlurMaskFilter.h"
10 #include "SkBlurMask.h" 10 #include "SkBlurMask.h"
11 #include "SkGpuBlurUtils.h" 11 #include "SkGpuBlurUtils.h"
12 #include "SkReadBuffer.h" 12 #include "SkReadBuffer.h"
13 #include "SkWriteBuffer.h" 13 #include "SkWriteBuffer.h"
14 #include "SkMaskCache.h"
14 #include "SkMaskFilter.h" 15 #include "SkMaskFilter.h"
15 #include "SkRRect.h" 16 #include "SkRRect.h"
16 #include "SkRTConf.h" 17 #include "SkRTConf.h"
17 #include "SkStringUtils.h" 18 #include "SkStringUtils.h"
18 #include "SkStrokeRec.h" 19 #include "SkStrokeRec.h"
19 20
20 #if SK_SUPPORT_GPU 21 #if SK_SUPPORT_GPU
21 #include "GrContext.h" 22 #include "GrContext.h"
22 #include "GrTexture.h" 23 #include "GrTexture.h"
23 #include "GrProcessor.h" 24 #include "GrProcessor.h"
24 #include "gl/GrGLProcessor.h" 25 #include "gl/GrGLProcessor.h"
25 #include "gl/builders/GrGLProgramBuilder.h" 26 #include "gl/builders/GrGLProgramBuilder.h"
26 #include "effects/GrSimpleTextureEffect.h" 27 #include "effects/GrSimpleTextureEffect.h"
27 #include "GrTBackendProcessorFactory.h" 28 #include "GrTBackendProcessorFactory.h"
28 #include "SkGrPixelRef.h" 29 #include "SkGrPixelRef.h"
29 #include "SkDraw.h" 30 #include "SkDraw.h"
30 #endif 31 #endif
31 32
32 SkScalar SkBlurMaskFilter::ConvertRadiusToSigma(SkScalar radius) { 33 SkScalar SkBlurMaskFilter::ConvertRadiusToSigma(SkScalar radius) {
33 return SkBlurMask::ConvertRadiusToSigma(radius); 34 return SkBlurMask::ConvertRadiusToSigma(radius);
34 } 35 }
35 36
36 class SkBlurMaskFilterImpl : public SkMaskFilter { 37 class SkBlurMaskFilterImpl : public SkMaskFilter {
37 public: 38 public:
38 SkBlurMaskFilterImpl(SkScalar sigma, SkBlurStyle, uint32_t flags); 39 SkBlurMaskFilterImpl(SkScalar sigma, SkBlurStyle, uint32_t flags);
39 40
40 // overrides from SkMaskFilter 41 // overrides from SkMaskFilter
41 virtual SkMask::Format getFormat() const SK_OVERRIDE; 42 virtual SkMask::Format getFormat() const SK_OVERRIDE;
42 virtual bool filterMask(SkMask* dst, const SkMask& src, const SkMatrix&, 43 virtual bool filterMask(SkMask* dst, const SkMask& src, const SkMatrix&,
43 SkIPoint* margin) const SK_OVERRIDE; 44 SkIPoint* margin, SkCachedData** data) const SK_OVER RIDE;
44 45
45 #if SK_SUPPORT_GPU 46 #if SK_SUPPORT_GPU
46 virtual bool canFilterMaskGPU(const SkRect& devBounds, 47 virtual bool canFilterMaskGPU(const SkRect& devBounds,
47 const SkIRect& clipBounds, 48 const SkIRect& clipBounds,
48 const SkMatrix& ctm, 49 const SkMatrix& ctm,
49 SkRect* maskRect) const SK_OVERRIDE; 50 SkRect* maskRect) const SK_OVERRIDE;
50 virtual bool directFilterMaskGPU(GrContext* context, 51 virtual bool directFilterMaskGPU(GrContext* context,
51 GrPaint* grp, 52 GrPaint* grp,
52 const SkStrokeRec& strokeRec, 53 const SkStrokeRec& strokeRec,
53 const SkPath& path) const SK_OVERRIDE; 54 const SkPath& path) const SK_OVERRIDE;
(...skipping 18 matching lines...) Expand all
72 protected: 73 protected:
73 virtual FilterReturn filterRectsToNine(const SkRect[], int count, const SkMa trix&, 74 virtual FilterReturn filterRectsToNine(const SkRect[], int count, const SkMa trix&,
74 const SkIRect& clipBounds, 75 const SkIRect& clipBounds,
75 NinePatch*) const SK_OVERRIDE; 76 NinePatch*) const SK_OVERRIDE;
76 77
77 virtual FilterReturn filterRRectToNine(const SkRRect&, const SkMatrix&, 78 virtual FilterReturn filterRRectToNine(const SkRRect&, const SkMatrix&,
78 const SkIRect& clipBounds, 79 const SkIRect& clipBounds,
79 NinePatch*) const SK_OVERRIDE; 80 NinePatch*) const SK_OVERRIDE;
80 81
81 bool filterRectMask(SkMask* dstM, const SkRect& r, const SkMatrix& matrix, 82 bool filterRectMask(SkMask* dstM, const SkRect& r, const SkMatrix& matrix,
82 SkIPoint* margin, SkMask::CreateMode createMode) const; 83 SkIPoint* margin, SkMask::CreateMode createMode, SkCache dData** data) const;
83 bool filterRRectMask(SkMask* dstM, const SkRRect& r, const SkMatrix& matrix, 84 bool filterRRectMask(SkMask* dstM, const SkRRect& r, const SkMatrix& matrix,
84 SkIPoint* margin, SkMask::CreateMode createMode) const; 85 SkIPoint* margin, SkMask::CreateMode createMode, SkCache dData** data) const;
85 86
86 private: 87 private:
87 // To avoid unseemly allocation requests (esp. for finite platforms like 88 // To avoid unseemly allocation requests (esp. for finite platforms like
88 // handset) we limit the radius so something manageable. (as opposed to 89 // handset) we limit the radius so something manageable. (as opposed to
89 // a request like 10,000) 90 // a request like 10,000)
90 static const SkScalar kMAX_BLUR_SIGMA; 91 static const SkScalar kMAX_BLUR_SIGMA;
91 92
92 SkScalar fSigma; 93 SkScalar fSigma;
93 SkBlurStyle fBlurStyle; 94 SkBlurStyle fBlurStyle;
94 uint32_t fBlurFlags; 95 uint32_t fBlurFlags;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 if (rec) { 152 if (rec) {
152 rec->fSigma = fSigma; 153 rec->fSigma = fSigma;
153 rec->fStyle = fBlurStyle; 154 rec->fStyle = fBlurStyle;
154 rec->fQuality = this->getQuality(); 155 rec->fQuality = this->getQuality();
155 } 156 }
156 return true; 157 return true;
157 } 158 }
158 159
159 bool SkBlurMaskFilterImpl::filterMask(SkMask* dst, const SkMask& src, 160 bool SkBlurMaskFilterImpl::filterMask(SkMask* dst, const SkMask& src,
160 const SkMatrix& matrix, 161 const SkMatrix& matrix,
161 SkIPoint* margin) const{ 162 SkIPoint* margin, SkCachedData** data) con st{
162 SkScalar sigma = this->computeXformedSigma(matrix); 163 SkScalar sigma = this->computeXformedSigma(matrix);
163 return SkBlurMask::BoxBlur(dst, src, sigma, fBlurStyle, this->getQuality(), margin); 164 return SkBlurMask::BoxBlur(dst, data, src, sigma, fBlurStyle, this->getQuali ty(), margin);
164 } 165 }
165 166
166 bool SkBlurMaskFilterImpl::filterRectMask(SkMask* dst, const SkRect& r, 167 bool SkBlurMaskFilterImpl::filterRectMask(SkMask* dst, const SkRect& r,
167 const SkMatrix& matrix, 168 const SkMatrix& matrix,
168 SkIPoint* margin, SkMask::CreateMode c reateMode) const{ 169 SkIPoint* margin, SkMask::CreateMode c reateMode, SkCachedData** data) const{
169 SkScalar sigma = computeXformedSigma(matrix); 170 SkScalar sigma = computeXformedSigma(matrix);
170 171
171 return SkBlurMask::BlurRect(sigma, dst, r, fBlurStyle, 172 return SkBlurMask::BlurRect(sigma, dst, data, r, fBlurStyle,
172 margin, createMode); 173 margin, createMode);
173 } 174 }
174 175
175 bool SkBlurMaskFilterImpl::filterRRectMask(SkMask* dst, const SkRRect& r, 176 bool SkBlurMaskFilterImpl::filterRRectMask(SkMask* dst, const SkRRect& r,
176 const SkMatrix& matrix, 177 const SkMatrix& matrix,
177 SkIPoint* margin, SkMask::CreateMode c reateMode) const{ 178 SkIPoint* margin, SkMask::CreateMode c reateMode, SkCachedData** data) const{
178 SkScalar sigma = computeXformedSigma(matrix); 179 SkScalar sigma = computeXformedSigma(matrix);
179 180
180 return SkBlurMask::BlurRRect(sigma, dst, r, fBlurStyle, 181 return SkBlurMask::BlurRRect(sigma, dst, data, r, fBlurStyle,
181 margin, createMode); 182 margin, createMode);
182 } 183 }
183 184
184 #include "SkCanvas.h" 185 #include "SkCanvas.h"
185 186
186 static bool prepare_to_draw_into_mask(const SkRect& bounds, SkMask* mask) { 187 static bool prepare_to_draw_into_mask(const SkRect& bounds, SkMask* mask) {
187 SkASSERT(mask != NULL); 188 SkASSERT(mask != NULL);
188 189
189 bounds.roundOut(&mask->fBounds); 190 bounds.roundOut(&mask->fBounds);
190 mask->fRowBytes = SkAlign4(mask->fBounds.width()); 191 mask->fRowBytes = SkAlign4(mask->fBounds.width());
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 rrect.rect().roundOut(&srcM.fBounds); 311 rrect.rect().roundOut(&srcM.fBounds);
311 srcM.fImage = NULL; 312 srcM.fImage = NULL;
312 srcM.fFormat = SkMask::kA8_Format; 313 srcM.fFormat = SkMask::kA8_Format;
313 srcM.fRowBytes = 0; 314 srcM.fRowBytes = 0;
314 315
315 bool filterResult = false; 316 bool filterResult = false;
316 if (c_analyticBlurRRect) { 317 if (c_analyticBlurRRect) {
317 // special case for fast round rect blur 318 // special case for fast round rect blur
318 // don't actually do the blur the first time, just compute the correct s ize 319 // don't actually do the blur the first time, just compute the correct s ize
319 filterResult = this->filterRRectMask(&dstM, rrect, matrix, &margin, 320 filterResult = this->filterRRectMask(&dstM, rrect, matrix, &margin,
320 SkMask::kJustComputeBounds_CreateMod e); 321 SkMask::kJustComputeBounds_CreateMod e, &patch->fData);
reed1 2014/10/21 21:29:49 If we are just computing bounds, shouldn't we pass
321 } 322 }
322 323
323 if (!filterResult) { 324 if (!filterResult) {
324 filterResult = this->filterMask(&dstM, srcM, matrix, &margin); 325 filterResult = this->filterMask(&dstM, srcM, matrix, &margin, &patch->fD ata);
325 } 326 }
326 327
327 if (!filterResult) { 328 if (!filterResult) {
328 return kFalse_FilterReturn; 329 return kFalse_FilterReturn;
329 } 330 }
330 331
331 // Now figure out the appropriate width and height of the smaller round rect angle 332 // Now figure out the appropriate width and height of the smaller round rect angle
332 // to stretch. It will take into account the larger radius per side as well as double 333 // to stretch. It will take into account the larger radius per side as well as double
333 // the margin, to account for inner and outer blur. 334 // the margin, to account for inner and outer blur.
334 const SkVector& UL = rrect.radii(SkRRect::kUpperLeft_Corner); 335 const SkVector& UL = rrect.radii(SkRRect::kUpperLeft_Corner);
(...skipping 26 matching lines...) Expand all
361 SkRect smallR = SkRect::MakeWH(totalSmallWidth, totalSmallHeight); 362 SkRect smallR = SkRect::MakeWH(totalSmallWidth, totalSmallHeight);
362 363
363 SkRRect smallRR; 364 SkRRect smallRR;
364 SkVector radii[4]; 365 SkVector radii[4];
365 radii[SkRRect::kUpperLeft_Corner] = UL; 366 radii[SkRRect::kUpperLeft_Corner] = UL;
366 radii[SkRRect::kUpperRight_Corner] = UR; 367 radii[SkRRect::kUpperRight_Corner] = UR;
367 radii[SkRRect::kLowerRight_Corner] = LR; 368 radii[SkRRect::kLowerRight_Corner] = LR;
368 radii[SkRRect::kLowerLeft_Corner] = LL; 369 radii[SkRRect::kLowerLeft_Corner] = LL;
369 smallRR.setRectRadii(smallR, radii); 370 smallRR.setRectRadii(smallR, radii);
370 371
372 SkScalar sigma = this->computeXformedSigma(matrix);
373 if ((patch->fData = SkMaskCache::FindAndRef(sigma, rrect, &patch->fMask))) {
374 patch->fOuterRect = dstM.fBounds;
375 patch->fCenter.fX = SkScalarCeilToInt(leftUnstretched) + 1;
reed1 2014/10/21 21:29:49 Can we set these fields of the patch once, before
376 patch->fCenter.fY = SkScalarCeilToInt(topUnstretched) + 1;
377 return kTrue_FilterReturn;
378 }
379
371 bool analyticBlurWorked = false; 380 bool analyticBlurWorked = false;
372 if (c_analyticBlurRRect) { 381 if (c_analyticBlurRRect) {
373 analyticBlurWorked = 382 analyticBlurWorked =
374 this->filterRRectMask(&patch->fMask, smallRR, matrix, &margin, 383 this->filterRRectMask(&patch->fMask, smallRR, matrix, &margin,
375 SkMask::kComputeBoundsAndRenderImage_CreateMod e); 384 SkMask::kComputeBoundsAndRenderImage_CreateMod e, &patch->fData);
376 } 385 }
377 386
378 if (!analyticBlurWorked) { 387 if (!analyticBlurWorked) {
379 if (!draw_rrect_into_mask(smallRR, &srcM)) { 388 if (!draw_rrect_into_mask(smallRR, &srcM)) {
380 return kFalse_FilterReturn; 389 return kFalse_FilterReturn;
381 } 390 }
382 391
383 SkAutoMaskFreeImage amf(srcM.fImage); 392 SkAutoMaskFreeImage amf(srcM.fImage);
384 393
385 if (!this->filterMask(&patch->fMask, srcM, matrix, &margin)) { 394 if (!this->filterMask(&patch->fMask, srcM, matrix, &margin, &patch->fDat a)) {
386 return kFalse_FilterReturn; 395 return kFalse_FilterReturn;
387 } 396 }
388 } 397 }
389 398
390 patch->fMask.fBounds.offsetTo(0, 0); 399 patch->fMask.fBounds.offsetTo(0, 0);
391 patch->fOuterRect = dstM.fBounds; 400 patch->fOuterRect = dstM.fBounds;
392 patch->fCenter.fX = SkScalarCeilToInt(leftUnstretched) + 1; 401 patch->fCenter.fX = SkScalarCeilToInt(leftUnstretched) + 1;
393 patch->fCenter.fY = SkScalarCeilToInt(topUnstretched) + 1; 402 patch->fCenter.fY = SkScalarCeilToInt(topUnstretched) + 1;
403 SkMaskCache::Add(sigma, rrect, patch->fMask, patch->fData);
404
394 return kTrue_FilterReturn; 405 return kTrue_FilterReturn;
395 } 406 }
396 407
397 SK_CONF_DECLARE( bool, c_analyticBlurNinepatch, "mask.filter.analyticNinePatch", true, "Use the faster analytic blur approach for ninepatch rects" ); 408 SK_CONF_DECLARE( bool, c_analyticBlurNinepatch, "mask.filter.analyticNinePatch", true, "Use the faster analytic blur approach for ninepatch rects" );
398 409
399 SkMaskFilter::FilterReturn 410 SkMaskFilter::FilterReturn
400 SkBlurMaskFilterImpl::filterRectsToNine(const SkRect rects[], int count, 411 SkBlurMaskFilterImpl::filterRectsToNine(const SkRect rects[], int count,
401 const SkMatrix& matrix, 412 const SkMatrix& matrix,
402 const SkIRect& clipBounds, 413 const SkIRect& clipBounds,
403 NinePatch* patch) const { 414 NinePatch* patch) const {
(...skipping 18 matching lines...) Expand all
422 rects[0].roundOut(&srcM.fBounds); 433 rects[0].roundOut(&srcM.fBounds);
423 srcM.fImage = NULL; 434 srcM.fImage = NULL;
424 srcM.fFormat = SkMask::kA8_Format; 435 srcM.fFormat = SkMask::kA8_Format;
425 srcM.fRowBytes = 0; 436 srcM.fRowBytes = 0;
426 437
427 bool filterResult = false; 438 bool filterResult = false;
428 if (count == 1 && c_analyticBlurNinepatch) { 439 if (count == 1 && c_analyticBlurNinepatch) {
429 // special case for fast rect blur 440 // special case for fast rect blur
430 // don't actually do the blur the first time, just compute the correct s ize 441 // don't actually do the blur the first time, just compute the correct s ize
431 filterResult = this->filterRectMask(&dstM, rects[0], matrix, &margin, 442 filterResult = this->filterRectMask(&dstM, rects[0], matrix, &margin,
432 SkMask::kJustComputeBounds_CreateMod e); 443 SkMask::kJustComputeBounds_CreateMod e, &patch->fData);
reed1 2014/10/21 21:29:49 again, can/should we pass NULL for the last parame
433 } else { 444 } else {
434 filterResult = this->filterMask(&dstM, srcM, matrix, &margin); 445 filterResult = this->filterMask(&dstM, srcM, matrix, &margin, &patch->fD ata);
435 } 446 }
436 447
437 if (!filterResult) { 448 if (!filterResult) {
438 return kFalse_FilterReturn; 449 return kFalse_FilterReturn;
439 } 450 }
440 451
441 /* 452 /*
442 * smallR is the smallest version of 'rect' that will still guarantee that 453 * smallR is the smallest version of 'rect' that will still guarantee that
443 * we get the same blur results on all edges, plus 1 center row/col that is 454 * we get the same blur results on all edges, plus 1 center row/col that is
444 * representative of the extendible/stretchable edges of the ninepatch. 455 * representative of the extendible/stretchable edges of the ninepatch.
(...skipping 18 matching lines...) Expand all
463 if (1 == count) { 474 if (1 == count) {
464 innerIR = srcM.fBounds; 475 innerIR = srcM.fBounds;
465 center.set(smallW, smallH); 476 center.set(smallW, smallH);
466 } else { 477 } else {
467 SkASSERT(2 == count); 478 SkASSERT(2 == count);
468 rects[1].roundIn(&innerIR); 479 rects[1].roundIn(&innerIR);
469 center.set(smallW + (innerIR.left() - srcM.fBounds.left()), 480 center.set(smallW + (innerIR.left() - srcM.fBounds.left()),
470 smallH + (innerIR.top() - srcM.fBounds.top())); 481 smallH + (innerIR.top() - srcM.fBounds.top()));
471 } 482 }
472 483
484 SkScalar sigma = this->computeXformedSigma(matrix);
485 if ((patch->fData = SkMaskCache::FindAndRef(sigma, count, rects, &patch->fMa sk))) {
486 patch->fOuterRect = dstM.fBounds;
reed1 2014/10/21 21:29:49 again, can we share setup code for patch between h
487 patch->fCenter = center;
488
489 return kTrue_FilterReturn;
490 }
491
473 // +1 so we get a clean, stretchable, center row/col 492 // +1 so we get a clean, stretchable, center row/col
474 smallW += 1; 493 smallW += 1;
475 smallH += 1; 494 smallH += 1;
476 495
477 // we want the inset amounts to be integral, so we don't change any 496 // we want the inset amounts to be integral, so we don't change any
478 // fractional phase on the fRight or fBottom of our smallR. 497 // fractional phase on the fRight or fBottom of our smallR.
479 const SkScalar dx = SkIntToScalar(innerIR.width() - smallW); 498 const SkScalar dx = SkIntToScalar(innerIR.width() - smallW);
480 const SkScalar dy = SkIntToScalar(innerIR.height() - smallH); 499 const SkScalar dy = SkIntToScalar(innerIR.height() - smallH);
481 if (dx < 0 || dy < 0) { 500 if (dx < 0 || dy < 0) {
482 // we're too small, relative to our blur, to break into nine-patch, 501 // we're too small, relative to our blur, to break into nine-patch,
(...skipping 11 matching lines...) Expand all
494 SkASSERT(!smallR[1].isEmpty()); 513 SkASSERT(!smallR[1].isEmpty());
495 } 514 }
496 515
497 if (count > 1 || !c_analyticBlurNinepatch) { 516 if (count > 1 || !c_analyticBlurNinepatch) {
498 if (!draw_rects_into_mask(smallR, count, &srcM)) { 517 if (!draw_rects_into_mask(smallR, count, &srcM)) {
499 return kFalse_FilterReturn; 518 return kFalse_FilterReturn;
500 } 519 }
501 520
502 SkAutoMaskFreeImage amf(srcM.fImage); 521 SkAutoMaskFreeImage amf(srcM.fImage);
503 522
504 if (!this->filterMask(&patch->fMask, srcM, matrix, &margin)) { 523 if (!this->filterMask(&patch->fMask, srcM, matrix, &margin, &patch->fDat a)) {
505 return kFalse_FilterReturn; 524 return kFalse_FilterReturn;
506 } 525 }
507 } else { 526 } else {
508 if (!this->filterRectMask(&patch->fMask, smallR[0], matrix, &margin, 527 if (!this->filterRectMask(&patch->fMask, smallR[0], matrix, &margin,
509 SkMask::kComputeBoundsAndRenderImage_CreateMod e)) { 528 SkMask::kComputeBoundsAndRenderImage_CreateMod e, &patch->fData)) {
510 return kFalse_FilterReturn; 529 return kFalse_FilterReturn;
511 } 530 }
512 } 531 }
513 patch->fMask.fBounds.offsetTo(0, 0); 532 patch->fMask.fBounds.offsetTo(0, 0);
514 patch->fOuterRect = dstM.fBounds; 533 patch->fOuterRect = dstM.fBounds;
515 patch->fCenter = center; 534 patch->fCenter = center;
535 SkMaskCache::Add(sigma, count, rects, patch->fMask, patch->fData);
536
516 return kTrue_FilterReturn; 537 return kTrue_FilterReturn;
517 } 538 }
518 539
519 void SkBlurMaskFilterImpl::computeFastBounds(const SkRect& src, 540 void SkBlurMaskFilterImpl::computeFastBounds(const SkRect& src,
520 SkRect* dst) const { 541 SkRect* dst) const {
521 SkScalar pad = 3.0f * fSigma; 542 SkScalar pad = 3.0f * fSigma;
522 543
523 dst->set(src.fLeft - pad, src.fTop - pad, 544 dst->set(src.fLeft - pad, src.fTop - pad,
524 src.fRight + pad, src.fBottom + pad); 545 src.fRight + pad, src.fBottom + pad);
525 } 546 }
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 929
909 SkRRect smallRRect; 930 SkRRect smallRRect;
910 smallRRect.setRectXY(smallRect, SkIntToScalar(cornerRadius), SkIntToScal ar(cornerRadius)); 931 smallRRect.setRectXY(smallRect, SkIntToScalar(cornerRadius), SkIntToScal ar(cornerRadius));
911 932
912 SkPath path; 933 SkPath path;
913 path.addRRect( smallRRect ); 934 path.addRRect( smallRRect );
914 935
915 SkDraw::DrawToMask(path, &mask.fBounds, NULL, NULL, &mask, SkMask::kJust RenderImage_CreateMode, SkPaint::kFill_Style); 936 SkDraw::DrawToMask(path, &mask.fBounds, NULL, NULL, &mask, SkMask::kJust RenderImage_CreateMode, SkPaint::kFill_Style);
916 937
917 SkMask blurred_mask; 938 SkMask blurred_mask;
918 SkBlurMask::BoxBlur(&blurred_mask, mask, sigma, kNormal_SkBlurStyle, kHi gh_SkBlurQuality, NULL, true ); 939 SkBlurMask::BoxBlur(&blurred_mask, NULL, mask, sigma, kNormal_SkBlurStyl e, kHigh_SkBlurQuality, NULL, true );
919 940
920 blurNinePatchTexture = context->createTexture(&params, texDesc, blurRRec tNinePatchID, blurred_mask.fImage, 0); 941 blurNinePatchTexture = context->createTexture(&params, texDesc, blurRRec tNinePatchID, blurred_mask.fImage, 0);
921 SkMask::FreeImage(blurred_mask.fImage); 942 SkMask::FreeImage(blurred_mask.fImage);
922 } 943 }
923 944
924 SkAutoTUnref<GrTexture> blurunref(blurNinePatchTexture); 945 SkAutoTUnref<GrTexture> blurunref(blurNinePatchTexture);
925 if (NULL == blurNinePatchTexture) { 946 if (NULL == blurNinePatchTexture) {
926 return NULL; 947 return NULL;
927 } 948 }
928 949
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 } else { 1241 } else {
1221 str->append("None"); 1242 str->append("None");
1222 } 1243 }
1223 str->append("))"); 1244 str->append("))");
1224 } 1245 }
1225 #endif 1246 #endif
1226 1247
1227 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) 1248 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter)
1228 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) 1249 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl)
1229 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1250 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698