OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkAnimTimer.h" | 9 #include "SkAnimTimer.h" |
10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 // The goal is to replace this clipped draw (which clips the | 341 // The goal is to replace this clipped draw (which clips the |
342 // shadow) with a draw using the geometric clip | 342 // shadow) with a draw using the geometric clip |
343 if (kGaussianEdge_Mode == fMode) { | 343 if (kGaussianEdge_Mode == fMode) { |
344 canvas->save(); | 344 canvas->save(); |
345 clipObj->clip(canvas); | 345 clipObj->clip(canvas); |
346 | 346 |
347 // Draw with GaussianEdgeShader | 347 // Draw with GaussianEdgeShader |
348 SkPaint paint; | 348 SkPaint paint; |
349 paint.setAntiAlias(true); | 349 paint.setAntiAlias(true); |
350 // G channel is an F6.2 radius | 350 // G channel is an F6.2 radius |
351 paint.setColor(SkColorSetARGB(255, 255, (unsigned char)(
4*kPad), 0)); | 351 paint.setColor(SkColorSetARGB(255, 0, (unsigned char)(4*
kPad), 0)); |
352 paint.setShader(SkGaussianEdgeShader::Make()); | 352 paint.setShader(SkGaussianEdgeShader::Make()); |
353 drawObj->draw(canvas, paint); | 353 drawObj->draw(canvas, paint); |
354 canvas->restore(); | 354 canvas->restore(); |
355 } else if (kBlurMask_Mode == fMode) { | 355 } else if (kBlurMask_Mode == fMode) { |
356 SkPath clippedPath; | 356 SkPath clippedPath; |
357 | 357 |
358 SkScalar sigma = kPad / 4.0f; | 358 SkScalar sigma = kPad / 4.0f; |
359 | 359 |
360 if (clipObj->contains(drawObj->bounds())) { | 360 if (clipObj->contains(drawObj->bounds())) { |
361 clippedPath = drawObj->asPath(2.0f*sigma); | 361 clippedPath = drawObj->asPath(2.0f*sigma); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 Mode fMode; | 427 Mode fMode; |
428 bool fPause; | 428 bool fPause; |
429 | 429 |
430 typedef GM INHERITED; | 430 typedef GM INHERITED; |
431 }; | 431 }; |
432 | 432 |
433 ////////////////////////////////////////////////////////////////////////////// | 433 ////////////////////////////////////////////////////////////////////////////// |
434 | 434 |
435 DEF_GM(return new RevealGM;) | 435 DEF_GM(return new RevealGM;) |
436 } | 436 } |
OLD | NEW |