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 <stdio.h> | 8 #include <stdio.h> |
9 | 9 |
10 #include <GL/osmesa.h> | 10 #include <GL/osmesa.h> |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 105 } |
106 if (options.gpu) { | 106 if (options.gpu) { |
107 OSMesaContext osMesaContext = create_osmesa_context(); | 107 OSMesaContext osMesaContext = create_osmesa_context(); |
108 SkAutoTUnref<GrContext> grContext(create_mesa_grcontext()); | 108 SkAutoTUnref<GrContext> grContext(create_mesa_grcontext()); |
109 if (!grContext) { | 109 if (!grContext) { |
110 fputs("Unable to get Mesa GrContext.\n", stderr); | 110 fputs("Unable to get Mesa GrContext.\n", stderr); |
111 } else { | 111 } else { |
112 SkAutoTUnref<SkSurface> surface( | 112 SkAutoTUnref<SkSurface> surface( |
113 SkSurface::NewRenderTarget( | 113 SkSurface::NewRenderTarget( |
114 grContext, | 114 grContext, |
115 SkBudgeted::kNo, | 115 SkSurface::kNo_Budgeted, |
116 SkImageInfo::MakeN32Premul(options.size))); | 116 SkImageInfo::MakeN32Premul(options.size))); |
117 if (!surface) { | 117 if (!surface) { |
118 fputs("Unable to get render surface.\n", stderr); | 118 fputs("Unable to get render surface.\n", stderr); |
119 exit(1); | 119 exit(1); |
120 } | 120 } |
121 draw(surface->getCanvas()); | 121 draw(surface->getCanvas()); |
122 gpuData.reset(encode_snapshot(surface)); | 122 gpuData.reset(encode_snapshot(surface)); |
123 } | 123 } |
124 if (osMesaContext) { | 124 if (osMesaContext) { |
125 OSMesaDestroyContext(osMesaContext); | 125 OSMesaDestroyContext(osMesaContext); |
(...skipping 20 matching lines...) Expand all Loading... |
146 printf("{\n"); | 146 printf("{\n"); |
147 dump_output(rasterData, "Raster", !gpuData && !pdfData && !skpData); | 147 dump_output(rasterData, "Raster", !gpuData && !pdfData && !skpData); |
148 dump_output(gpuData, "Gpu", !pdfData && !skpData); | 148 dump_output(gpuData, "Gpu", !pdfData && !skpData); |
149 dump_output(pdfData, "Pdf", !skpData); | 149 dump_output(pdfData, "Pdf", !skpData); |
150 dump_output(skpData, "Skp"); | 150 dump_output(skpData, "Skp"); |
151 printf("}\n"); | 151 printf("}\n"); |
152 | 152 |
153 SkSafeSetNull(image); | 153 SkSafeSetNull(image); |
154 return 0; | 154 return 0; |
155 } | 155 } |
OLD | NEW |