OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 | 8 |
9 /* | 9 /* |
10 * Tests text rendering with LCD and the various blend modes. | 10 * Tests text rendering with LCD and the various blend modes. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 void onDraw(SkCanvas* canvas) override { | 55 void onDraw(SkCanvas* canvas) override { |
56 SkPaint p; | 56 SkPaint p; |
57 p.setAntiAlias(false); | 57 p.setAntiAlias(false); |
58 p.setStyle(SkPaint::kFill_Style); | 58 p.setStyle(SkPaint::kFill_Style); |
59 p.setShader(fCheckerboard); | 59 p.setShader(fCheckerboard); |
60 SkRect r = SkRect::MakeWH(SkIntToScalar(kWidth), SkIntToScalar(kHeight))
; | 60 SkRect r = SkRect::MakeWH(SkIntToScalar(kWidth), SkIntToScalar(kHeight))
; |
61 canvas->drawRect(r, p); | 61 canvas->drawRect(r, p); |
62 | 62 |
63 SkImageInfo info = SkImageInfo::MakeN32Premul(kWidth, kHeight); | 63 SkImageInfo info = SkImageInfo::MakeN32Premul(kWidth, kHeight); |
64 SkAutoTUnref<SkSurface> surface(canvas->newSurface(info)); | 64 auto surface(canvas->makeSurface(info)); |
65 if (nullptr == surface) { | 65 if (nullptr == surface) { |
66 surface.reset(SkSurface::NewRaster(info)); | 66 surface = SkSurface::MakeRaster(info); |
67 } | 67 } |
68 | 68 |
69 SkCanvas* surfCanvas = surface->getCanvas(); | 69 SkCanvas* surfCanvas = surface->getCanvas(); |
70 this->drawColumn(surfCanvas, SK_ColorBLACK, SK_ColorWHITE, false); | 70 this->drawColumn(surfCanvas, SK_ColorBLACK, SK_ColorWHITE, false); |
71 surfCanvas->translate(SkIntToScalar(kColWidth), 0); | 71 surfCanvas->translate(SkIntToScalar(kColWidth), 0); |
72 this->drawColumn(surfCanvas, SK_ColorWHITE, SK_ColorBLACK, false); | 72 this->drawColumn(surfCanvas, SK_ColorWHITE, SK_ColorBLACK, false); |
73 surfCanvas->translate(SkIntToScalar(kColWidth), 0); | 73 surfCanvas->translate(SkIntToScalar(kColWidth), 0); |
74 this->drawColumn(surfCanvas, SK_ColorGREEN, SK_ColorMAGENTA, false); | 74 this->drawColumn(surfCanvas, SK_ColorGREEN, SK_ColorMAGENTA, false); |
75 surfCanvas->translate(SkIntToScalar(kColWidth), 0); | 75 surfCanvas->translate(SkIntToScalar(kColWidth), 0); |
76 this->drawColumn(surfCanvas, SK_ColorCYAN, SK_ColorMAGENTA, true); | 76 this->drawColumn(surfCanvas, SK_ColorCYAN, SK_ColorMAGENTA, true); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 private: | 146 private: |
147 SkScalar fTextHeight; | 147 SkScalar fTextHeight; |
148 sk_sp<SkShader> fCheckerboard; | 148 sk_sp<SkShader> fCheckerboard; |
149 typedef skiagm::GM INHERITED; | 149 typedef skiagm::GM INHERITED; |
150 }; | 150 }; |
151 | 151 |
152 ////////////////////////////////////////////////////////////////////////////// | 152 ////////////////////////////////////////////////////////////////////////////// |
153 | 153 |
154 DEF_GM( return new LcdBlendGM; ) | 154 DEF_GM( return new LcdBlendGM; ) |
155 } | 155 } |
OLD | NEW |