| 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 | 7 |
| 8 #include "gm.h" | 8 #include "gm.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 SkShader::kClamp_TileMode); | 50 SkShader::kClamp_TileMode); |
| 51 paint.setShader(s)->unref(); | 51 paint.setShader(s)->unref(); |
| 52 canvas.drawPaint(paint); | 52 canvas.drawPaint(paint); |
| 53 return bm; | 53 return bm; |
| 54 } | 54 } |
| 55 | 55 |
| 56 static void show_k_text(SkCanvas* canvas, SkScalar x, SkScalar y, const SkScalar
k[]) { | 56 static void show_k_text(SkCanvas* canvas, SkScalar x, SkScalar y, const SkScalar
k[]) { |
| 57 SkPaint paint; | 57 SkPaint paint; |
| 58 paint.setTextSize(SkIntToScalar(24)); | 58 paint.setTextSize(SkIntToScalar(24)); |
| 59 paint.setAntiAlias(true); | 59 paint.setAntiAlias(true); |
| 60 sk_tool_utils::set_portable_typeface(&paint); |
| 60 for (int i = 0; i < 4; ++i) { | 61 for (int i = 0; i < 4; ++i) { |
| 61 SkString str; | 62 SkString str; |
| 62 str.appendScalar(k[i]); | 63 str.appendScalar(k[i]); |
| 63 SkScalar width = paint.measureText(str.c_str(), str.size()); | 64 SkScalar width = paint.measureText(str.c_str(), str.size()); |
| 64 canvas->drawText(str.c_str(), str.size(), x, y + paint.getTextSize(), pa
int); | 65 canvas->drawText(str.c_str(), str.size(), x, y + paint.getTextSize(), pa
int); |
| 65 x += width + SkIntToScalar(10); | 66 x += width + SkIntToScalar(10); |
| 66 } | 67 } |
| 67 } | 68 } |
| 68 | 69 |
| 69 class ArithmodeGM : public skiagm::GM { | 70 class ArithmodeGM : public skiagm::GM { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 } | 124 } |
| 124 | 125 |
| 125 private: | 126 private: |
| 126 typedef GM INHERITED; | 127 typedef GM INHERITED; |
| 127 }; | 128 }; |
| 128 | 129 |
| 129 /////////////////////////////////////////////////////////////////////////////// | 130 /////////////////////////////////////////////////////////////////////////////// |
| 130 | 131 |
| 131 static skiagm::GM* MyFactory(void*) { return new ArithmodeGM; } | 132 static skiagm::GM* MyFactory(void*) { return new ArithmodeGM; } |
| 132 static skiagm::GMRegistry reg(MyFactory); | 133 static skiagm::GMRegistry reg(MyFactory); |
| OLD | NEW |