| 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 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 default: | 707 default: |
| 708 ASSERT_NOT_REACHED(); | 708 ASSERT_NOT_REACHED(); |
| 709 return "?"; | 709 return "?"; |
| 710 }; | 710 }; |
| 711 } | 711 } |
| 712 | 712 |
| 713 PassRefPtr<JSONObject> objectForBitmapData(const SkBitmap& bitmap) | 713 PassRefPtr<JSONObject> objectForBitmapData(const SkBitmap& bitmap) |
| 714 { | 714 { |
| 715 RefPtr<JSONObject> dataItem = JSONObject::create(); | 715 RefPtr<JSONObject> dataItem = JSONObject::create(); |
| 716 Vector<unsigned char> output; | 716 Vector<unsigned char> output; |
| 717 WebCore::PNGImageEncoder::encode(bitmap, &output); | 717 int compressionQuality = PNGImageEncoder::DefaultCompressionQuality; |
| 718 WebCore::PNGImageEncoder::encode(bitmap, compressionQuality, &output); |
| 718 dataItem->setString("base64", WTF::base64Encode(reinterpret_cast<char*>(
output.data()), output.size())); | 719 dataItem->setString("base64", WTF::base64Encode(reinterpret_cast<char*>(
output.data()), output.size())); |
| 719 dataItem->setString("mimeType", "image/png"); | 720 dataItem->setString("mimeType", "image/png"); |
| 720 return dataItem.release(); | 721 return dataItem.release(); |
| 721 } | 722 } |
| 722 | 723 |
| 723 PassRefPtr<JSONObject> objectForSkBitmap(const SkBitmap& bitmap) | 724 PassRefPtr<JSONObject> objectForSkBitmap(const SkBitmap& bitmap) |
| 724 { | 725 { |
| 725 RefPtr<JSONObject> bitmapItem = JSONObject::create(); | 726 RefPtr<JSONObject> bitmapItem = JSONObject::create(); |
| 726 bitmapItem->setNumber("width", bitmap.width()); | 727 bitmapItem->setNumber("width", bitmap.width()); |
| 727 bitmapItem->setNumber("height", bitmap.height()); | 728 bitmapItem->setNumber("height", bitmap.height()); |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 | 1036 |
| 1036 PassRefPtr<JSONArray> GraphicsContextSnapshot::snapshotCommandLog() const | 1037 PassRefPtr<JSONArray> GraphicsContextSnapshot::snapshotCommandLog() const |
| 1037 { | 1038 { |
| 1038 LoggingCanvas canvas; | 1039 LoggingCanvas canvas; |
| 1039 FragmentSnapshotPlayer player(m_picture, &canvas); | 1040 FragmentSnapshotPlayer player(m_picture, &canvas); |
| 1040 player.play(0, 0); | 1041 player.play(0, 0); |
| 1041 return canvas.log(); | 1042 return canvas.log(); |
| 1042 } | 1043 } |
| 1043 | 1044 |
| 1044 } | 1045 } |
| OLD | NEW |