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

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

Issue 1903203003: Get skiaserve working on Windows. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix ws2_32 dependency, build skiaserve w/most on windows 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 | « gyp/most.gyp ('k') | tools/skiaserve/skiaserve.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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 SkData* Request::drawToPng(int n, int m) { 92 SkData* Request::drawToPng(int n, int m) {
93 this->drawToCanvas(n, m); 93 this->drawToCanvas(n, m);
94 return writeCanvasToPng(this->getCanvas()); 94 return writeCanvasToPng(this->getCanvas());
95 } 95 }
96 96
97 SkData* Request::writeOutSkp() { 97 SkData* Request::writeOutSkp() {
98 // Playback into picture recorder 98 // Playback into picture recorder
99 SkIRect bounds = this->getBounds(); 99 SkIRect bounds = this->getBounds();
100 SkPictureRecorder recorder; 100 SkPictureRecorder recorder;
101 SkCanvas* canvas = recorder.beginRecording(bounds.width(), bounds.height()); 101 SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(bounds.width()),
102 SkIntToScalar(bounds.height()));
102 103
103 fDebugCanvas->draw(canvas); 104 fDebugCanvas->draw(canvas);
104 105
105 sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture()); 106 sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture());
106 107
107 SkDynamicMemoryWStream outStream; 108 SkDynamicMemoryWStream outStream;
108 109
109 SkAutoTUnref<SkPixelSerializer> serializer(SkImageEncoder::CreatePixelSerial izer()); 110 SkAutoTUnref<SkPixelSerializer> serializer(SkImageEncoder::CreatePixelSerial izer());
110 picture->serialize(&outStream, serializer); 111 picture->serialize(&outStream, serializer);
111 112
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 SkASSERT(bitmap); 292 SkASSERT(bitmap);
292 293
293 // Convert to format suitable for inspection 294 // Convert to format suitable for inspection
294 sk_sp<SkData> encodedBitmap = sk_tools::encode_bitmap_for_png(*bitmap); 295 sk_sp<SkData> encodedBitmap = sk_tools::encode_bitmap_for_png(*bitmap);
295 SkASSERT(encodedBitmap.get()); 296 SkASSERT(encodedBitmap.get());
296 297
297 const uint8_t* start = encodedBitmap->bytes() + ((y * bitmap->width() + x) * 4); 298 const uint8_t* start = encodedBitmap->bytes() + ((y * bitmap->width() + x) * 4);
298 SkColor result = SkColorSetARGB(start[3], start[0], start[1], start[2]); 299 SkColor result = SkColorSetARGB(start[3], start[0], start[1], start[2]);
299 return result; 300 return result;
300 } 301 }
OLDNEW
« no previous file with comments | « gyp/most.gyp ('k') | tools/skiaserve/skiaserve.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698