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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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::MakeN32(kWidth, kHeight, kPremul_SkAlpha
Type, |
101 sk_ref_sp(canvas->imageInfo().co
lorSpace())); | 101 sk_ref_sp(canvas->imageInfo().co
lorSpace())); |
102 SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType); | 102 SkSurfaceProps props(0, kUnknown_SkPixelGeometry); |
103 uint32_t gammaCorrect = canvas->getProps(&canvasProps) | |
104 ? canvasProps.flags() & SkSurfaceProps::kGammaCorrect_Flag : 0; | |
105 SkSurfaceProps props(gammaCorrect, kUnknown_SkPixelGeometry); | |
106 auto surface(canvas->makeSurface(info, &props)); | 103 auto surface(canvas->makeSurface(info, &props)); |
107 if (surface) { | 104 if (surface) { |
108 SkPaint paint; | 105 SkPaint paint; |
109 paint.setAntiAlias(true); | 106 paint.setAntiAlias(true); |
110 | 107 |
111 SkCanvas* c = surface->getCanvas(); | 108 SkCanvas* c = surface->getCanvas(); |
112 | 109 |
113 int stride = SkScalarCeilToInt(fBlob->bounds().height()); | 110 int stride = SkScalarCeilToInt(fBlob->bounds().height()); |
114 int yOffset = stride / 8; | 111 int yOffset = stride / 8; |
115 for (int i = 0; i < 1; i++) { | 112 for (int i = 0; i < 1; i++) { |
(...skipping 29 matching lines...) Expand all Loading... |
145 static const int kHeight = 1600; | 142 static const int kHeight = 1600; |
146 | 143 |
147 typedef GM INHERITED; | 144 typedef GM INHERITED; |
148 }; | 145 }; |
149 | 146 |
150 ////////////////////////////////////////////////////////////////////////////// | 147 ////////////////////////////////////////////////////////////////////////////// |
151 | 148 |
152 DEF_GM(return new TextBlobRandomFont;) | 149 DEF_GM(return new TextBlobRandomFont;) |
153 } | 150 } |
154 #endif | 151 #endif |
OLD | NEW |