OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 | 9 |
10 #include "SkColorFilter.h" | 10 #include "SkColorFilter.h" |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 step.fX = SkIntToScalar(x*kTileWidth); | 417 step.fX = SkIntToScalar(x*kTileWidth); |
418 step.fY = SkIntToScalar(y*kTileHeight); | 418 step.fY = SkIntToScalar(y*kTileHeight); |
419 step.fPaint = new SkPaint; | 419 step.fPaint = new SkPaint; |
420 step.fPaint->setColorFilter( | 420 step.fPaint->setColorFilter( |
421 SkColorFilter::MakeModeFilter(colors[x][y], SkXfermode::kModulat
e_Mode)); | 421 SkColorFilter::MakeModeFilter(colors[x][y], SkXfermode::kModulat
e_Mode)); |
422 | 422 |
423 step.fSurf = create_compat_surface(finalCanvas, kTileWidth, kTileHei
ght); | 423 step.fSurf = create_compat_surface(finalCanvas, kTileWidth, kTileHei
ght); |
424 | 424 |
425 SkCanvas* subCanvas = step.fSurf->getCanvas(); | 425 SkCanvas* subCanvas = step.fSurf->getCanvas(); |
426 | 426 |
427 const SkMatrix trans = SkMatrix::MakeTrans(-SkIntToScalar(x*kTileWid
th), | 427 const SkMatrix trans = SkMatrix::MakeTrans(-SkIntToScalar(x*kTileWid
th), |
428 -SkIntToScalar(y*kTileHei
ght)); | 428 -SkIntToScalar(y*kTileHei
ght)); |
429 | 429 |
430 create_content(mpd, pfGen, pictures, subCanvas, trans); | 430 create_content(mpd, pfGen, pictures, subCanvas, trans); |
431 } | 431 } |
432 } | 432 } |
433 } | 433 } |
434 | 434 |
435 static const PFLayoutMtd gLayoutMthds[] = { simple, tiled }; | 435 static const PFLayoutMtd gLayoutMthds[] = { simple, tiled }; |
436 | 436 |
437 namespace skiagm { | 437 namespace skiagm { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 | 511 |
512 canvas->drawImage(step.fSurf->makeImageSnapshot().get(), | 512 canvas->drawImage(step.fSurf->makeImageSnapshot().get(), |
513 step.fX, step.fY, step.fPaint); | 513 step.fX, step.fY, step.fPaint); |
514 } | 514 } |
515 } | 515 } |
516 | 516 |
517 SkISize onISize() override { return SkISize::Make(kPicWidth, kPicHeight)
; } | 517 SkISize onISize() override { return SkISize::Make(kPicWidth, kPicHeight)
; } |
518 | 518 |
519 SkString onShortName() override { | 519 SkString onShortName() override { |
520 static const char* gContentNames[] = { | 520 static const char* gContentNames[] = { |
521 "noclip", "rectclip", "rrectclip", "pathclip", | 521 "noclip", "rectclip", "rrectclip", "pathclip", |
522 "invpathclip", "sierpinski", "biglayer" | 522 "invpathclip", "sierpinski", "biglayer" |
523 }; | 523 }; |
524 static const char* gLayoutNames[] = { "simple", "tiled" }; | 524 static const char* gLayoutNames[] = { "simple", "tiled" }; |
525 | 525 |
526 SkASSERT(SK_ARRAY_COUNT(gLayoutNames) == kLayoutCnt); | 526 SkASSERT(SK_ARRAY_COUNT(gLayoutNames) == kLayoutCnt); |
527 SkASSERT(SK_ARRAY_COUNT(gContentNames) == kContentCnt); | 527 SkASSERT(SK_ARRAY_COUNT(gContentNames) == kContentCnt); |
528 | 528 |
529 SkString name("multipicturedraw_"); | 529 SkString name("multipicturedraw_"); |
530 | 530 |
531 name.append(gContentNames[fContent]); | 531 name.append(gContentNames[fContent]); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 MultiPictureDraw::kTiled_Layout);) | 563 MultiPictureDraw::kTiled_Layout);) |
564 DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kPathClipMulti_Content, | 564 DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kPathClipMulti_Content, |
565 MultiPictureDraw::kTiled_Layout);) | 565 MultiPictureDraw::kTiled_Layout);) |
566 DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kInvPathClipMulti_Conte
nt, | 566 DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kInvPathClipMulti_Conte
nt, |
567 MultiPictureDraw::kTiled_Layout);) | 567 MultiPictureDraw::kTiled_Layout);) |
568 DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kSierpinski_Content, | 568 DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kSierpinski_Content, |
569 MultiPictureDraw::kTiled_Layout);) | 569 MultiPictureDraw::kTiled_Layout);) |
570 DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kBigLayer_Content, | 570 DEF_GM(return new MultiPictureDraw(MultiPictureDraw::kBigLayer_Content, |
571 MultiPictureDraw::kTiled_Layout);) | 571 MultiPictureDraw::kTiled_Layout);) |
572 } | 572 } |
OLD | NEW |