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

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

Issue 1748183007: Remove dependency on SkJsonCanvas.h (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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') | 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 "png.h" 10 #include "png.h"
11 11
12 #include "SkJSONCanvas.h"
13
14 const int Request::kImageWidth = 1920; 12 const int Request::kImageWidth = 1920;
15 const int Request::kImageHeight = 1080; 13 const int Request::kImageHeight = 1080;
16 14
17 static void write_png_callback(png_structp png_ptr, png_bytep data, png_size_t l ength) { 15 static void write_png_callback(png_structp png_ptr, png_bytep data, png_size_t l ength) {
18 SkWStream* out = (SkWStream*) png_get_io_ptr(png_ptr); 16 SkWStream* out = (SkWStream*) png_get_io_ptr(png_ptr);
19 out->write(data, length); 17 out->write(data, length);
20 } 18 }
21 19
22 static void write_png(const png_bytep rgba, png_uint_32 width, png_uint_32 heigh t, SkWStream& out) { 20 static void write_png(const png_bytep rgba, png_uint_32 width, png_uint_32 heigh t, SkWStream& out) {
23 png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 21 png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 SkAutoTUnref<SkSurface> surface(this->createCPUSurface()); 219 SkAutoTUnref<SkSurface> surface(this->createCPUSurface());
222 SkCanvas* canvas = surface->getCanvas(); 220 SkCanvas* canvas = surface->getCanvas();
223 221
224 // TODO this is really slow and we should cache the matrix and clip 222 // TODO this is really slow and we should cache the matrix and clip
225 fDebugCanvas->drawTo(canvas, n); 223 fDebugCanvas->drawTo(canvas, n);
226 224
227 // make some json 225 // make some json
228 SkMatrix vm = fDebugCanvas->getCurrentMatrix(); 226 SkMatrix vm = fDebugCanvas->getCurrentMatrix();
229 SkIRect clip = fDebugCanvas->getCurrentClip(); 227 SkIRect clip = fDebugCanvas->getCurrentClip();
230 Json::Value info(Json::objectValue); 228 Json::Value info(Json::objectValue);
231 info["ViewMatrix"] = SkJSONCanvas::MakeMatrix(vm); 229 info["ViewMatrix"] = SkDrawCommand::MakeJsonMatrix(vm);
232 info["ClipRect"] = SkJSONCanvas::MakeIRect(clip); 230 info["ClipRect"] = SkDrawCommand::MakeJsonIRect(clip);
233 231
234 std::string json = Json::FastWriter().write(info); 232 std::string json = Json::FastWriter().write(info);
235 233
236 // We don't want the null terminator so strlen is correct 234 // We don't want the null terminator so strlen is correct
237 return SkData::NewWithCopy(json.c_str(), strlen(json.c_str())); 235 return SkData::NewWithCopy(json.c_str(), strlen(json.c_str()));
238 } 236 }
OLDNEW
« no previous file with comments | « tools/debugger/SkDrawCommand.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698