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

Side by Side Diff: gm/distantclip.cpp

Issue 2355483002: abstract name of clipping ops, to transtion to a more restricted set (Closed)
Patch Set: no need for ifdef for globals Created 4 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/convexpolyclip.cpp ('k') | gm/imagefilters.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 * Copyright 2012 Google Inc. 3 * Copyright 2012 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 8
9 #include "gm.h" 9 #include "gm.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 21 matching lines...) Expand all
32 SkPictureRecorder recorder; 32 SkPictureRecorder recorder;
33 // We record a picture of huge vertical extents in which we clear the ca nvas to red, create 33 // We record a picture of huge vertical extents in which we clear the ca nvas to red, create
34 // a 'extents' by 'extents' round rect clip at a vertical offset of 'off set', then draw 34 // a 'extents' by 'extents' round rect clip at a vertical offset of 'off set', then draw
35 // green into that. 35 // green into that.
36 SkCanvas* rec = recorder.beginRecording(kExtents, kOffset + kExtents, nu llptr, 0); 36 SkCanvas* rec = recorder.beginRecording(kExtents, kOffset + kExtents, nu llptr, 0);
37 rec->drawColor(SK_ColorRED); 37 rec->drawColor(SK_ColorRED);
38 rec->save(); 38 rec->save();
39 SkRect r = SkRect::MakeXYWH(-kExtents, kOffset - kExtents, 2 * kExtents, 2 * kExtents); 39 SkRect r = SkRect::MakeXYWH(-kExtents, kOffset - kExtents, 2 * kExtents, 2 * kExtents);
40 SkPath p; 40 SkPath p;
41 p.addRoundRect(r, 5, 5); 41 p.addRoundRect(r, 5, 5);
42 rec->clipPath(p, SkRegion::kIntersect_Op, true); 42 rec->clipPath(p, SkCanvas::kIntersect_Op, true);
43 rec->drawColor(SK_ColorGREEN); 43 rec->drawColor(SK_ColorGREEN);
44 rec->restore(); 44 rec->restore();
45 sk_sp<SkPicture> pict(recorder.finishRecordingAsPicture()); 45 sk_sp<SkPicture> pict(recorder.finishRecordingAsPicture());
46 46
47 // Next we play that picture into another picture of the same size. 47 // Next we play that picture into another picture of the same size.
48 pict->playback(recorder.beginRecording(pict->cullRect().width(), 48 pict->playback(recorder.beginRecording(pict->cullRect().width(),
49 pict->cullRect().height(), 49 pict->cullRect().height(),
50 nullptr, 0)); 50 nullptr, 0));
51 sk_sp<SkPicture> pict2(recorder.finishRecordingAsPicture()); 51 sk_sp<SkPicture> pict2(recorder.finishRecordingAsPicture());
52 52
(...skipping 10 matching lines...) Expand all
63 private: 63 private:
64 typedef GM INHERITED; 64 typedef GM INHERITED;
65 }; 65 };
66 66
67 /////////////////////////////////////////////////////////////////////////////// 67 ///////////////////////////////////////////////////////////////////////////////
68 68
69 static GM* MyFactory(void*) { return new DistantClipGM; } 69 static GM* MyFactory(void*) { return new DistantClipGM; }
70 static GMRegistry reg(MyFactory); 70 static GMRegistry reg(MyFactory);
71 71
72 } 72 }
OLDNEW
« no previous file with comments | « gm/convexpolyclip.cpp ('k') | gm/imagefilters.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698