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

Side by Side Diff: samplecode/SampleLayerMask.cpp

Issue 111353003: deprecate SkScalarRound (and its ilk), use SkScalarRound[ToInt,ToScalar]. #define SK_SUPPORT_DEPREC… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « samplecode/SampleFilter2.cpp ('k') | samplecode/SampleLines.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 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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkPaint.h" 10 #include "SkPaint.h"
(...skipping 16 matching lines...) Expand all
27 } 27 }
28 return this->INHERITED::onQuery(evt); 28 return this->INHERITED::onQuery(evt);
29 } 29 }
30 30
31 void drawMask(SkCanvas* canvas, const SkRect& r) { 31 void drawMask(SkCanvas* canvas, const SkRect& r) {
32 SkPaint paint; 32 SkPaint paint;
33 paint.setAntiAlias(true); 33 paint.setAntiAlias(true);
34 34
35 if (true) { 35 if (true) {
36 SkBitmap mask; 36 SkBitmap mask;
37 int w = SkScalarRound(r.width()); 37 int w = SkScalarRoundToInt(r.width());
38 int h = SkScalarRound(r.height()); 38 int h = SkScalarRoundToInt(r.height());
39 mask.setConfig(SkBitmap::kARGB_8888_Config, w, h); 39 mask.setConfig(SkBitmap::kARGB_8888_Config, w, h);
40 mask.allocPixels(); 40 mask.allocPixels();
41 mask.eraseColor(SK_ColorTRANSPARENT); 41 mask.eraseColor(SK_ColorTRANSPARENT);
42 SkCanvas c(mask); 42 SkCanvas c(mask);
43 SkRect bounds = r; 43 SkRect bounds = r;
44 bounds.offset(-bounds.fLeft, -bounds.fTop); 44 bounds.offset(-bounds.fLeft, -bounds.fTop);
45 c.drawOval(bounds, paint); 45 c.drawOval(bounds, paint);
46 46
47 paint.setXfermodeMode(SkXfermode::kDstIn_Mode); 47 paint.setXfermodeMode(SkXfermode::kDstIn_Mode);
48 canvas->drawBitmap(mask, r.fLeft, r.fTop, &paint); 48 canvas->drawBitmap(mask, r.fLeft, r.fTop, &paint);
(...skipping 16 matching lines...) Expand all
65 } 65 }
66 66
67 private: 67 private:
68 typedef SampleView INHERITED; 68 typedef SampleView INHERITED;
69 }; 69 };
70 70
71 /////////////////////////////////////////////////////////////////////////////// 71 ///////////////////////////////////////////////////////////////////////////////
72 72
73 static SkView* MyFactory() { return new LayerMaskView; } 73 static SkView* MyFactory() { return new LayerMaskView; }
74 static SkViewRegister reg(MyFactory); 74 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleFilter2.cpp ('k') | samplecode/SampleLines.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698