Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(602)

Side by Side Diff: tools/skiaserve/Request.cpp

Issue 2337163002: Add ContextOptions field to SkCommandLineConfigGpu (Closed)
Patch Set: Add ContextOptions field to SkCommandLineConfigGpu Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/gpu/GrContextFactory.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 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 "Request.h" 8 #include "Request.h"
9 9
10 #include "SkPictureRecorder.h" 10 #include "SkPictureRecorder.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 SkDynamicMemoryWStream buffer; 65 SkDynamicMemoryWStream buffer;
66 SkDrawCommand::WritePNG((const png_bytep) encodedBitmap->bytes(), bmp->width (), bmp->height(), 66 SkDrawCommand::WritePNG((const png_bytep) encodedBitmap->bytes(), bmp->width (), bmp->height(),
67 buffer, true); 67 buffer, true);
68 return buffer.detachAsData(); 68 return buffer.detachAsData();
69 } 69 }
70 70
71 SkCanvas* Request::getCanvas() { 71 SkCanvas* Request::getCanvas() {
72 #if SK_SUPPORT_GPU 72 #if SK_SUPPORT_GPU
73 GrContextFactory* factory = fContextFactory; 73 GrContextFactory* factory = fContextFactory;
74 GLTestContext* gl = factory->getContextInfo(GrContextFactory::kNativeGL_Cont extType, 74 GLTestContext* gl = factory->getContextInfo(GrContextFactory::kNativeGL_Cont extType,
75 GrContextFactory::kNone_ContextO ptions).glContext(); 75 GrContextFactory::ContextOptions: :kNone).glContext();
76 if (!gl) { 76 if (!gl) {
77 gl = factory->getContextInfo(GrContextFactory::kMESA_ContextType, 77 gl = factory->getContextInfo(GrContextFactory::kMESA_ContextType,
78 GrContextFactory::kNone_ContextOptions).glC ontext(); 78 GrContextFactory::ContextOptions::kNone).gl Context();
79 } 79 }
80 if (gl) { 80 if (gl) {
81 gl->makeCurrent(); 81 gl->makeCurrent();
82 } 82 }
83 #endif 83 #endif
84 SkASSERT(fDebugCanvas); 84 SkASSERT(fDebugCanvas);
85 85
86 // create the appropriate surface if necessary 86 // create the appropriate surface if necessary
87 if (!fSurface) { 87 if (!fSurface) {
88 this->enableGPU(fGPUEnabled); 88 this->enableGPU(fGPUEnabled);
(...skipping 27 matching lines...) Expand all
116 116
117 SkAutoTUnref<SkPixelSerializer> serializer(SkImageEncoder::CreatePixelSerial izer()); 117 SkAutoTUnref<SkPixelSerializer> serializer(SkImageEncoder::CreatePixelSerial izer());
118 picture->serialize(&outStream, serializer); 118 picture->serialize(&outStream, serializer);
119 119
120 return outStream.detachAsData(); 120 return outStream.detachAsData();
121 } 121 }
122 122
123 GrContext* Request::getContext() { 123 GrContext* Request::getContext() {
124 #if SK_SUPPORT_GPU 124 #if SK_SUPPORT_GPU
125 GrContext* result = fContextFactory->get(GrContextFactory::kNativeGL_Context Type, 125 GrContext* result = fContextFactory->get(GrContextFactory::kNativeGL_Context Type,
126 GrContextFactory::kNone_ContextOpti ons); 126 GrContextFactory::ContextOptions::k None);
127 if (!result) { 127 if (!result) {
128 result = fContextFactory->get(GrContextFactory::kMESA_ContextType, 128 result = fContextFactory->get(GrContextFactory::kMESA_ContextType,
129 GrContextFactory::kNone_ContextOptions); 129 GrContextFactory::ContextOptions::kNone);
130 } 130 }
131 return result; 131 return result;
132 #else 132 #else
133 return nullptr; 133 return nullptr;
134 #endif 134 #endif
135 } 135 }
136 136
137 SkIRect Request::getBounds() { 137 SkIRect Request::getBounds() {
138 SkIRect bounds; 138 SkIRect bounds;
139 if (fPicture) { 139 if (fPicture) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 SkASSERT(bitmap); 300 SkASSERT(bitmap);
301 301
302 // Convert to format suitable for inspection 302 // Convert to format suitable for inspection
303 sk_sp<SkData> encodedBitmap = sk_tools::encode_bitmap_for_png(*bitmap); 303 sk_sp<SkData> encodedBitmap = sk_tools::encode_bitmap_for_png(*bitmap);
304 SkASSERT(encodedBitmap); 304 SkASSERT(encodedBitmap);
305 305
306 const uint8_t* start = encodedBitmap->bytes() + ((y * bitmap->width() + x) * 4); 306 const uint8_t* start = encodedBitmap->bytes() + ((y * bitmap->width() + x) * 4);
307 SkColor result = SkColorSetARGB(start[3], start[0], start[1], start[2]); 307 SkColor result = SkColorSetARGB(start[3], start[0], start[1], start[2]);
308 return result; 308 return result;
309 } 309 }
OLDNEW
« no previous file with comments | « tools/gpu/GrContextFactory.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698