| 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" |
| 11 #include "SkGradientShader.h" | 11 #include "SkGradientShader.h" |
| 12 #include "SkPath.h" | 12 #include "SkPath.h" |
| 13 #include "SkRegion.h" | 13 #include "SkRegion.h" |
| 14 #include "SkShader.h" | 14 #include "SkShader.h" |
| 15 #include "SkUtils.h" | 15 #include "SkUtils.h" |
| 16 #include "SkImageDecoder.h" | 16 #include "SkImageDecoder.h" |
| 17 | 17 |
| 18 static void test_strokerect(SkCanvas* canvas) { | 18 static void test_strokerect(SkCanvas* canvas) { |
| 19 int width = 100; | 19 int width = 100; |
| 20 int height = 100; | 20 int height = 100; |
| 21 | 21 |
| 22 SkBitmap bitmap; | 22 SkBitmap bitmap; |
| 23 bitmap.setConfig(SkBitmap::kA8_Config, width*2, height*2); | 23 bitmap.allocPixels(SkImageInfo::MakeA8(width*2, height*2)); |
| 24 bitmap.allocPixels(); | |
| 25 bitmap.eraseColor(SK_ColorTRANSPARENT); | 24 bitmap.eraseColor(SK_ColorTRANSPARENT); |
| 26 | 25 |
| 27 SkScalar dx = 20; | 26 SkScalar dx = 20; |
| 28 SkScalar dy = 20; | 27 SkScalar dy = 20; |
| 29 | 28 |
| 30 SkPath path; | 29 SkPath path; |
| 31 path.addRect(0.0f, 0.0f, | 30 path.addRect(0.0f, 0.0f, |
| 32 SkIntToScalar(width), SkIntToScalar(height), | 31 SkIntToScalar(width), SkIntToScalar(height), |
| 33 SkPath::kCW_Direction); | 32 SkPath::kCW_Direction); |
| 34 SkRect r = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)); | 33 SkRect r = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)); |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 private: | 409 private: |
| 411 SkIRect fBase, fRect; | 410 SkIRect fBase, fRect; |
| 412 | 411 |
| 413 typedef SampleView INHERITED; | 412 typedef SampleView INHERITED; |
| 414 }; | 413 }; |
| 415 | 414 |
| 416 ////////////////////////////////////////////////////////////////////////////// | 415 ////////////////////////////////////////////////////////////////////////////// |
| 417 | 416 |
| 418 static SkView* MyFactory() { return new RegionView; } | 417 static SkView* MyFactory() { return new RegionView; } |
| 419 static SkViewRegister reg(MyFactory); | 418 static SkViewRegister reg(MyFactory); |
| OLD | NEW |