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

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

Issue 1845923004: Rename enums in GrContextFactory to remove "GL" (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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 GLTestContext* gl = factory->getContextInfo(GrContextFactory::kNativeGL_Cont extType,
69 GrContextFactory::kNone_GLContextOpt ions).fGLContext; 69 GrContextFactory::kNone_ContextOptio ns).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();
79 return target; 79 return target;
(...skipping 22 matching lines...) Expand all
102 SkDynamicMemoryWStream outStream; 102 SkDynamicMemoryWStream outStream;
103 103
104 SkAutoTUnref<SkPixelSerializer> serializer(SkImageEncoder::CreatePixelSerial izer()); 104 SkAutoTUnref<SkPixelSerializer> serializer(SkImageEncoder::CreatePixelSerial izer());
105 picture->serialize(&outStream, serializer); 105 picture->serialize(&outStream, serializer);
106 106
107 return outStream.copyToData(); 107 return outStream.copyToData();
108 } 108 }
109 109
110 GrContext* Request::getContext() { 110 GrContext* Request::getContext() {
111 #if SK_SUPPORT_GPU 111 #if SK_SUPPORT_GPU
112 return fContextFactory->get(GrContextFactory::kNative_GLContextType, 112 return fContextFactory->get(GrContextFactory::kNativeGL_ContextType,
113 GrContextFactory::kNone_GLContextOptions); 113 GrContextFactory::kNone_ContextOptions);
114 #else 114 #else
115 return nullptr; 115 return nullptr;
116 #endif 116 #endif
117 } 117 }
118 118
119 SkIRect Request::getBounds() { 119 SkIRect Request::getBounds() {
120 SkIRect bounds; 120 SkIRect bounds;
121 if (fPicture) { 121 if (fPicture) {
122 bounds = fPicture->cullRect().roundOut(); 122 bounds = fPicture->cullRect().roundOut();
123 if (fGPUEnabled) { 123 if (fGPUEnabled) {
(...skipping 125 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