| 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 "SkBlurDrawLooper.h" | 10 #include "SkBlurDrawLooper.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 paint.setStyle(SkPaint::kFill_Style); | 64 paint.setStyle(SkPaint::kFill_Style); |
| 65 paint.setTextSize(SkIntToScalar(48)); | 65 paint.setTextSize(SkIntToScalar(48)); |
| 66 paint.setTextAlign(SkPaint::kRight_Align); | 66 paint.setTextAlign(SkPaint::kRight_Align); |
| 67 | 67 |
| 68 const char* text = "Reflection"; | 68 const char* text = "Reflection"; |
| 69 size_t len = strlen(text); | 69 size_t len = strlen(text); |
| 70 | 70 |
| 71 SkPathMeasure meas(path, false); | 71 SkPathMeasure meas(path, false); |
| 72 SkScalar pathLen = meas.getLength(); | 72 SkScalar pathLen = meas.getLength(); |
| 73 | 73 |
| 74 canvas->drawTextOnPath(text, len, path, NULL, paint); | 74 canvas->drawTextOnPath(text, len, path, nullptr, paint); |
| 75 | 75 |
| 76 paint.setColor(SK_ColorRED); | 76 paint.setColor(SK_ColorRED); |
| 77 matrix.setScale(-SK_Scalar1, SK_Scalar1); | 77 matrix.setScale(-SK_Scalar1, SK_Scalar1); |
| 78 matrix.postTranslate(pathLen, 0); | 78 matrix.postTranslate(pathLen, 0); |
| 79 canvas->drawTextOnPath(text, len, path, &matrix, paint); | 79 canvas->drawTextOnPath(text, len, path, &matrix, paint); |
| 80 | 80 |
| 81 paint.setColor(SK_ColorBLUE); | 81 paint.setColor(SK_ColorBLUE); |
| 82 matrix.setScale(SK_Scalar1, -SK_Scalar1); | 82 matrix.setScale(SK_Scalar1, -SK_Scalar1); |
| 83 canvas->drawTextOnPath(text, len, path, &matrix, paint); | 83 canvas->drawTextOnPath(text, len, path, &matrix, paint); |
| 84 | 84 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 paint.setStyle(SkPaint::kStroke_Style); | 141 paint.setStyle(SkPaint::kStroke_Style); |
| 142 canvas->drawPath(fPath, paint); | 142 canvas->drawPath(fPath, paint); |
| 143 | 143 |
| 144 canvas->translate(SkIntToScalar(275), 0); | 144 canvas->translate(SkIntToScalar(275), 0); |
| 145 textStrokePath(canvas); | 145 textStrokePath(canvas); |
| 146 | 146 |
| 147 canvas->translate(SkIntToScalar(-275), SkIntToScalar(250)); | 147 canvas->translate(SkIntToScalar(-275), SkIntToScalar(250)); |
| 148 textPathMatrix(canvas); | 148 textPathMatrix(canvas); |
| 149 | 149 |
| 150 if (REPEAT_COUNT > 1) | 150 if (REPEAT_COUNT > 1) |
| 151 this->inval(NULL); | 151 this->inval(nullptr); |
| 152 } | 152 } |
| 153 | 153 |
| 154 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) ove
rride { | 154 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) ove
rride { |
| 155 fHints += 1; | 155 fHints += 1; |
| 156 this->inval(NULL); | 156 this->inval(nullptr); |
| 157 return this->INHERITED::onFindClickHandler(x, y, modi); | 157 return this->INHERITED::onFindClickHandler(x, y, modi); |
| 158 } | 158 } |
| 159 | 159 |
| 160 bool onClick(Click* click) override { | 160 bool onClick(Click* click) override { |
| 161 return this->INHERITED::onClick(click); | 161 return this->INHERITED::onClick(click); |
| 162 } | 162 } |
| 163 | 163 |
| 164 private: | 164 private: |
| 165 int fHints; | 165 int fHints; |
| 166 typedef SampleView INHERITED; | 166 typedef SampleView INHERITED; |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 ////////////////////////////////////////////////////////////////////////////// | 169 ////////////////////////////////////////////////////////////////////////////// |
| 170 | 170 |
| 171 static SkView* MyFactory() { | 171 static SkView* MyFactory() { |
| 172 return new TextOnPathView; | 172 return new TextOnPathView; |
| 173 } | 173 } |
| 174 | 174 |
| 175 static SkViewRegister reg(MyFactory); | 175 static SkViewRegister reg(MyFactory); |
| OLD | NEW |