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

Side by Side Diff: tools/debugger/SkDrawCommand.cpp

Issue 2224163005: Made shadows blurry (thru implementing variance mapping) (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Trying different include path Created 4 years, 4 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
« no previous file with comments | « tools/debugger/SkDrawCommand.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "SkDrawCommand.h" 8 #include "SkDrawCommand.h"
9 9
10 #include "SkBlurMaskFilter.h" 10 #include "SkBlurMaskFilter.h"
(...skipping 2431 matching lines...) Expand 10 before | Expand all | Expand 10 after
2442 : INHERITED(kEndDrawPicture_OpType) , fRestore(restore) { } 2442 : INHERITED(kEndDrawPicture_OpType) , fRestore(restore) { }
2443 2443
2444 void SkEndDrawPictureCommand::execute(SkCanvas* canvas) const { 2444 void SkEndDrawPictureCommand::execute(SkCanvas* canvas) const {
2445 if (fRestore) { 2445 if (fRestore) {
2446 canvas->restore(); 2446 canvas->restore();
2447 } 2447 }
2448 } 2448 }
2449 2449
2450 SkBeginDrawShadowedPictureCommand::SkBeginDrawShadowedPictureCommand(const SkPic ture* picture, 2450 SkBeginDrawShadowedPictureCommand::SkBeginDrawShadowedPictureCommand(const SkPic ture* picture,
2451 const SkMat rix* matrix, 2451 const SkMat rix* matrix,
2452 const SkPai nt* paint) 2452 const SkPai nt* paint,
2453 const SkSha dowParams& params)
2453 : INHERITED(kBeginDrawShadowedPicture_OpType) 2454 : INHERITED(kBeginDrawShadowedPicture_OpType)
2455 #ifdef SK_EXPERIMENTAL_SHADOWING
2456 , fPicture(SkRef(picture))
2457 , fShadowParams(params) {
2458 #else
2454 , fPicture(SkRef(picture)) { 2459 , fPicture(SkRef(picture)) {
2455 2460 #endif
2456 SkString* str = new SkString; 2461 SkString* str = new SkString;
2457 str->appendf("SkPicture: L: %f T: %f R: %f B: %f", 2462 str->appendf("SkPicture: L: %f T: %f R: %f B: %f\n",
2458 picture->cullRect().fLeft, picture->cullRect().fTop, 2463 picture->cullRect().fLeft, picture->cullRect().fTop,
2459 picture->cullRect().fRight, picture->cullRect().fBottom); 2464 picture->cullRect().fRight, picture->cullRect().fBottom);
2465 str->appendf("SkShadowParams: bias:%f, minVariance:%f, shRadius:%f, shType:" ,
2466 params.fBiasingConstant,
2467 params.fMinVariance,
2468 params.fShadowRadius);
2469
2470 SkASSERT(SkShadowParams::kShadowTypeCount == 2);
2471
2472 switch (params.fType) {
2473 case SkShadowParams::ShadowType::kNoBlur_ShadowType:
2474 str->append("kNoBlur_ShadowType\n");
2475 break;
2476 case SkShadowParams::ShadowType::kVariance_ShadowType:
2477 str->append("kVariance_ShadowType\n");
2478 break;
2479 }
2480
2460 fInfo.push(str); 2481 fInfo.push(str);
2461 2482
2462 if (matrix) { 2483 if (matrix) {
2463 fMatrix.set(*matrix); 2484 fMatrix.set(*matrix);
2464 fInfo.push(SkObjectParser::MatrixToString(*matrix)); 2485 fInfo.push(SkObjectParser::MatrixToString(*matrix));
2465 } 2486 }
2466 2487
2467 if (paint) { 2488 if (paint) {
2468 fPaint.set(*paint); 2489 fPaint.set(*paint);
2469 fInfo.push(SkObjectParser::PaintToString(*paint)); 2490 fInfo.push(SkObjectParser::PaintToString(*paint));
(...skipping 15 matching lines...) Expand all
2485 } 2506 }
2486 canvas->concat(*fMatrix.get()); 2507 canvas->concat(*fMatrix.get());
2487 } 2508 }
2488 } 2509 }
2489 2510
2490 bool SkBeginDrawShadowedPictureCommand::render(SkCanvas* canvas) const { 2511 bool SkBeginDrawShadowedPictureCommand::render(SkCanvas* canvas) const {
2491 canvas->clear(0xFFFFFFFF); 2512 canvas->clear(0xFFFFFFFF);
2492 canvas->save(); 2513 canvas->save();
2493 2514
2494 xlate_and_scale_to_bounds(canvas, fPicture->cullRect()); 2515 xlate_and_scale_to_bounds(canvas, fPicture->cullRect());
2495 2516 #ifdef SK_EXPERIMENTAL_SHADOWING
2496 canvas->drawPicture(fPicture.get()); 2517 canvas->drawShadowedPicture(fPicture.get(), fMatrix.get(), fPaint.get(), fSh adowParams);
2497 2518 #else
2519 canvas->drawPicture(fPicture.get(), fMatrix.get(), fPaint.get());
2520 #endif
2498 canvas->restore(); 2521 canvas->restore();
2499 2522
2500 return true; 2523 return true;
2501 } 2524 }
2502 2525
2503 SkEndDrawShadowedPictureCommand::SkEndDrawShadowedPictureCommand(bool restore) 2526 SkEndDrawShadowedPictureCommand::SkEndDrawShadowedPictureCommand(bool restore)
2504 : INHERITED(kEndDrawShadowedPicture_OpType) , fRestore(restore) { } 2527 : INHERITED(kEndDrawShadowedPicture_OpType) , fRestore(restore) { }
2505 2528
2506 void SkEndDrawShadowedPictureCommand::execute(SkCanvas* canvas) const { 2529 void SkEndDrawShadowedPictureCommand::execute(SkCanvas* canvas) const {
2507 if (fRestore) { 2530 if (fRestore) {
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
3459 SkTranslateZCommand* SkTranslateZCommand::fromJSON(Json::Value& command, 3482 SkTranslateZCommand* SkTranslateZCommand::fromJSON(Json::Value& command,
3460 UrlDataManager& urlDataManager) { 3483 UrlDataManager& urlDataManager) {
3461 SkScalar z; 3484 SkScalar z;
3462 #ifdef SK_EXPERIMENTAL_SHADOWING 3485 #ifdef SK_EXPERIMENTAL_SHADOWING
3463 extract_json_scalar(command[SKDEBUGCANVAS_ATTRIBUTE_DRAWDEPTHTRANS], &z); 3486 extract_json_scalar(command[SKDEBUGCANVAS_ATTRIBUTE_DRAWDEPTHTRANS], &z);
3464 #else 3487 #else
3465 z = 0; 3488 z = 0;
3466 #endif 3489 #endif
3467 return new SkTranslateZCommand(z); 3490 return new SkTranslateZCommand(z);
3468 } 3491 }
OLDNEW
« no previous file with comments | « tools/debugger/SkDrawCommand.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698