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

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

Issue 2281733003: tools: skp_parser (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: skpparser->skp_parser Created 4 years, 2 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/debugger/SkDrawCommand.cpp ('k') | tools/skp_parser.cpp » ('j') | 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // capture pixels 56 // capture pixels
57 SkAutoTDelete<SkBitmap> bmp(this->getBitmapFromCanvas(canvas)); 57 SkAutoTDelete<SkBitmap> bmp(this->getBitmapFromCanvas(canvas));
58 SkASSERT(bmp); 58 SkASSERT(bmp);
59 59
60 // Convert to format suitable for PNG output 60 // Convert to format suitable for PNG output
61 sk_sp<SkData> encodedBitmap = sk_tools::encode_bitmap_for_png(*bmp); 61 sk_sp<SkData> encodedBitmap = sk_tools::encode_bitmap_for_png(*bmp);
62 SkASSERT(encodedBitmap.get()); 62 SkASSERT(encodedBitmap.get());
63 63
64 // write to an opaque png (black background) 64 // write to an opaque png (black background)
65 SkDynamicMemoryWStream buffer; 65 SkDynamicMemoryWStream buffer;
66 SkDrawCommand::WritePNG((const png_bytep) encodedBitmap->bytes(), bmp->width (), bmp->height(), 66 SkDrawCommand::WritePNG(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::ContextOptions: :kNone).glContext(); 75 GrContextFactory::ContextOptions: :kNone).glContext();
76 if (!gl) { 76 if (!gl) {
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 SkASSERT(bitmap); 298 SkASSERT(bitmap);
299 299
300 // Convert to format suitable for inspection 300 // Convert to format suitable for inspection
301 sk_sp<SkData> encodedBitmap = sk_tools::encode_bitmap_for_png(*bitmap); 301 sk_sp<SkData> encodedBitmap = sk_tools::encode_bitmap_for_png(*bitmap);
302 SkASSERT(encodedBitmap); 302 SkASSERT(encodedBitmap);
303 303
304 const uint8_t* start = encodedBitmap->bytes() + ((y * bitmap->width() + x) * 4); 304 const uint8_t* start = encodedBitmap->bytes() + ((y * bitmap->width() + x) * 4);
305 SkColor result = SkColorSetARGB(start[3], start[0], start[1], start[2]); 305 SkColor result = SkColorSetARGB(start[3], start[0], start[1], start[2]);
306 return result; 306 return result;
307 } 307 }
OLDNEW
« no previous file with comments | « tools/debugger/SkDrawCommand.cpp ('k') | tools/skp_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698