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 #include "gm.h" | 8 #include "gm.h" |
9 | 9 |
10 #include "Resources.h" | 10 #include "Resources.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 void onDraw(SkCanvas* canvas) override { | 91 void onDraw(SkCanvas* canvas) override { |
92 // This GM exists to test a specific feature of the GPU backend. | 92 // This GM exists to test a specific feature of the GPU backend. |
93 if (nullptr == canvas->getGrContext()) { | 93 if (nullptr == canvas->getGrContext()) { |
94 skiagm::GM::DrawGpuOnlyMessage(canvas); | 94 skiagm::GM::DrawGpuOnlyMessage(canvas); |
95 return; | 95 return; |
96 } | 96 } |
97 | 97 |
98 canvas->drawColor(sk_tool_utils::color_to_565(SK_ColorWHITE)); | 98 canvas->drawColor(sk_tool_utils::color_to_565(SK_ColorWHITE)); |
99 | 99 |
100 SkImageInfo info = SkImageInfo::MakeN32(kWidth, kHeight, kPremul_SkAlpha
Type, | 100 SkImageInfo info = SkImageInfo::MakeN32Premul(kWidth, kHeight, |
101 sk_ref_sp(canvas->imageInfo().co
lorSpace())); | 101 canvas->imageInfo().profil
eType()); |
102 SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType); | 102 SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType); |
103 uint32_t gammaCorrect = canvas->getProps(&canvasProps) | 103 uint32_t gammaCorrect = canvas->getProps(&canvasProps) |
104 ? canvasProps.flags() & SkSurfaceProps::kGammaCorrect_Flag : 0; | 104 ? canvasProps.flags() & SkSurfaceProps::kGammaCorrect_Flag : 0; |
105 SkSurfaceProps props(gammaCorrect, kUnknown_SkPixelGeometry); | 105 SkSurfaceProps props(gammaCorrect, kUnknown_SkPixelGeometry); |
106 auto surface(canvas->makeSurface(info, &props)); | 106 auto surface(canvas->makeSurface(info, &props)); |
107 if (surface) { | 107 if (surface) { |
108 SkPaint paint; | 108 SkPaint paint; |
109 paint.setAntiAlias(true); | 109 paint.setAntiAlias(true); |
110 | 110 |
111 SkCanvas* c = surface->getCanvas(); | 111 SkCanvas* c = surface->getCanvas(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 static const int kHeight = 1600; | 145 static const int kHeight = 1600; |
146 | 146 |
147 typedef GM INHERITED; | 147 typedef GM INHERITED; |
148 }; | 148 }; |
149 | 149 |
150 ////////////////////////////////////////////////////////////////////////////// | 150 ////////////////////////////////////////////////////////////////////////////// |
151 | 151 |
152 DEF_GM(return new TextBlobRandomFont;) | 152 DEF_GM(return new TextBlobRandomFont;) |
153 } | 153 } |
154 #endif | 154 #endif |
OLD | NEW |