| 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 "gm.h" | 8 #include "gm.h" | 
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" | 
| 10 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" | 
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 176         path.arcTo(SkRect::MakeXYWH(SkIntToScalar(-40), SkIntToScalar(15), | 176         path.arcTo(SkRect::MakeXYWH(SkIntToScalar(-40), SkIntToScalar(15), | 
| 177                                     SkIntToScalar(300), SkIntToScalar(90)), | 177                                     SkIntToScalar(300), SkIntToScalar(90)), | 
| 178                                     SkIntToScalar(225), SkIntToScalar(90), | 178                                     SkIntToScalar(225), SkIntToScalar(90), | 
| 179                                     false); | 179                                     false); | 
| 180         path.close(); | 180         path.close(); | 
| 181 | 181 | 
| 182         static const int testsPerCol = 8; | 182         static const int testsPerCol = 8; | 
| 183         static const int rowHeight = 60; | 183         static const int rowHeight = 60; | 
| 184         static const int colWidth = 300; | 184         static const int colWidth = 300; | 
| 185         canvas->save(); | 185         canvas->save(); | 
| 186         for (size_t s = 0; s < SK_ARRAY_COUNT(shaders); s++) { | 186         for (int s = 0; s < static_cast<int>(SK_ARRAY_COUNT(shaders)); s++) { | 
| 187             canvas->save(); | 187             canvas->save(); | 
| 188             int i = 2*s; | 188             int i = 2*s; | 
| 189             canvas->translate(SkIntToScalar((i / testsPerCol) * colWidth), | 189             canvas->translate(SkIntToScalar((i / testsPerCol) * colWidth), | 
| 190                               SkIntToScalar((i % testsPerCol) * rowHeight)); | 190                               SkIntToScalar((i % testsPerCol) * rowHeight)); | 
| 191             paint.setShader(shaders[s])->unref(); | 191             paint.setShader(shaders[s])->unref(); | 
| 192             canvas->drawText(text, textLen, 0, textBase, paint); | 192             canvas->drawText(text, textLen, 0, textBase, paint); | 
| 193             canvas->restore(); | 193             canvas->restore(); | 
| 194             canvas->save(); | 194             canvas->save(); | 
| 195             ++i; | 195             ++i; | 
| 196             canvas->translate(SkIntToScalar((i / testsPerCol) * colWidth), | 196             canvas->translate(SkIntToScalar((i / testsPerCol) * colWidth), | 
| 197                               SkIntToScalar((i % testsPerCol) * rowHeight)); | 197                               SkIntToScalar((i % testsPerCol) * rowHeight)); | 
| 198             canvas->drawTextOnPath(text, textLen, path, NULL, paint); | 198             canvas->drawTextOnPath(text, textLen, path, NULL, paint); | 
| 199             canvas->restore(); | 199             canvas->restore(); | 
| 200         } | 200         } | 
| 201         canvas->restore(); | 201         canvas->restore(); | 
| 202 | 202 | 
| 203     } | 203     } | 
| 204 | 204 | 
| 205 private: | 205 private: | 
| 206     typedef GM INHERITED; | 206     typedef GM INHERITED; | 
| 207 }; | 207 }; | 
| 208 | 208 | 
| 209 /////////////////////////////////////////////////////////////////////////////// | 209 /////////////////////////////////////////////////////////////////////////////// | 
| 210 | 210 | 
| 211 #ifndef SK_BUILD_FOR_ANDROID | 211 #ifndef SK_BUILD_FOR_ANDROID | 
| 212 static GM* MyFactory(void*) { return new ShaderTextGM; } | 212 static GM* MyFactory(void*) { return new ShaderTextGM; } | 
| 213 static GMRegistry reg(MyFactory); | 213 static GMRegistry reg(MyFactory); | 
| 214 #endif | 214 #endif | 
| 215 } | 215 } | 
| OLD | NEW | 
|---|