OLD | NEW |
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 24 matching lines...) Expand all Loading... |
35 size->set(bm.width(), bm.height()); | 35 size->set(bm.width(), bm.height()); |
36 return SkShader::CreateBitmapShader(bm, SkShader::kClamp_TileMode, | 36 return SkShader::CreateBitmapShader(bm, SkShader::kClamp_TileMode, |
37 SkShader::kClamp_TileMode); | 37 SkShader::kClamp_TileMode); |
38 } | 38 } |
39 | 39 |
40 static SkShader* make_shader1(const SkIPoint& size) { | 40 static SkShader* make_shader1(const SkIPoint& size) { |
41 SkPoint pts[] = { { 0, 0, }, | 41 SkPoint pts[] = { { 0, 0, }, |
42 { SkIntToScalar(size.fX), SkIntToScalar(size.fY) } }; | 42 { SkIntToScalar(size.fX), SkIntToScalar(size.fY) } }; |
43 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorRED }
; | 43 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorRED }
; |
44 return SkGradientShader::CreateLinear(pts, colors, NULL, | 44 return SkGradientShader::CreateLinear(pts, colors, NULL, |
45 SK_ARRAY_COUNT(colors), SkShader::kMirror_TileMode, NULL); | 45 SK_ARRAY_COUNT(colors), SkShader::kMirror_TileMode); |
46 } | 46 } |
47 | 47 |
48 /////////////////////////////////////////////////////////////////////////////// | 48 /////////////////////////////////////////////////////////////////////////////// |
49 | 49 |
50 class Patch { | 50 class Patch { |
51 public: | 51 public: |
52 Patch() { sk_bzero(fPts, sizeof(fPts)); } | 52 Patch() { sk_bzero(fPts, sizeof(fPts)); } |
53 ~Patch() {} | 53 ~Patch() {} |
54 | 54 |
55 void setPatch(const SkPoint pts[12]) { | 55 void setPatch(const SkPoint pts[12]) { |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 } | 342 } |
343 | 343 |
344 private: | 344 private: |
345 typedef SampleView INHERITED; | 345 typedef SampleView INHERITED; |
346 }; | 346 }; |
347 | 347 |
348 ////////////////////////////////////////////////////////////////////////////// | 348 ////////////////////////////////////////////////////////////////////////////// |
349 | 349 |
350 static SkView* MyFactory() { return new PatchView; } | 350 static SkView* MyFactory() { return new PatchView; } |
351 static SkViewRegister reg(MyFactory); | 351 static SkViewRegister reg(MyFactory); |
OLD | NEW |