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

Side by Side Diff: samplecode/SampleRegion.cpp

Issue 85463005: remove SkFloatToScalar macro (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add flag to expose SkFloatToScalar to chromium 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/SamplePolyToPoly.cpp ('k') | samplecode/SampleSlides.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 "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 canvas->drawText(text, len, x, y, paint); 69 canvas->drawText(text, len, x, y, paint);
70 70
71 const SkPoint pts[] = { 71 const SkPoint pts[] = {
72 { bounds.fLeft, y }, 72 { bounds.fLeft, y },
73 { bounds.fRight, y } 73 { bounds.fRight, y }
74 }; 74 };
75 const SkColor colors[] = { SK_ColorBLACK, SK_ColorBLACK, 0 }; 75 const SkColor colors[] = { SK_ColorBLACK, SK_ColorBLACK, 0 };
76 76
77 // pos[1] value is where we start to fade, relative to the width 77 // pos[1] value is where we start to fade, relative to the width
78 // of our pts[] array. 78 // of our pts[] array.
79 const SkScalar pos[] = { 0, SkFloatToScalar(0.9f), SK_Scalar1 }; 79 const SkScalar pos[] = { 0, 0.9f, SK_Scalar1 };
80 80
81 SkShader* s = SkGradientShader::CreateLinear(pts, colors, pos, 3, 81 SkShader* s = SkGradientShader::CreateLinear(pts, colors, pos, 3,
82 SkShader::kClamp_TileMode); 82 SkShader::kClamp_TileMode);
83 SkPaint p; 83 SkPaint p;
84 p.setShader(s)->unref(); 84 p.setShader(s)->unref();
85 p.setXfermodeMode(SkXfermode::kDstIn_Mode); 85 p.setXfermodeMode(SkXfermode::kDstIn_Mode);
86 canvas->drawRect(bounds, p); 86 canvas->drawRect(bounds, p);
87 87
88 canvas->restore(); 88 canvas->restore();
89 } 89 }
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 private: 409 private:
410 SkIRect fBase, fRect; 410 SkIRect fBase, fRect;
411 411
412 typedef SampleView INHERITED; 412 typedef SampleView INHERITED;
413 }; 413 };
414 414
415 ////////////////////////////////////////////////////////////////////////////// 415 //////////////////////////////////////////////////////////////////////////////
416 416
417 static SkView* MyFactory() { return new RegionView; } 417 static SkView* MyFactory() { return new RegionView; }
418 static SkViewRegister reg(MyFactory); 418 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SamplePolyToPoly.cpp ('k') | samplecode/SampleSlides.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698