Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 } | 93 } |
| 94 | 94 |
| 95 PassRefPtr<JSONArray> arrayForSkPoints(size_t count, const SkPoint points[]) | 95 PassRefPtr<JSONArray> arrayForSkPoints(size_t count, const SkPoint points[]) |
| 96 { | 96 { |
| 97 RefPtr<JSONArray> pointsArrayItem = JSONArray::create(); | 97 RefPtr<JSONArray> pointsArrayItem = JSONArray::create(); |
| 98 for (size_t i = 0; i < count; ++i) | 98 for (size_t i = 0; i < count; ++i) |
| 99 pointsArrayItem->pushObject(objectForSkPoint(points[i])); | 99 pointsArrayItem->pushObject(objectForSkPoint(points[i])); |
| 100 return pointsArrayItem.release(); | 100 return pointsArrayItem.release(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 PassRefPtr<JSONObject> objectForSkPicture(const SkPicture& picture) | |
| 104 { | |
| 105 const SkIRect bounds = picture.cullRect().roundOut(); | |
| 106 RefPtr<JSONObject> pictureItem = JSONObject::create(); | |
| 107 pictureItem->setNumber("width", bounds.width()); | |
| 108 pictureItem->setNumber("height", bounds.height()); | |
| 109 return pictureItem.release(); | |
| 110 } | |
| 111 | |
| 112 PassRefPtr<JSONObject> objectForRadius(const SkRRect& rrect, SkRRect::Corner cor ner) | 103 PassRefPtr<JSONObject> objectForRadius(const SkRRect& rrect, SkRRect::Corner cor ner) |
| 113 { | 104 { |
| 114 RefPtr<JSONObject> radiusItem = JSONObject::create(); | 105 RefPtr<JSONObject> radiusItem = JSONObject::create(); |
| 115 SkVector radius = rrect.radii(corner); | 106 SkVector radius = rrect.radii(corner); |
| 116 radiusItem->setNumber("xRadius", radius.x()); | 107 radiusItem->setNumber("xRadius", radius.x()); |
| 117 radiusItem->setNumber("yRadius", radius.y()); | 108 radiusItem->setNumber("yRadius", radius.y()); |
| 118 return radiusItem.release(); | 109 return radiusItem.release(); |
| 119 } | 110 } |
| 120 | 111 |
| 121 String rrectTypeName(SkRRect::Type type) | 112 String rrectTypeName(SkRRect::Type type) |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 778 void LoggingCanvas::onClipRegion(const SkRegion& region, SkRegion::Op op) | 769 void LoggingCanvas::onClipRegion(const SkRegion& region, SkRegion::Op op) |
| 779 { | 770 { |
| 780 AutoLogger logger(this); | 771 AutoLogger logger(this); |
| 781 RefPtr<JSONObject> params = logger.logItemWithParams("clipRegion"); | 772 RefPtr<JSONObject> params = logger.logItemWithParams("clipRegion"); |
| 782 params->setString("op", regionOpName(op)); | 773 params->setString("op", regionOpName(op)); |
| 783 this->SkCanvas::onClipRegion(region, op); | 774 this->SkCanvas::onClipRegion(region, op); |
| 784 } | 775 } |
| 785 | 776 |
| 786 void LoggingCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matr ix, const SkPaint* paint) | 777 void LoggingCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matr ix, const SkPaint* paint) |
| 787 { | 778 { |
| 788 AutoLogger logger(this); | 779 this->unrollDrawPicture(picture, matrix, paint, nullptr); |
| 789 logger.logItemWithParams("drawPicture")->setObject("picture", objectForSkPic ture(*picture)); | |
|
f(malita)
2015/06/17 18:20:56
It would be nice to provide some indication of pic
caseq
2015/06/17 18:29:47
Yup, I agree. We need to figure out how to present
| |
| 790 this->SkCanvas::onDrawPicture(picture, matrix, paint); | |
| 791 } | 780 } |
| 792 | 781 |
| 793 void LoggingCanvas::didSetMatrix(const SkMatrix& matrix) | 782 void LoggingCanvas::didSetMatrix(const SkMatrix& matrix) |
| 794 { | 783 { |
| 795 AutoLogger logger(this); | 784 AutoLogger logger(this); |
| 796 RefPtr<JSONObject> params = logger.logItemWithParams("setMatrix"); | 785 RefPtr<JSONObject> params = logger.logItemWithParams("setMatrix"); |
| 797 params->setArray("matrix", arrayForSkMatrix(matrix)); | 786 params->setArray("matrix", arrayForSkMatrix(matrix)); |
| 798 this->SkCanvas::didSetMatrix(matrix); | 787 this->SkCanvas::didSetMatrix(matrix); |
| 799 } | 788 } |
| 800 | 789 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 867 return pictureAsJSON->toPrettyJSONString(); | 856 return pictureAsJSON->toPrettyJSONString(); |
| 868 } | 857 } |
| 869 | 858 |
| 870 void showSkPicture(const SkPicture* picture) | 859 void showSkPicture(const SkPicture* picture) |
| 871 { | 860 { |
| 872 WTFLogAlways("%s\n", pictureAsDebugString(picture).utf8().data()); | 861 WTFLogAlways("%s\n", pictureAsDebugString(picture).utf8().data()); |
| 873 } | 862 } |
| 874 #endif | 863 #endif |
| 875 | 864 |
| 876 } // namespace blink | 865 } // namespace blink |
| OLD | NEW |