| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
| 11 | 11 |
| 12 /** | 12 /** |
| 13 * This test exercises drawPosTextH and drawPosText with every text align. | 13 * This test exercises drawPosTextH and drawPosText with every text align. |
| 14 */ | 14 */ |
| 15 static const int kWidth = 480; | 15 static const int kWidth = 480; |
| 16 static const int kHeight = 600; | 16 static const int kHeight = 600; |
| 17 static const SkScalar kTextHeight = 64.0f; | 17 static const SkScalar kTextHeight = 64.0f; |
| 18 static const int kMaxStringLength = 12; | 18 static const int kMaxStringLength = 12; |
| 19 | 19 |
| 20 namespace skiagm { | 20 namespace skiagm { |
| 21 | 21 |
| 22 class GlyphPosAlignGM : public GM { | 22 class GlyphPosAlignGM : public GM { |
| 23 protected: | 23 protected: |
| 24 virtual uint32_t onGetFlags() const SK_OVERRIDE { | 24 uint32_t onGetFlags() const SK_OVERRIDE { |
| 25 return kSkipTiled_Flag; | 25 return kSkipTiled_Flag; |
| 26 } | 26 } |
| 27 | 27 |
| 28 virtual SkString onShortName() SK_OVERRIDE { | 28 SkString onShortName() SK_OVERRIDE { |
| 29 return SkString("glyph_pos_align"); | 29 return SkString("glyph_pos_align"); |
| 30 } | 30 } |
| 31 | 31 |
| 32 virtual SkISize onISize() SK_OVERRIDE { return SkISize::Make(kWidth, kHeight
); } | 32 SkISize onISize() SK_OVERRIDE { return SkISize::Make(kWidth, kHeight); } |
| 33 | 33 |
| 34 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 34 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| 35 canvas->clear(SK_ColorBLACK); | 35 canvas->clear(SK_ColorBLACK); |
| 36 | 36 |
| 37 SkPaint paint; | 37 SkPaint paint; |
| 38 paint.setTextSize(kTextHeight); | 38 paint.setTextSize(kTextHeight); |
| 39 paint.setFakeBoldText(true); | 39 paint.setFakeBoldText(true); |
| 40 const SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE }; | 40 const SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE }; |
| 41 const SkPoint pts[] = {{0, 0}, {kWidth, kHeight}}; | 41 const SkPoint pts[] = {{0, 0}, {kWidth, kHeight}}; |
| 42 SkAutoTUnref<SkShader> grad(SkGradientShader::CreateLinear(pts, colors,
NULL, | 42 SkAutoTUnref<SkShader> grad(SkGradientShader::CreateLinear(pts, colors,
NULL, |
| 43 SK_ARRAY_COUN
T(colors), | 43 SK_ARRAY_COUN
T(colors), |
| 44 SkShader::kMi
rror_TileMode)); | 44 SkShader::kMi
rror_TileMode)); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 ////////////////////////////////////////////////////////////////////////////// | 91 ////////////////////////////////////////////////////////////////////////////// |
| 92 | 92 |
| 93 static GM* GlyphPosAlignFactory(void*) { | 93 static GM* GlyphPosAlignFactory(void*) { |
| 94 return new GlyphPosAlignGM(); | 94 return new GlyphPosAlignGM(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 static GMRegistry reg(GlyphPosAlignFactory); | 97 static GMRegistry reg(GlyphPosAlignFactory); |
| 98 | 98 |
| 99 } | 99 } |
| OLD | NEW |