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

Side by Side Diff: tools/json/SkJSONCanvas.cpp

Issue 1662003002: Modify skia serve to return clip rect and view matrix (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: todo Created 4 years, 10 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/json/SkJSONCanvas.h ('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 "SkJSONCanvas.h" 8 #include "SkJSONCanvas.h"
9 #include "SkImageFilter.h" 9 #include "SkImageFilter.h"
10 #include "SkMaskFilter.h" 10 #include "SkMaskFilter.h"
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 apply_paint_style(paint, &result); 375 apply_paint_style(paint, &result);
376 apply_paint_cap(paint, &result); 376 apply_paint_cap(paint, &result);
377 apply_paint_textalign(paint, &result); 377 apply_paint_textalign(paint, &result);
378 apply_paint_patheffect(paint, &result, fSendBinaries); 378 apply_paint_patheffect(paint, &result, fSendBinaries);
379 apply_paint_maskfilter(paint, &result, fSendBinaries); 379 apply_paint_maskfilter(paint, &result, fSendBinaries);
380 apply_paint_shader(paint, &result, fSendBinaries); 380 apply_paint_shader(paint, &result, fSendBinaries);
381 apply_paint_xfermode(paint, &result, fSendBinaries); 381 apply_paint_xfermode(paint, &result, fSendBinaries);
382 return result; 382 return result;
383 } 383 }
384 384
385 Json::Value SkJSONCanvas::makeMatrix(const SkMatrix& matrix) { 385 Json::Value SkJSONCanvas::MakeIRect(const SkIRect& rect) {
386 Json::Value result(Json::arrayValue);
387 result.append(Json::Value(rect.left()));
388 result.append(Json::Value(rect.top()));
389 result.append(Json::Value(rect.right()));
390 result.append(Json::Value(rect.bottom()));
391 return result;
392 }
393
394 Json::Value SkJSONCanvas::MakeMatrix(const SkMatrix& matrix) {
386 Json::Value result(Json::arrayValue); 395 Json::Value result(Json::arrayValue);
387 Json::Value row1(Json::arrayValue); 396 Json::Value row1(Json::arrayValue);
388 row1.append(Json::Value(matrix[0])); 397 row1.append(Json::Value(matrix[0]));
389 row1.append(Json::Value(matrix[1])); 398 row1.append(Json::Value(matrix[1]));
390 row1.append(Json::Value(matrix[2])); 399 row1.append(Json::Value(matrix[2]));
391 result.append(row1); 400 result.append(row1);
392 Json::Value row2(Json::arrayValue); 401 Json::Value row2(Json::arrayValue);
393 row2.append(Json::Value(matrix[3])); 402 row2.append(Json::Value(matrix[3]));
394 row2.append(Json::Value(matrix[4])); 403 row2.append(Json::Value(matrix[4]));
395 row2.append(Json::Value(matrix[5])); 404 row2.append(Json::Value(matrix[5]));
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 SkASSERT(false); 443 SkASSERT(false);
435 return Json::Value("<invalid point mode>"); 444 return Json::Value("<invalid point mode>");
436 }; 445 };
437 } 446 }
438 447
439 void SkJSONCanvas::updateMatrix() { 448 void SkJSONCanvas::updateMatrix() {
440 const SkMatrix& matrix = this->getTotalMatrix(); 449 const SkMatrix& matrix = this->getTotalMatrix();
441 if (matrix != fLastMatrix) { 450 if (matrix != fLastMatrix) {
442 Json::Value command(Json::objectValue); 451 Json::Value command(Json::objectValue);
443 command[SKJSONCANVAS_COMMAND] = Json::Value(SKJSONCANVAS_COMMAND_MATRIX) ; 452 command[SKJSONCANVAS_COMMAND] = Json::Value(SKJSONCANVAS_COMMAND_MATRIX) ;
444 command[SKJSONCANVAS_ATTRIBUTE_MATRIX] = this->makeMatrix(matrix); 453 command[SKJSONCANVAS_ATTRIBUTE_MATRIX] = MakeMatrix(matrix);
445 fCommands.append(command); 454 fCommands.append(command);
446 fLastMatrix = matrix; 455 fLastMatrix = matrix;
447 } 456 }
448 } 457 }
449 458
450 void SkJSONCanvas::onDrawPaint(const SkPaint& paint) { 459 void SkJSONCanvas::onDrawPaint(const SkPaint& paint) {
451 Json::Value command(Json::objectValue); 460 Json::Value command(Json::objectValue);
452 command[SKJSONCANVAS_COMMAND] = Json::Value(SKJSONCANVAS_COMMAND_PAINT); 461 command[SKJSONCANVAS_COMMAND] = Json::Value(SKJSONCANVAS_COMMAND_PAINT);
453 command[SKJSONCANVAS_ATTRIBUTE_PAINT] = this->makePaint(paint); 462 command[SKJSONCANVAS_ATTRIBUTE_PAINT] = this->makePaint(paint);
454 fCommands.append(command); 463 fCommands.append(command);
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 Json::Value backdrop; 741 Json::Value backdrop;
733 flatten(rec.fBackdrop, &backdrop, fSendBinaries); 742 flatten(rec.fBackdrop, &backdrop, fSendBinaries);
734 command[SKJSONCANVAS_ATTRIBUTE_BACKDROP] = backdrop; 743 command[SKJSONCANVAS_ATTRIBUTE_BACKDROP] = backdrop;
735 } 744 }
736 if (rec.fSaveLayerFlags != 0) { 745 if (rec.fSaveLayerFlags != 0) {
737 SkDebugf("unsupported: saveLayer flags\n"); 746 SkDebugf("unsupported: saveLayer flags\n");
738 } 747 }
739 fCommands.append(command); 748 fCommands.append(command);
740 return this->INHERITED::getSaveLayerStrategy(rec); 749 return this->INHERITED::getSaveLayerStrategy(rec);
741 } 750 }
OLDNEW
« no previous file with comments | « tools/json/SkJSONCanvas.h ('k') | tools/skiaserve/skiaserve.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698