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

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

Issue 1850543003: Revert of rename sk_gpu_test::GLContext to sk_gpu_test::GLTestContext (Closed) Base URL: https://chromium.googlesource.com/skia.git@move
Patch Set: Created 4 years, 8 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // write to png 58 // write to png
59 SkDynamicMemoryWStream buffer; 59 SkDynamicMemoryWStream buffer;
60 SkDrawCommand::WritePNG((const png_bytep) bmp->getPixels(), bmp->width(), bm p->height(), 60 SkDrawCommand::WritePNG((const png_bytep) bmp->getPixels(), bmp->width(), bm p->height(),
61 buffer); 61 buffer);
62 return buffer.copyToData(); 62 return buffer.copyToData();
63 } 63 }
64 64
65 SkCanvas* Request::getCanvas() { 65 SkCanvas* Request::getCanvas() {
66 #if SK_SUPPORT_GPU 66 #if SK_SUPPORT_GPU
67 GrContextFactory* factory = fContextFactory; 67 GrContextFactory* factory = fContextFactory;
68 GLTestContext* gl = factory->getContextInfo(GrContextFactory::kNative_GLCont extType, 68 GLContext* gl = factory->getContextInfo(GrContextFactory::kNative_GLContextT ype,
69 GrContextFactory::kNone_GLContextOpt ions).fGLContext; 69 GrContextFactory::kNone_GLContextOpt ions).fGLContext;
70 gl->makeCurrent(); 70 gl->makeCurrent();
71 #endif 71 #endif
72 SkASSERT(fDebugCanvas); 72 SkASSERT(fDebugCanvas);
73 73
74 // create the appropriate surface if necessary 74 // create the appropriate surface if necessary
75 if (!fSurface) { 75 if (!fSurface) {
76 this->enableGPU(fGPUEnabled); 76 this->enableGPU(fGPUEnabled);
77 } 77 }
78 SkCanvas* target = fSurface->getCanvas(); 78 SkCanvas* target = fSurface->getCanvas();
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 SkCanvas* canvas = this->getCanvas(); 249 SkCanvas* canvas = this->getCanvas();
250 canvas->flush(); 250 canvas->flush();
251 SkAutoTDelete<SkBitmap> bitmap(this->getBitmapFromCanvas(canvas)); 251 SkAutoTDelete<SkBitmap> bitmap(this->getBitmapFromCanvas(canvas));
252 SkASSERT(bitmap); 252 SkASSERT(bitmap);
253 bitmap->lockPixels(); 253 bitmap->lockPixels();
254 uint8_t* start = ((uint8_t*) bitmap->getPixels()) + (y * bitmap->width() + x ) * 4; 254 uint8_t* start = ((uint8_t*) bitmap->getPixels()) + (y * bitmap->width() + x ) * 4;
255 SkColor result = SkColorSetARGB(start[3], start[0], start[1], start[2]); 255 SkColor result = SkColorSetARGB(start[3], start[0], start[1], start[2]);
256 bitmap->unlockPixels(); 256 bitmap->unlockPixels();
257 return result; 257 return result;
258 } 258 }
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