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

Side by Side Diff: gm/distantclip.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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 | « gm/displacement.cpp ('k') | gm/downsamplebitmap.cpp » ('j') | 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 2
3 /* 3 /*
4 * Copyright 2012 Google Inc. 4 * Copyright 2012 Google Inc.
5 * 5 *
6 * Use of this source code is governed by a BSD-style license that can be 6 * Use of this source code is governed by a BSD-style license that can be
7 * found in the LICENSE file. 7 * found in the LICENSE file.
8 */ 8 */
9 9
10 #include "gm.h" 10 #include "gm.h"
(...skipping 16 matching lines...) Expand all
27 SkISize onISize() { return SkISize::Make(100, 100); } 27 SkISize onISize() { return SkISize::Make(100, 100); }
28 28
29 virtual void onDraw(SkCanvas* canvas) { 29 virtual void onDraw(SkCanvas* canvas) {
30 static const SkScalar kOffset = 35000.0f; 30 static const SkScalar kOffset = 35000.0f;
31 static const SkScalar kExtents = 1000.0f; 31 static const SkScalar kExtents = 1000.0f;
32 32
33 SkPictureRecorder recorder; 33 SkPictureRecorder recorder;
34 // We record a picture of huge vertical extents in which we clear the ca nvas to red, create 34 // We record a picture of huge vertical extents in which we clear the ca nvas to red, create
35 // a 'extents' by 'extents' round rect clip at a vertical offset of 'off set', then draw 35 // a 'extents' by 'extents' round rect clip at a vertical offset of 'off set', then draw
36 // green into that. 36 // green into that.
37 SkCanvas* rec = recorder.beginRecording(kExtents, kOffset + kExtents, NU LL, 0); 37 SkCanvas* rec = recorder.beginRecording(kExtents, kOffset + kExtents, nu llptr, 0);
38 rec->drawColor(SK_ColorRED); 38 rec->drawColor(SK_ColorRED);
39 rec->save(); 39 rec->save();
40 SkRect r = SkRect::MakeXYWH(-kExtents, kOffset - kExtents, 2 * kExtents, 2 * kExtents); 40 SkRect r = SkRect::MakeXYWH(-kExtents, kOffset - kExtents, 2 * kExtents, 2 * kExtents);
41 SkPath p; 41 SkPath p;
42 p.addRoundRect(r, 5, 5); 42 p.addRoundRect(r, 5, 5);
43 rec->clipPath(p, SkRegion::kIntersect_Op, true); 43 rec->clipPath(p, SkRegion::kIntersect_Op, true);
44 rec->drawColor(SK_ColorGREEN); 44 rec->drawColor(SK_ColorGREEN);
45 rec->restore(); 45 rec->restore();
46 SkAutoTUnref<SkPicture> pict(recorder.endRecording()); 46 SkAutoTUnref<SkPicture> pict(recorder.endRecording());
47 47
48 // Next we play that picture into another picture of the same size. 48 // Next we play that picture into another picture of the same size.
49 pict->playback(recorder.beginRecording(pict->cullRect().width(), 49 pict->playback(recorder.beginRecording(pict->cullRect().width(),
50 pict->cullRect().height(), 50 pict->cullRect().height(),
51 NULL, 0)); 51 nullptr, 0));
52 SkAutoTUnref<SkPicture> pict2(recorder.endRecording()); 52 SkAutoTUnref<SkPicture> pict2(recorder.endRecording());
53 53
54 // Finally we play the part of that second picture that should be green into the canvas. 54 // Finally we play the part of that second picture that should be green into the canvas.
55 canvas->save(); 55 canvas->save();
56 canvas->translate(kExtents / 2, -(kOffset - kExtents / 2)); 56 canvas->translate(kExtents / 2, -(kOffset - kExtents / 2));
57 pict2->playback(canvas); 57 pict2->playback(canvas);
58 canvas->restore(); 58 canvas->restore();
59 59
60 // If the image is red, we erroneously decided the clipPath was empty an d didn't record 60 // If the image is red, we erroneously decided the clipPath was empty an d didn't record
61 // the green drawColor, if it's green we're all good. 61 // the green drawColor, if it's green we're all good.
62 } 62 }
63 63
64 private: 64 private:
65 typedef GM INHERITED; 65 typedef GM INHERITED;
66 }; 66 };
67 67
68 /////////////////////////////////////////////////////////////////////////////// 68 ///////////////////////////////////////////////////////////////////////////////
69 69
70 static GM* MyFactory(void*) { return new DistantClipGM; } 70 static GM* MyFactory(void*) { return new DistantClipGM; }
71 static GMRegistry reg(MyFactory); 71 static GMRegistry reg(MyFactory);
72 72
73 } 73 }
OLDNEW
« no previous file with comments | « gm/displacement.cpp ('k') | gm/downsamplebitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698