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

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

Issue 1966013002: Turn ContextInfos returned by GrContextFactory into structs. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Address comment Created 4 years, 7 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/kilobench/kilobench.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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 SkDrawCommand::WritePNG((const png_bytep) encodedBitmap->writable_data(), 64 SkDrawCommand::WritePNG((const png_bytep) encodedBitmap->writable_data(),
65 bmp->width(), bmp->height(), 65 bmp->width(), bmp->height(),
66 buffer); 66 buffer);
67 return buffer.copyToData(); 67 return buffer.copyToData();
68 } 68 }
69 69
70 SkCanvas* Request::getCanvas() { 70 SkCanvas* Request::getCanvas() {
71 #if SK_SUPPORT_GPU 71 #if SK_SUPPORT_GPU
72 GrContextFactory* factory = fContextFactory; 72 GrContextFactory* factory = fContextFactory;
73 GLTestContext* gl = factory->getContextInfo(GrContextFactory::kNativeGL_Cont extType, 73 GLTestContext* gl = factory->getContextInfo(GrContextFactory::kNativeGL_Cont extType,
74 GrContextFactory::kNone_ContextOptio ns).fGLContext; 74 GrContextFactory::kNone_ContextOptio ns).glContext();
75 gl->makeCurrent(); 75 gl->makeCurrent();
76 #endif 76 #endif
77 SkASSERT(fDebugCanvas); 77 SkASSERT(fDebugCanvas);
78 78
79 // create the appropriate surface if necessary 79 // create the appropriate surface if necessary
80 if (!fSurface) { 80 if (!fSurface) {
81 this->enableGPU(fGPUEnabled); 81 this->enableGPU(fGPUEnabled);
82 } 82 }
83 SkCanvas* target = fSurface->getCanvas(); 83 SkCanvas* target = fSurface->getCanvas();
84 return target; 84 return target;
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 SkASSERT(bitmap); 292 SkASSERT(bitmap);
293 293
294 // Convert to format suitable for inspection 294 // Convert to format suitable for inspection
295 sk_sp<SkData> encodedBitmap = sk_tools::encode_bitmap_for_png(*bitmap); 295 sk_sp<SkData> encodedBitmap = sk_tools::encode_bitmap_for_png(*bitmap);
296 SkASSERT(encodedBitmap.get()); 296 SkASSERT(encodedBitmap.get());
297 297
298 const uint8_t* start = encodedBitmap->bytes() + ((y * bitmap->width() + x) * 4); 298 const uint8_t* start = encodedBitmap->bytes() + ((y * bitmap->width() + x) * 4);
299 SkColor result = SkColorSetARGB(start[3], start[0], start[1], start[2]); 299 SkColor result = SkColorSetARGB(start[3], start[0], start[1], start[2]);
300 return result; 300 return result;
301 } 301 }
OLDNEW
« no previous file with comments | « tools/kilobench/kilobench.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698