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

Side by Side Diff: samplecode/SampleSlides.cpp

Issue 1821533002: guard rasterizer and drawlooper setters (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update android sdk Created 4 years, 9 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 2011 Google Inc. 3 * Copyright 2011 Google Inc.
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 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkBlurMaskFilter.h" 10 #include "SkBlurMaskFilter.h"
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 rastBuilder->addLayer(p); 537 rastBuilder->addLayer(p);
538 } 538 }
539 539
540 static void r6(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) 540 static void r6(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p)
541 { 541 {
542 rastBuilder->addLayer(p); 542 rastBuilder->addLayer(p);
543 543
544 p.setAntiAlias(false); 544 p.setAntiAlias(false);
545 SkLayerRasterizer::Builder rastBuilder2; 545 SkLayerRasterizer::Builder rastBuilder2;
546 r5(&rastBuilder2, p); 546 r5(&rastBuilder2, p);
547 p.setRasterizer(rastBuilder2.detachRasterizer())->unref(); 547 p.setRasterizer(rastBuilder2.detach());
548 p.setXfermodeMode(SkXfermode::kClear_Mode); 548 p.setXfermodeMode(SkXfermode::kClear_Mode);
549 rastBuilder->addLayer(p); 549 rastBuilder->addLayer(p);
550 } 550 }
551 551
552 #include "Sk2DPathEffect.h" 552 #include "Sk2DPathEffect.h"
553 553
554 static sk_sp<SkPathEffect> MakeDotEffect(SkScalar radius, const SkMatrix& matrix ) { 554 static sk_sp<SkPathEffect> MakeDotEffect(SkScalar radius, const SkMatrix& matrix ) {
555 SkPath path; 555 SkPath path;
556 path.addCircle(0, 0, radius); 556 path.addCircle(0, 0, radius);
557 return SkPath2DPathEffect::Make(matrix, path); 557 return SkPath2DPathEffect::Make(matrix, path);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 r0, r1, r2, r3, r4, r5, r6, r7, r8, r9 608 r0, r1, r2, r3, r4, r5, r6, r7, r8, r9
609 }; 609 };
610 610
611 static void apply_shader(SkPaint* paint, int index) { 611 static void apply_shader(SkPaint* paint, int index) {
612 raster_proc proc = gRastProcs[index]; 612 raster_proc proc = gRastProcs[index];
613 SkPaint p; 613 SkPaint p;
614 SkLayerRasterizer::Builder rastBuilder; 614 SkLayerRasterizer::Builder rastBuilder;
615 615
616 p.setAntiAlias(true); 616 p.setAntiAlias(true);
617 proc(&rastBuilder, p); 617 proc(&rastBuilder, p);
618 paint->setRasterizer(rastBuilder.detachRasterizer())->unref(); 618 paint->setRasterizer(rastBuilder.detach());
619 paint->setColor(SK_ColorBLUE); 619 paint->setColor(SK_ColorBLUE);
620 } 620 }
621 621
622 #include "SkTypeface.h" 622 #include "SkTypeface.h"
623 623
624 static void texteffect_slide(SkCanvas* canvas) { 624 static void texteffect_slide(SkCanvas* canvas) {
625 const char* str = "Google"; 625 const char* str = "Google";
626 size_t len = strlen(str); 626 size_t len = strlen(str);
627 SkScalar x = 20; 627 SkScalar x = 20;
628 SkScalar y = 80; 628 SkScalar y = 80;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 } 710 }
711 711
712 private: 712 private:
713 typedef SampleView INHERITED; 713 typedef SampleView INHERITED;
714 }; 714 };
715 715
716 ////////////////////////////////////////////////////////////////////////////// 716 //////////////////////////////////////////////////////////////////////////////
717 717
718 static SkView* MyFactory() { return new SlideView; } 718 static SkView* MyFactory() { return new SlideView; }
719 static SkViewRegister reg(MyFactory); 719 static SkViewRegister reg(MyFactory);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698