| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SampleCode.h" | 8 #include "SampleCode.h" |
| 9 #include "SkAnimTimer.h" | 9 #include "SkAnimTimer.h" |
| 10 #include "SkView.h" | 10 #include "SkView.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 static void make_bitmap(SkBitmap* bitmap) { | 31 static void make_bitmap(SkBitmap* bitmap) { |
| 32 bitmap->allocN32Pixels(INT_SIZE, INT_SIZE); | 32 bitmap->allocN32Pixels(INT_SIZE, INT_SIZE); |
| 33 SkCanvas canvas(*bitmap); | 33 SkCanvas canvas(*bitmap); |
| 34 | 34 |
| 35 canvas.drawColor(SK_ColorRED); | 35 canvas.drawColor(SK_ColorRED); |
| 36 SkPaint paint; | 36 SkPaint paint; |
| 37 paint.setAntiAlias(true); | 37 paint.setAntiAlias(true); |
| 38 const SkPoint pts[] = { { 0, 0 }, { SCALAR_SIZE, SCALAR_SIZE } }; | 38 const SkPoint pts[] = { { 0, 0 }, { SCALAR_SIZE, SCALAR_SIZE } }; |
| 39 const SkColor colors[] = { SK_ColorWHITE, SK_ColorBLUE }; | 39 const SkColor colors[] = { SK_ColorWHITE, SK_ColorBLUE }; |
| 40 paint.setShader(SkGradientShader::CreateLinear(pts, colors, NULL, 2, | 40 paint.setShader(SkGradientShader::CreateLinear(pts, colors, nullptr, 2, |
| 41 SkShader::kClamp_TileMode))->
unref(); | 41 SkShader::kClamp_TileMode))->
unref(); |
| 42 canvas.drawCircle(SCALAR_SIZE/2, SCALAR_SIZE/2, SCALAR_SIZE/2, paint); | 42 canvas.drawCircle(SCALAR_SIZE/2, SCALAR_SIZE/2, SCALAR_SIZE/2, paint); |
| 43 } | 43 } |
| 44 | 44 |
| 45 static SkPoint unit_vec(int degrees) { | 45 static SkPoint unit_vec(int degrees) { |
| 46 SkScalar rad = SkDegreesToRadians(SkIntToScalar(degrees)); | 46 SkScalar rad = SkDegreesToRadians(SkIntToScalar(degrees)); |
| 47 SkScalar s, c; | 47 SkScalar s, c; |
| 48 s = SkScalarSinCos(rad, &c); | 48 s = SkScalarSinCos(rad, &c); |
| 49 return SkPoint::Make(c, s); | 49 return SkPoint::Make(c, s); |
| 50 } | 50 } |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 private: | 244 private: |
| 245 typedef SampleView INHERITED; | 245 typedef SampleView INHERITED; |
| 246 }; | 246 }; |
| 247 | 247 |
| 248 ////////////////////////////////////////////////////////////////////////////// | 248 ////////////////////////////////////////////////////////////////////////////// |
| 249 | 249 |
| 250 static SkView* F0() { return new BitmapRectView; } | 250 static SkView* F0() { return new BitmapRectView; } |
| 251 static SkView* F1() { return new BitmapRectView2; } | 251 static SkView* F1() { return new BitmapRectView2; } |
| 252 static SkViewRegister gR0(F0); | 252 static SkViewRegister gR0(F0); |
| 253 static SkViewRegister gR1(F1); | 253 static SkViewRegister gR1(F1); |
| OLD | NEW |