| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 SkRandom rand; | 77 SkRandom rand; |
| 78 | 78 |
| 79 for (int ps = 6; ps <= 35; ps++) { | 79 for (int ps = 6; ps <= 35; ps++) { |
| 80 paint.setColor(rand.nextU() | (0xFF << 24)); | 80 paint.setColor(rand.nextU() | (0xFF << 24)); |
| 81 paint.setTextSize(SkIntToScalar(ps)); | 81 paint.setTextSize(SkIntToScalar(ps)); |
| 82 paint.setTextSize(SkIntToScalar(24)); | 82 paint.setTextSize(SkIntToScalar(24)); |
| 83 canvas->drawText(str, strlen(str), x, y, paint); | 83 canvas->drawText(str, strlen(str), x, y, paint); |
| 84 y += paint.getFontMetrics(NULL); | 84 y += paint.getFontMetrics(NULL); |
| 85 } | 85 } |
| 86 if (false) { // avoid bit rot, suppress warning | |
| 87 check_for_nonwhite(canvas->getDevice()->accessBitmap(false), fByte); | |
| 88 SkDebugf("------ byte %x\n", fByte); | |
| 89 } | |
| 90 | |
| 91 if (false) { | |
| 92 fByte += 1; | |
| 93 fByte &= 0xFF; | |
| 94 this->inval(NULL); | |
| 95 } | |
| 96 } | 86 } |
| 97 | 87 |
| 98 virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned)
SK_OVERRIDE { | 88 virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned)
SK_OVERRIDE { |
| 99 return new Click(this); | 89 return new Click(this); |
| 100 } | 90 } |
| 101 | 91 |
| 102 virtual bool onClick(Click* click) { | 92 virtual bool onClick(Click* click) { |
| 103 int y = click->fICurr.fY; | 93 int y = click->fICurr.fY; |
| 104 if (y < 0) { | 94 if (y < 0) { |
| 105 y = 0; | 95 y = 0; |
| 106 } else if (y > 255) { | 96 } else if (y > 255) { |
| 107 y = 255; | 97 y = 255; |
| 108 } | 98 } |
| 109 fByte = y; | 99 fByte = y; |
| 110 this->inval(NULL); | 100 this->inval(NULL); |
| 111 return true; | 101 return true; |
| 112 } | 102 } |
| 113 | 103 |
| 114 private: | 104 private: |
| 115 int fByte; | 105 int fByte; |
| 116 | 106 |
| 117 typedef SampleView INHERITED; | 107 typedef SampleView INHERITED; |
| 118 }; | 108 }; |
| 119 | 109 |
| 120 ////////////////////////////////////////////////////////////////////////////// | 110 ////////////////////////////////////////////////////////////////////////////// |
| 121 | 111 |
| 122 static SkView* MyFactory() { return new TextAlphaView; } | 112 static SkView* MyFactory() { return new TextAlphaView; } |
| 123 static SkViewRegister reg(MyFactory); | 113 static SkViewRegister reg(MyFactory); |
| OLD | NEW |