| 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 19 matching lines...) Expand all Loading... |
| 30 canvas.drawLine(x, 0, x, SkIntToScalar(H - 1), paint); | 30 canvas.drawLine(x, 0, x, SkIntToScalar(H - 1), paint); |
| 31 } | 31 } |
| 32 paint.setColor(SK_ColorGRAY); | 32 paint.setColor(SK_ColorGRAY); |
| 33 canvas.drawLine(0, 0, SkIntToScalar(W), 0, paint); | 33 canvas.drawLine(0, 0, SkIntToScalar(W), 0, paint); |
| 34 } | 34 } |
| 35 | 35 |
| 36 static void make_paint(SkPaint* paint, SkShader::TileMode tm) { | 36 static void make_paint(SkPaint* paint, SkShader::TileMode tm) { |
| 37 SkBitmap bm; | 37 SkBitmap bm; |
| 38 make_bitmap(&bm); | 38 make_bitmap(&bm); |
| 39 | 39 |
| 40 SkShader* shader = SkShader::CreateBitmapShader(bm, tm, tm); | 40 paint->setShader(SkShader::MakeBitmapShader(bm, tm, tm)); |
| 41 paint->setShader(shader)->unref(); | |
| 42 } | 41 } |
| 43 | 42 |
| 44 class RepeatTileView : public SampleView { | 43 class RepeatTileView : public SampleView { |
| 45 public: | 44 public: |
| 46 RepeatTileView() { | 45 RepeatTileView() { |
| 47 this->setBGColor(SK_ColorGRAY); | 46 this->setBGColor(SK_ColorGRAY); |
| 48 } | 47 } |
| 49 | 48 |
| 50 protected: | 49 protected: |
| 51 // overrides from SkEventSink | 50 // overrides from SkEventSink |
| (...skipping 30 matching lines...) Expand all Loading... |
| 82 } | 81 } |
| 83 | 82 |
| 84 private: | 83 private: |
| 85 typedef SampleView INHERITED; | 84 typedef SampleView INHERITED; |
| 86 }; | 85 }; |
| 87 | 86 |
| 88 ////////////////////////////////////////////////////////////////////////////// | 87 ////////////////////////////////////////////////////////////////////////////// |
| 89 | 88 |
| 90 static SkView* MyFactory() { return new RepeatTileView; } | 89 static SkView* MyFactory() { return new RepeatTileView; } |
| 91 static SkViewRegister reg(MyFactory); | 90 static SkViewRegister reg(MyFactory); |
| OLD | NEW |