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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 } | 195 } |
196 | 196 |
197 void drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkP
aint& paint) OVERRIDE | 197 void drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkP
aint& paint) OVERRIDE |
198 { | 198 { |
199 RefPtr<JSONObject> params = addItemWithParams("drawPoints"); | 199 RefPtr<JSONObject> params = addItemWithParams("drawPoints"); |
200 params->setString("pointMode", pointModeName(mode)); | 200 params->setString("pointMode", pointModeName(mode)); |
201 params->setArray("points", arrayForSkPoints(count, pts)); | 201 params->setArray("points", arrayForSkPoints(count, pts)); |
202 params->setObject("paint", objectForSkPaint(paint)); | 202 params->setObject("paint", objectForSkPaint(paint)); |
203 } | 203 } |
204 | 204 |
205 void drawPicture(SkPicture& picture) OVERRIDE | |
206 { | |
207 addItemWithParams("drawPicture")->setObject("picture", objectForSkPictur
e(picture)); | |
208 } | |
209 | |
210 void drawRect(const SkRect& rect, const SkPaint& paint) OVERRIDE | 205 void drawRect(const SkRect& rect, const SkPaint& paint) OVERRIDE |
211 { | 206 { |
212 RefPtr<JSONObject> params = addItemWithParams("drawRect"); | 207 RefPtr<JSONObject> params = addItemWithParams("drawRect"); |
213 params->setObject("rect", objectForSkRect(rect)); | 208 params->setObject("rect", objectForSkRect(rect)); |
214 params->setObject("paint", objectForSkPaint(paint)); | 209 params->setObject("paint", objectForSkPaint(paint)); |
215 } | 210 } |
216 | 211 |
217 void drawOval(const SkRect& oval, const SkPaint& paint) OVERRIDE | 212 void drawOval(const SkRect& oval, const SkPaint& paint) OVERRIDE |
218 { | 213 { |
219 RefPtr<JSONObject> params = addItemWithParams("drawOval"); | 214 RefPtr<JSONObject> params = addItemWithParams("drawOval"); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 params->setString("SkRegion::Op", regionOpName(op)); | 385 params->setString("SkRegion::Op", regionOpName(op)); |
391 params->setBoolean("softClipEdgeStyle", kSoft_ClipEdgeStyle == style); | 386 params->setBoolean("softClipEdgeStyle", kSoft_ClipEdgeStyle == style); |
392 } | 387 } |
393 | 388 |
394 void onClipRegion(const SkRegion& region, SkRegion::Op op) OVERRIDE | 389 void onClipRegion(const SkRegion& region, SkRegion::Op op) OVERRIDE |
395 { | 390 { |
396 RefPtr<JSONObject> params = addItemWithParams("clipRegion"); | 391 RefPtr<JSONObject> params = addItemWithParams("clipRegion"); |
397 params->setString("op", regionOpName(op)); | 392 params->setString("op", regionOpName(op)); |
398 } | 393 } |
399 | 394 |
| 395 void onDrawPicture(const SkPicture* picture) OVERRIDE |
| 396 { |
| 397 addItemWithParams("drawPicture")->setObject("picture", objectForSkPictur
e(*picture)); |
| 398 } |
| 399 |
400 void didSetMatrix(const SkMatrix& matrix) OVERRIDE | 400 void didSetMatrix(const SkMatrix& matrix) OVERRIDE |
401 { | 401 { |
402 RefPtr<JSONObject> params = addItemWithParams("setMatrix"); | 402 RefPtr<JSONObject> params = addItemWithParams("setMatrix"); |
403 params->setArray("matrix", arrayForSkMatrix(matrix)); | 403 params->setArray("matrix", arrayForSkMatrix(matrix)); |
404 this->SkCanvas::didSetMatrix(matrix); | 404 this->SkCanvas::didSetMatrix(matrix); |
405 } | 405 } |
406 | 406 |
407 void didConcat(const SkMatrix& matrix) OVERRIDE | 407 void didConcat(const SkMatrix& matrix) OVERRIDE |
408 { | 408 { |
409 switch (matrix.getType()) { | 409 switch (matrix.getType()) { |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 | 1035 |
1036 PassRefPtr<JSONArray> GraphicsContextSnapshot::snapshotCommandLog() const | 1036 PassRefPtr<JSONArray> GraphicsContextSnapshot::snapshotCommandLog() const |
1037 { | 1037 { |
1038 LoggingCanvas canvas; | 1038 LoggingCanvas canvas; |
1039 FragmentSnapshotPlayer player(m_picture, &canvas); | 1039 FragmentSnapshotPlayer player(m_picture, &canvas); |
1040 player.play(0, 0); | 1040 player.play(0, 0); |
1041 return canvas.log(); | 1041 return canvas.log(); |
1042 } | 1042 } |
1043 | 1043 |
1044 } | 1044 } |
OLD | NEW |