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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 default: | 617 default: |
618 ASSERT_NOT_REACHED(); | 618 ASSERT_NOT_REACHED(); |
619 return "?"; | 619 return "?"; |
620 }; | 620 }; |
621 } | 621 } |
622 | 622 |
623 PassRefPtr<JSONObject> LoggingCanvas::objectForBitmapData(const SkBitmap& bitmap
) | 623 PassRefPtr<JSONObject> LoggingCanvas::objectForBitmapData(const SkBitmap& bitmap
) |
624 { | 624 { |
625 RefPtr<JSONObject> dataItem = JSONObject::create(); | 625 RefPtr<JSONObject> dataItem = JSONObject::create(); |
626 Vector<unsigned char> output; | 626 Vector<unsigned char> output; |
627 blink::PNGImageEncoder::encode(bitmap, &output); | 627 PNGImageEncoder::encode(bitmap, &output); |
628 dataItem->setString("base64", WTF::base64Encode(reinterpret_cast<char*>(outp
ut.data()), output.size())); | 628 dataItem->setString("base64", WTF::base64Encode(reinterpret_cast<char*>(outp
ut.data()), output.size())); |
629 dataItem->setString("mimeType", "image/png"); | 629 dataItem->setString("mimeType", "image/png"); |
630 return dataItem.release(); | 630 return dataItem.release(); |
631 } | 631 } |
632 | 632 |
633 PassRefPtr<JSONObject> LoggingCanvas::objectForSkBitmap(const SkBitmap& bitmap) | 633 PassRefPtr<JSONObject> LoggingCanvas::objectForSkBitmap(const SkBitmap& bitmap) |
634 { | 634 { |
635 RefPtr<JSONObject> bitmapItem = JSONObject::create(); | 635 RefPtr<JSONObject> bitmapItem = JSONObject::create(); |
636 bitmapItem->setNumber("width", bitmap.width()); | 636 bitmapItem->setNumber("width", bitmap.width()); |
637 bitmapItem->setNumber("height", bitmap.height()); | 637 bitmapItem->setNumber("height", bitmap.height()); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 WTF::Vector<SkUnichar> dataVector(byteLength / 2); | 865 WTF::Vector<SkUnichar> dataVector(byteLength / 2); |
866 SkUnichar* textData = dataVector.data(); | 866 SkUnichar* textData = dataVector.data(); |
867 paint.glyphsToUnichars(static_cast<const uint16_t*>(text), byteLength /
2, textData); | 867 paint.glyphsToUnichars(static_cast<const uint16_t*>(text), byteLength /
2, textData); |
868 return WTF::UTF32LittleEndianEncoding().decode(reinterpret_cast<const ch
ar*>(textData), byteLength * 2); | 868 return WTF::UTF32LittleEndianEncoding().decode(reinterpret_cast<const ch
ar*>(textData), byteLength * 2); |
869 } | 869 } |
870 default: | 870 default: |
871 ASSERT_NOT_REACHED(); | 871 ASSERT_NOT_REACHED(); |
872 return "?"; | 872 return "?"; |
873 } | 873 } |
874 } | 874 } |
875 } | 875 |
| 876 } // namespace blink |
OLD | NEW |