| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 | 9 |
| 10 #include "Sk2DPathEffect.h" | 10 #include "Sk2DPathEffect.h" |
| 11 #include "SkBlurMask.h" | 11 #include "SkBlurMask.h" |
| 12 #include "SkBlurMaskFilter.h" | 12 #include "SkBlurMaskFilter.h" |
| 13 #include "SkColorFilter.h" | 13 #include "SkColorFilter.h" |
| 14 #include "SkCanvas.h" | 14 #include "SkCanvas.h" |
| 15 #include "SkGradientShader.h" | 15 #include "SkGradientShader.h" |
| 16 #include "SkGraphics.h" | 16 #include "SkGraphics.h" |
| 17 #include "SkLayerDrawLooper.h" | 17 #include "SkLayerDrawLooper.h" |
| 18 #include "SkRandom.h" | 18 #include "SkRandom.h" |
| 19 #include "SkTextBlob.h" | 19 #include "SkTextBlob.h" |
| 20 | 20 |
| 21 namespace skiagm { | 21 namespace skiagm { |
| 22 | 22 |
| 23 static const int kWidth = 1250; | 23 static const int kWidth = 1250; |
| 24 static const int kHeight = 700; | 24 static const int kHeight = 700; |
| 25 | 25 |
| 26 // Unlike the variant in sk_tool_utils, this version positions the glyphs on a d
iagonal |
| 26 static void add_to_text_blob(SkTextBlobBuilder* builder, const char* text, const
SkPaint& origPaint, | 27 static void add_to_text_blob(SkTextBlobBuilder* builder, const char* text, const
SkPaint& origPaint, |
| 27 SkScalar x, SkScalar y) { | 28 SkScalar x, SkScalar y) { |
| 28 SkPaint paint(origPaint); | 29 SkPaint paint(origPaint); |
| 29 SkTDArray<uint16_t> glyphs; | 30 SkTDArray<uint16_t> glyphs; |
| 30 | 31 |
| 31 size_t len = strlen(text); | 32 size_t len = strlen(text); |
| 32 glyphs.append(paint.textToGlyphs(text, len, NULL)); | 33 glyphs.append(paint.textToGlyphs(text, len, NULL)); |
| 33 paint.textToGlyphs(text, len, glyphs.begin()); | 34 paint.textToGlyphs(text, len, glyphs.begin()); |
| 34 | 35 |
| 35 const SkScalar advanceX = paint.getTextSize() * 0.85f; | 36 const SkScalar advanceX = paint.getTextSize() * 0.85f; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 SkAutoTUnref<const SkTextBlob> fBlob; | 249 SkAutoTUnref<const SkTextBlob> fBlob; |
| 249 SkTArray<SkAutoTUnref<SkLayerDrawLooper>, true> fLoopers; | 250 SkTArray<SkAutoTUnref<SkLayerDrawLooper>, true> fLoopers; |
| 250 | 251 |
| 251 typedef GM INHERITED; | 252 typedef GM INHERITED; |
| 252 }; | 253 }; |
| 253 | 254 |
| 254 ////////////////////////////////////////////////////////////////////////////// | 255 ////////////////////////////////////////////////////////////////////////////// |
| 255 | 256 |
| 256 DEF_GM( return SkNEW(TextBlobLooperGM); ) | 257 DEF_GM( return SkNEW(TextBlobLooperGM); ) |
| 257 } | 258 } |
| OLD | NEW |