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 BD-style license that can be | 4 * Use of this source code is governed by a BD-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 "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 paint.setTextSize(20); | 35 paint.setTextSize(20); |
36 paint.setAntiAlias(true); | 36 paint.setAntiAlias(true); |
37 paint.setLCDRenderText(true); | 37 paint.setLCDRenderText(true); |
38 | 38 |
39 SkTextBlobBuilder builder; | 39 SkTextBlobBuilder builder; |
40 | 40 |
41 sk_tool_utils::add_to_text_blob(&builder, text, paint, 10, 10); | 41 sk_tool_utils::add_to_text_blob(&builder, text, paint, 10, 10); |
42 | 42 |
43 SkAutoTUnref<const SkTextBlob> blob(builder.build()); | 43 SkAutoTUnref<const SkTextBlob> blob(builder.build()); |
44 | 44 |
45 SkImageInfo info = SkImageInfo::MakeN32(200, 200, kPremul_SkAlphaType, | 45 SkImageInfo info = SkImageInfo::MakeN32Premul(200, 200, canvas->imageInf
o().profileType()); |
46 sk_ref_sp(canvas->imageInfo().co
lorSpace())); | |
47 SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType); | 46 SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType); |
48 uint32_t gammaCorrect = canvas->getProps(&canvasProps) | 47 uint32_t gammaCorrect = canvas->getProps(&canvasProps) |
49 ? canvasProps.flags() & SkSurfaceProps::kGammaCorrect_Flag : 0; | 48 ? canvasProps.flags() & SkSurfaceProps::kGammaCorrect_Flag : 0; |
50 SkSurfaceProps props(gammaCorrect, kUnknown_SkPixelGeometry); | 49 SkSurfaceProps props(gammaCorrect, kUnknown_SkPixelGeometry); |
51 auto surface = canvas->makeSurface(info, &props); | 50 auto surface = canvas->makeSurface(info, &props); |
52 if (!surface) { | 51 if (!surface) { |
53 surface = SkSurface::MakeRaster(info, &props); | 52 surface = SkSurface::MakeRaster(info, &props); |
54 } | 53 } |
55 SkCanvas* c = surface->getCanvas(); | 54 SkCanvas* c = surface->getCanvas(); |
56 | 55 |
(...skipping 15 matching lines...) Expand all Loading... |
72 static const int kWidth = 200; | 71 static const int kWidth = 200; |
73 static const int kHeight = 200; | 72 static const int kHeight = 200; |
74 | 73 |
75 typedef GM INHERITED; | 74 typedef GM INHERITED; |
76 }; | 75 }; |
77 | 76 |
78 ////////////////////////////////////////////////////////////////////////////// | 77 ////////////////////////////////////////////////////////////////////////////// |
79 | 78 |
80 DEF_GM(return new TextBlobGeometryChange;) | 79 DEF_GM(return new TextBlobGeometryChange;) |
81 } | 80 } |
OLD | NEW |