| 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 "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
| 10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 SkBlurMask::ConvertRadiusToSigma(SkIntToScal
ar(3)))); | 58 SkBlurMask::ConvertRadiusToSigma(SkIntToScal
ar(3)))); |
| 59 paint.getMaskFilter()->unref(); | 59 paint.getMaskFilter()->unref(); |
| 60 | 60 |
| 61 SkRandom rand; | 61 SkRandom rand; |
| 62 | 62 |
| 63 for (int ps = 6; ps <= 35; ps++) { | 63 for (int ps = 6; ps <= 35; ps++) { |
| 64 paint.setColor(rand.nextU() | (0xFF << 24)); | 64 paint.setColor(rand.nextU() | (0xFF << 24)); |
| 65 paint.setTextSize(SkIntToScalar(ps)); | 65 paint.setTextSize(SkIntToScalar(ps)); |
| 66 paint.setTextSize(SkIntToScalar(24)); | 66 paint.setTextSize(SkIntToScalar(24)); |
| 67 canvas->drawText(str, strlen(str), x, y, paint); | 67 canvas->drawText(str, strlen(str), x, y, paint); |
| 68 y += paint.getFontMetrics(NULL); | 68 y += paint.getFontMetrics(nullptr); |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned) override
{ | 72 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned) override
{ |
| 73 return new Click(this); | 73 return new Click(this); |
| 74 } | 74 } |
| 75 | 75 |
| 76 bool onClick(Click* click) override { | 76 bool onClick(Click* click) override { |
| 77 int y = click->fICurr.fY; | 77 int y = click->fICurr.fY; |
| 78 if (y < 0) { | 78 if (y < 0) { |
| 79 y = 0; | 79 y = 0; |
| 80 } else if (y > 255) { | 80 } else if (y > 255) { |
| 81 y = 255; | 81 y = 255; |
| 82 } | 82 } |
| 83 fByte = y; | 83 fByte = y; |
| 84 this->inval(NULL); | 84 this->inval(nullptr); |
| 85 return true; | 85 return true; |
| 86 } | 86 } |
| 87 | 87 |
| 88 private: | 88 private: |
| 89 int fByte; | 89 int fByte; |
| 90 | 90 |
| 91 typedef SampleView INHERITED; | 91 typedef SampleView INHERITED; |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 ////////////////////////////////////////////////////////////////////////////// | 94 ////////////////////////////////////////////////////////////////////////////// |
| 95 | 95 |
| 96 static SkView* MyFactory() { return new TextAlphaView; } | 96 static SkView* MyFactory() { return new TextAlphaView; } |
| 97 static SkViewRegister reg(MyFactory); | 97 static SkViewRegister reg(MyFactory); |
| OLD | NEW |