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

Side by Side Diff: samplecode/SampleIdentityScale.cpp

Issue 777643003: use ClipOp instead of SkRegion for clipping (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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 | « samplecode/SampleFatBits.cpp ('k') | src/core/SkCanvas.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 * 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 "Resources.h" 10 #include "Resources.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 const char *text; 66 const char *text;
67 67
68 canvas->save(); 68 canvas->save();
69 if (use_scale) { 69 if (use_scale) {
70 text = "Scaled = 1"; 70 text = "Scaled = 1";
71 } else { 71 } else {
72 72
73 SkRect r = { 100, 100, 356, 356 }; 73 SkRect r = { 100, 100, 356, 356 };
74 SkPath clipPath; 74 SkPath clipPath;
75 clipPath.addRoundRect(r, SkIntToScalar(5), SkIntToScalar(5)); 75 clipPath.addRoundRect(r, SkIntToScalar(5), SkIntToScalar(5));
76 canvas->clipPath(clipPath, SkRegion::kIntersect_Op, SkToBool(1)); 76 canvas->clipPath(clipPath, kIntersect_SkClipOp, true);
77 text = "Scaled = 0"; 77 text = "Scaled = 0";
78 } 78 }
79 canvas->drawBitmap( fBM, 100, 100, &paint ); 79 canvas->drawBitmap( fBM, 100, 100, &paint );
80 canvas->restore(); 80 canvas->restore();
81 canvas->drawText( text, strlen(text), 100, 400, paint ); 81 canvas->drawText( text, strlen(text), 100, 400, paint );
82 this->inval(NULL); 82 this->inval(NULL);
83 } 83 }
84 84
85 private: 85 private:
86 typedef SampleView INHERITED; 86 typedef SampleView INHERITED;
87 }; 87 };
88 88
89 ////////////////////////////////////////////////////////////////////////////// 89 //////////////////////////////////////////////////////////////////////////////
90 90
91 static SkView* MyFactory() { return new IdentityScaleView("mandrill_256.png"); } 91 static SkView* MyFactory() { return new IdentityScaleView("mandrill_256.png"); }
92 static SkViewRegister reg(MyFactory); 92 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleFatBits.cpp ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698