| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 AutoLogger logger(this); | 153 AutoLogger logger(this); |
| 154 RefPtr<JSONObject> params = logger.logItemWithParams("drawBitmapRectToRect")
; | 154 RefPtr<JSONObject> params = logger.logItemWithParams("drawBitmapRectToRect")
; |
| 155 params->setObject("bitmap", objectForSkBitmap(bitmap)); | 155 params->setObject("bitmap", objectForSkBitmap(bitmap)); |
| 156 params->setObject("src", objectForSkRect(*src)); | 156 params->setObject("src", objectForSkRect(*src)); |
| 157 params->setObject("dst", objectForSkRect(dst)); | 157 params->setObject("dst", objectForSkRect(dst)); |
| 158 params->setObject("paint", objectForSkPaint(*paint)); | 158 params->setObject("paint", objectForSkPaint(*paint)); |
| 159 params->setNumber("flags", flags); | 159 params->setNumber("flags", flags); |
| 160 this->SkCanvas::drawBitmapRectToRect(bitmap, src, dst, paint, flags); | 160 this->SkCanvas::drawBitmapRectToRect(bitmap, src, dst, paint, flags); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void LoggingCanvas::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m,
const SkPaint* paint) | |
| 164 { | |
| 165 AutoLogger logger(this); | |
| 166 RefPtr<JSONObject> params = logger.logItemWithParams("drawBitmapMatrix"); | |
| 167 params->setObject("bitmap", objectForSkBitmap(bitmap)); | |
| 168 params->setArray("matrix", arrayForSkMatrix(m)); | |
| 169 params->setObject("paint", objectForSkPaint(*paint)); | |
| 170 this->SkCanvas::drawBitmapMatrix(bitmap, m, paint); | |
| 171 } | |
| 172 | |
| 173 void LoggingCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center
, const SkRect& dst, const SkPaint* paint) | 163 void LoggingCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center
, const SkRect& dst, const SkPaint* paint) |
| 174 { | 164 { |
| 175 AutoLogger logger(this); | 165 AutoLogger logger(this); |
| 176 RefPtr<JSONObject> params = logger.logItemWithParams("drawBitmapNine"); | 166 RefPtr<JSONObject> params = logger.logItemWithParams("drawBitmapNine"); |
| 177 params->setObject("bitmap", objectForSkBitmap(bitmap)); | 167 params->setObject("bitmap", objectForSkBitmap(bitmap)); |
| 178 params->setObject("center", objectForSkIRect(center)); | 168 params->setObject("center", objectForSkIRect(center)); |
| 179 params->setObject("dst", objectForSkRect(dst)); | 169 params->setObject("dst", objectForSkRect(dst)); |
| 180 params->setObject("paint", objectForSkPaint(*paint)); | 170 params->setObject("paint", objectForSkPaint(*paint)); |
| 181 this->SkCanvas::drawBitmapNine(bitmap, center, dst, paint); | 171 this->SkCanvas::drawBitmapNine(bitmap, center, dst, paint); |
| 182 } | 172 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 { | 271 { |
| 282 AutoLogger logger(this); | 272 AutoLogger logger(this); |
| 283 RefPtr<JSONObject> params = logger.logItemWithParams("drawTextOnPath"); | 273 RefPtr<JSONObject> params = logger.logItemWithParams("drawTextOnPath"); |
| 284 params->setString("text", stringForText(text, byteLength, paint)); | 274 params->setString("text", stringForText(text, byteLength, paint)); |
| 285 params->setObject("path", objectForSkPath(path)); | 275 params->setObject("path", objectForSkPath(path)); |
| 286 params->setArray("matrix", arrayForSkMatrix(*matrix)); | 276 params->setArray("matrix", arrayForSkMatrix(*matrix)); |
| 287 params->setObject("paint", objectForSkPaint(paint)); | 277 params->setObject("paint", objectForSkPaint(paint)); |
| 288 this->SkCanvas::onDrawTextOnPath(text, byteLength, path, matrix, paint); | 278 this->SkCanvas::onDrawTextOnPath(text, byteLength, path, matrix, paint); |
| 289 } | 279 } |
| 290 | 280 |
| 291 void LoggingCanvas::onPushCull(const SkRect& cullRect) | |
| 292 { | |
| 293 AutoLogger logger(this); | |
| 294 RefPtr<JSONObject> params = logger.logItemWithParams("pushCull"); | |
| 295 params->setObject("cullRect", objectForSkRect(cullRect)); | |
| 296 this->SkCanvas::onPushCull(cullRect); | |
| 297 } | |
| 298 | |
| 299 void LoggingCanvas::onPopCull() | |
| 300 { | |
| 301 AutoLogger logger(this); | |
| 302 logger.logItem("popCull"); | |
| 303 this->SkCanvas::onPopCull(); | |
| 304 } | |
| 305 | |
| 306 void LoggingCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyl
e style) | 281 void LoggingCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyl
e style) |
| 307 { | 282 { |
| 308 AutoLogger logger(this); | 283 AutoLogger logger(this); |
| 309 RefPtr<JSONObject> params = logger.logItemWithParams("clipRect"); | 284 RefPtr<JSONObject> params = logger.logItemWithParams("clipRect"); |
| 310 params->setObject("rect", objectForSkRect(rect)); | 285 params->setObject("rect", objectForSkRect(rect)); |
| 311 params->setString("SkRegion::Op", regionOpName(op)); | 286 params->setString("SkRegion::Op", regionOpName(op)); |
| 312 params->setBoolean("softClipEdgeStyle", kSoft_ClipEdgeStyle == style); | 287 params->setBoolean("softClipEdgeStyle", kSoft_ClipEdgeStyle == style); |
| 313 this->SkCanvas::onClipRect(rect, op, style); | 288 this->SkCanvas::onClipRect(rect, op, style); |
| 314 } | 289 } |
| 315 | 290 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 PassRefPtr<JSONArray> LoggingCanvas::arrayForSkPoints(size_t count, const SkPoin
t points[]) | 429 PassRefPtr<JSONArray> LoggingCanvas::arrayForSkPoints(size_t count, const SkPoin
t points[]) |
| 455 { | 430 { |
| 456 RefPtr<JSONArray> pointsArrayItem = JSONArray::create(); | 431 RefPtr<JSONArray> pointsArrayItem = JSONArray::create(); |
| 457 for (size_t i = 0; i < count; ++i) | 432 for (size_t i = 0; i < count; ++i) |
| 458 pointsArrayItem->pushObject(objectForSkPoint(points[i])); | 433 pointsArrayItem->pushObject(objectForSkPoint(points[i])); |
| 459 return pointsArrayItem.release(); | 434 return pointsArrayItem.release(); |
| 460 } | 435 } |
| 461 | 436 |
| 462 PassRefPtr<JSONObject> LoggingCanvas::objectForSkPicture(const SkPicture& pictur
e) | 437 PassRefPtr<JSONObject> LoggingCanvas::objectForSkPicture(const SkPicture& pictur
e) |
| 463 { | 438 { |
| 439 const SkIRect bounds = picture.cullRect().roundOut(); |
| 464 RefPtr<JSONObject> pictureItem = JSONObject::create(); | 440 RefPtr<JSONObject> pictureItem = JSONObject::create(); |
| 465 pictureItem->setNumber("width", picture.width()); | 441 pictureItem->setNumber("width", bounds.width()); |
| 466 pictureItem->setNumber("height", picture.height()); | 442 pictureItem->setNumber("height", bounds.height()); |
| 467 return pictureItem.release(); | 443 return pictureItem.release(); |
| 468 } | 444 } |
| 469 | 445 |
| 470 PassRefPtr<JSONObject> LoggingCanvas::objectForRadius(const SkRRect& rrect, SkRR
ect::Corner corner) | 446 PassRefPtr<JSONObject> LoggingCanvas::objectForRadius(const SkRRect& rrect, SkRR
ect::Corner corner) |
| 471 { | 447 { |
| 472 RefPtr<JSONObject> radiusItem = JSONObject::create(); | 448 RefPtr<JSONObject> radiusItem = JSONObject::create(); |
| 473 SkVector radius = rrect.radii(corner); | 449 SkVector radius = rrect.radii(corner); |
| 474 radiusItem->setNumber("xRadius", radius.x()); | 450 radiusItem->setNumber("xRadius", radius.x()); |
| 475 radiusItem->setNumber("yRadius", radius.y()); | 451 radiusItem->setNumber("yRadius", radius.y()); |
| 476 return radiusItem.release(); | 452 return radiusItem.release(); |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 paint.glyphsToUnichars(static_cast<const uint16_t*>(text), byteLength /
2, textData); | 836 paint.glyphsToUnichars(static_cast<const uint16_t*>(text), byteLength /
2, textData); |
| 861 return WTF::UTF32LittleEndianEncoding().decode(reinterpret_cast<const ch
ar*>(textData), byteLength * 2); | 837 return WTF::UTF32LittleEndianEncoding().decode(reinterpret_cast<const ch
ar*>(textData), byteLength * 2); |
| 862 } | 838 } |
| 863 default: | 839 default: |
| 864 ASSERT_NOT_REACHED(); | 840 ASSERT_NOT_REACHED(); |
| 865 return "?"; | 841 return "?"; |
| 866 } | 842 } |
| 867 } | 843 } |
| 868 | 844 |
| 869 } // namespace blink | 845 } // namespace blink |
| OLD | NEW |