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

Side by Side Diff: samplecode/SampleSkLayer.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/SampleRegion.cpp ('k') | samplecode/SampleText.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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 public: 133 public:
134 TestLayer(SkColor c) : fColor(c) {} 134 TestLayer(SkColor c) : fColor(c) {}
135 135
136 protected: 136 protected:
137 virtual void onDraw(SkCanvas* canvas, SkScalar opacity) { 137 virtual void onDraw(SkCanvas* canvas, SkScalar opacity) {
138 SkRect r; 138 SkRect r;
139 r.set(0, 0, this->getWidth(), this->getHeight()); 139 r.set(0, 0, this->getWidth(), this->getHeight());
140 140
141 SkPaint paint; 141 SkPaint paint;
142 paint.setColor(fColor); 142 paint.setColor(fColor);
143 paint.setAlpha(SkScalarRound(opacity * 255)); 143 paint.setAlpha(SkScalarRoundToInt(opacity * 255));
144 144
145 canvas->drawRect(r, paint); 145 canvas->drawRect(r, paint);
146 } 146 }
147 147
148 private: 148 private:
149 SkColor fColor; 149 SkColor fColor;
150 }; 150 };
151 151
152 class SkLayerView : public SkView { 152 class SkLayerView : public SkView {
153 private: 153 private:
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 236 }
237 237
238 private: 238 private:
239 typedef SkView INHERITED; 239 typedef SkView INHERITED;
240 }; 240 };
241 241
242 /////////////////////////////////////////////////////////////////////////////// 242 ///////////////////////////////////////////////////////////////////////////////
243 243
244 static SkView* MyFactory() { return new SkLayerView; } 244 static SkView* MyFactory() { return new SkLayerView; }
245 static SkViewRegister reg(MyFactory); 245 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleRegion.cpp ('k') | samplecode/SampleText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698