| 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 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include "SkForceLinking.h" | 10 #include "SkForceLinking.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 encode_to_base64(data->data(), data->size(), stdout); | 57 encode_to_base64(data->data(), data->size(), stdout); |
| 58 fputs(last ? "\"\n" : "\",\n", stdout); | 58 fputs(last ? "\"\n" : "\",\n", stdout); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 static SkData* encode_snapshot(const sk_sp<SkSurface>& surface) { | 62 static SkData* encode_snapshot(const sk_sp<SkSurface>& surface) { |
| 63 sk_sp<SkImage> img(surface->makeImageSnapshot()); | 63 sk_sp<SkImage> img(surface->makeImageSnapshot()); |
| 64 return img ? img->encode() : nullptr; | 64 return img ? img->encode() : nullptr; |
| 65 } | 65 } |
| 66 | 66 |
| 67 #if defined(__linux) | 67 #if defined(__linux) && !defined(__ANDROID__) |
| 68 #include <GL/osmesa.h> | 68 #include <GL/osmesa.h> |
| 69 static sk_sp<GrContext> create_grcontext() { | 69 static sk_sp<GrContext> create_grcontext() { |
| 70 // We just leak the OSMesaContext... the process will die soon anyway. | 70 // We just leak the OSMesaContext... the process will die soon anyway. |
| 71 if (OSMesaContext osMesaContext = OSMesaCreateContextExt(OSMESA_BGRA, 0,
0, 0, nullptr)) { | 71 if (OSMesaContext osMesaContext = OSMesaCreateContextExt(OSMESA_BGRA, 0,
0, 0, nullptr)) { |
| 72 static uint32_t buffer[16 * 16]; | 72 static uint32_t buffer[16 * 16]; |
| 73 OSMesaMakeCurrent(osMesaContext, &buffer, GL_UNSIGNED_BYTE, 16, 16); | 73 OSMesaMakeCurrent(osMesaContext, &buffer, GL_UNSIGNED_BYTE, 16, 16); |
| 74 } | 74 } |
| 75 | 75 |
| 76 auto osmesa_get = [](void* ctx, const char name[]) { | 76 auto osmesa_get = [](void* ctx, const char name[]) { |
| 77 SkASSERT(nullptr == ctx); | 77 SkASSERT(nullptr == ctx); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 155 |
| 156 printf("{\n"); | 156 printf("{\n"); |
| 157 dump_output(rasterData, "Raster", !gpuData && !pdfData && !skpData); | 157 dump_output(rasterData, "Raster", !gpuData && !pdfData && !skpData); |
| 158 dump_output(gpuData, "Gpu", !pdfData && !skpData); | 158 dump_output(gpuData, "Gpu", !pdfData && !skpData); |
| 159 dump_output(pdfData, "Pdf", !skpData); | 159 dump_output(pdfData, "Pdf", !skpData); |
| 160 dump_output(skpData, "Skp"); | 160 dump_output(skpData, "Skp"); |
| 161 printf("}\n"); | 161 printf("}\n"); |
| 162 | 162 |
| 163 return 0; | 163 return 0; |
| 164 } | 164 } |
| OLD | NEW |