| 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 "SkView.h" | 9 #include "SkView.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 paint.setStyle(SkPaint::kStroke_Style); | 58 paint.setStyle(SkPaint::kStroke_Style); |
| 59 paint.setStrokeWidth(SkScalarHalf(SkIntToScalar(3))); | 59 paint.setStrokeWidth(SkScalarHalf(SkIntToScalar(3))); |
| 60 paint.setColor(0xFFFF8800); | 60 paint.setColor(0xFFFF8800); |
| 61 // paint.setColor(0xFFFFFFFF); | 61 // paint.setColor(0xFFFFFFFF); |
| 62 canvas->drawRect(r, paint); | 62 canvas->drawRect(r, paint); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void onDrawContent(SkCanvas* canvas) override { | 65 void onDrawContent(SkCanvas* canvas) override { |
| 66 SkBitmap bm; | 66 SkBitmap bm; |
| 67 SkImageDecoder::DecodeFile("/kill.gif", &bm); | 67 SkImageDecoder::DecodeFile("/kill.gif", &bm); |
| 68 canvas->drawBitmap(bm, 0, 0, NULL); | 68 canvas->drawBitmap(bm, 0, 0, nullptr); |
| 69 | 69 |
| 70 this->drawRings(canvas); | 70 this->drawRings(canvas); |
| 71 return; | 71 return; |
| 72 | 72 |
| 73 SkPaint paint; | 73 SkPaint paint; |
| 74 | 74 |
| 75 // fAlpha = 0x80; | 75 // fAlpha = 0x80; |
| 76 paint.setColor(SK_ColorWHITE); | 76 paint.setColor(SK_ColorWHITE); |
| 77 paint.setAlpha(fAlpha & 0xFF); | 77 paint.setAlpha(fAlpha & 0xFF); |
| 78 SkRect r; | 78 SkRect r; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 91 | 91 |
| 92 canvas->drawLine(x, y, x + SkIntToScalar(90), y + SkIntToScalar(90), pai
nt); | 92 canvas->drawLine(x, y, x + SkIntToScalar(90), y + SkIntToScalar(90), pai
nt); |
| 93 | 93 |
| 94 paint.setAntiAlias(true); // with anti-aliasing | 94 paint.setAntiAlias(true); // with anti-aliasing |
| 95 y += SkIntToScalar(10); | 95 y += SkIntToScalar(10); |
| 96 canvas->drawLine(x, y, x + SkIntToScalar(90), y + SkIntToScalar(90), pai
nt); | 96 canvas->drawLine(x, y, x + SkIntToScalar(90), y + SkIntToScalar(90), pai
nt); |
| 97 } | 97 } |
| 98 | 98 |
| 99 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned) override
{ | 99 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned) override
{ |
| 100 fAlpha = SkScalarRoundToInt(y); | 100 fAlpha = SkScalarRoundToInt(y); |
| 101 this->inval(NULL); | 101 this->inval(nullptr); |
| 102 return NULL; | 102 return nullptr; |
| 103 } | 103 } |
| 104 private: | 104 private: |
| 105 | 105 |
| 106 int fAlpha; | 106 int fAlpha; |
| 107 typedef SampleView INHERITED; | 107 typedef SampleView INHERITED; |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 ////////////////////////////////////////////////////////////////////////////// | 110 ////////////////////////////////////////////////////////////////////////////// |
| 111 | 111 |
| 112 static SkView* MyFactory() { return new LinesView; } | 112 static SkView* MyFactory() { return new LinesView; } |
| 113 static SkViewRegister reg(MyFactory); | 113 static SkViewRegister reg(MyFactory); |
| OLD | NEW |