| 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 #include "gm.h" | 7 #include "gm.h" |
| 8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
| 9 #include "SkGradientShader.h" | 9 #include "SkGradientShader.h" |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 | 35 |
| 36 /////////////////////////////////////////////////////////////////////////////// | 36 /////////////////////////////////////////////////////////////////////////////// |
| 37 | 37 |
| 38 struct LabeledMatrix { | 38 struct LabeledMatrix { |
| 39 SkMatrix fMatrix; | 39 SkMatrix fMatrix; |
| 40 const char* fLabel; | 40 const char* fLabel; |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 class ShaderText2GM : public GM { | 43 class ShaderText2GM : public GM { |
| 44 SkCanvas::TextOnPathMethod fMethod; |
| 45 |
| 44 public: | 46 public: |
| 45 ShaderText2GM() { | 47 ShaderText2GM() : fMethod(SkCanvas::kStretch_TextOnPathMethod) { |
| 46 this->setBGColor(0xFFDDDDDD); | 48 this->setBGColor(0xFFDDDDDD); |
| 47 } | 49 } |
| 48 | 50 |
| 49 protected: | 51 protected: |
| 50 | 52 |
| 51 SkString onShortName() SK_OVERRIDE { | 53 SkString onShortName() SK_OVERRIDE { |
| 52 return SkString("shadertext2"); | 54 return SkString("shadertext2"); |
| 53 } | 55 } |
| 54 | 56 |
| 55 SkISize onISize() SK_OVERRIDE { return SkISize::Make(1800, 900); } | 57 SkISize onISize() SK_OVERRIDE { return SkISize::Make(1800, 900); } |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 1.2f * w, 2.f * kPointSize), | 169 1.2f * w, 2.f * kPointSize), |
| 168 225.f, 359.f, | 170 225.f, 359.f, |
| 169 false); | 171 false); |
| 170 path.close(); | 172 path.close(); |
| 171 | 173 |
| 172 canvas->translate(0.f, kPointSize + kPadY); | 174 canvas->translate(0.f, kPointSize + kPadY); |
| 173 columnH += kPointSize + kPadY; | 175 columnH += kPointSize + kPadY; |
| 174 | 176 |
| 175 canvas->save(); | 177 canvas->save(); |
| 176 canvas->concat(matrices[m].fMatrix); | 178 canvas->concat(matrices[m].fMatrix); |
| 177 canvas->drawTextOnPath(kText, kTextLen, path, NULL, pain
t); | 179 canvas->drawTextOnPath(kText, kTextLen, path, NULL, fMet
hod, paint); |
| 178 canvas->drawTextOnPath(kText, kTextLen, path, NULL, outl
inePaint); | 180 canvas->drawTextOnPath(kText, kTextLen, path, NULL, fMet
hod, outlinePaint); |
| 179 canvas->restore(); | 181 canvas->restore(); |
| 180 SkPaint stroke; | 182 SkPaint stroke; |
| 181 stroke.setStyle(SkPaint::kStroke_Style); | 183 stroke.setStyle(SkPaint::kStroke_Style); |
| 182 canvas->translate(0.f, kPointSize + kPadY); | 184 canvas->translate(0.f, kPointSize + kPadY); |
| 183 columnH += kPointSize + kPadY; | 185 columnH += kPointSize + kPadY; |
| 184 } | 186 } |
| 185 canvas->restore(); | 187 canvas->restore(); |
| 186 canvas->translate(w + kPadX, 0.f); | 188 canvas->translate(w + kPadX, 0.f); |
| 187 } | 189 } |
| 188 if (0 == s) { | 190 if (0 == s) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 201 | 203 |
| 202 private: | 204 private: |
| 203 typedef GM INHERITED; | 205 typedef GM INHERITED; |
| 204 }; | 206 }; |
| 205 | 207 |
| 206 /////////////////////////////////////////////////////////////////////////////// | 208 /////////////////////////////////////////////////////////////////////////////// |
| 207 | 209 |
| 208 static GM* MyFactory(void*) { return new ShaderText2GM; } | 210 static GM* MyFactory(void*) { return new ShaderText2GM; } |
| 209 static GMRegistry reg(MyFactory); | 211 static GMRegistry reg(MyFactory); |
| 210 } | 212 } |
| OLD | NEW |