OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkBBoxHierarchy.h" | 8 #include "SkBBoxHierarchy.h" |
9 #include "SkBlurImageFilter.h" | 9 #include "SkBlurImageFilter.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 REPORTER_ASSERT_MESSAGE(errorContext->fReporter, kParseError_SkError == erro
r, | 867 REPORTER_ASSERT_MESSAGE(errorContext->fReporter, kParseError_SkError == erro
r, |
868 SkGetLastErrorString()); | 868 SkGetLastErrorString()); |
869 } | 869 } |
870 | 870 |
871 static void md5(const SkBitmap& bm, SkMD5::Digest* digest) { | 871 static void md5(const SkBitmap& bm, SkMD5::Digest* digest) { |
872 SkAutoLockPixels autoLockPixels(bm); | 872 SkAutoLockPixels autoLockPixels(bm); |
873 SkASSERT(bm.getPixels()); | 873 SkASSERT(bm.getPixels()); |
874 SkMD5 md5; | 874 SkMD5 md5; |
875 size_t rowLen = bm.info().bytesPerPixel() * bm.width(); | 875 size_t rowLen = bm.info().bytesPerPixel() * bm.width(); |
876 for (int y = 0; y < bm.height(); ++y) { | 876 for (int y = 0; y < bm.height(); ++y) { |
877 md5.update(static_cast<uint8_t*>(bm.getAddr(0, y)), rowLen); | 877 md5.write(bm.getAddr(0, y), rowLen); |
878 } | 878 } |
879 md5.finish(*digest); | 879 md5.finish(*digest); |
880 } | 880 } |
881 | 881 |
882 DEF_TEST(Picture_EncodedData, reporter) { | 882 DEF_TEST(Picture_EncodedData, reporter) { |
883 // Create a bitmap that will be encoded. | 883 // Create a bitmap that will be encoded. |
884 SkBitmap original; | 884 SkBitmap original; |
885 make_bm(&original, 100, 100, SK_ColorBLUE, true); | 885 make_bm(&original, 100, 100, SK_ColorBLUE, true); |
886 SkDynamicMemoryWStream wStream; | 886 SkDynamicMemoryWStream wStream; |
887 if (!SkImageEncoder::EncodeStream(&wStream, original, SkImageEncoder::kPNG_T
ype, 100)) { | 887 if (!SkImageEncoder::EncodeStream(&wStream, original, SkImageEncoder::kPNG_T
ype, 100)) { |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 | 1404 |
1405 SkAutoTDelete<SkStream> rstream(wstream.detachAsStream()); | 1405 SkAutoTDelete<SkStream> rstream(wstream.detachAsStream()); |
1406 sk_sp<SkPicture> deserializedPicture(SkPicture::MakeFromStream(rstream)); | 1406 sk_sp<SkPicture> deserializedPicture(SkPicture::MakeFromStream(rstream)); |
1407 | 1407 |
1408 REPORTER_ASSERT(r, deserializedPicture != nullptr); | 1408 REPORTER_ASSERT(r, deserializedPicture != nullptr); |
1409 REPORTER_ASSERT(r, deserializedPicture->cullRect().left() == 1); | 1409 REPORTER_ASSERT(r, deserializedPicture->cullRect().left() == 1); |
1410 REPORTER_ASSERT(r, deserializedPicture->cullRect().top() == 2); | 1410 REPORTER_ASSERT(r, deserializedPicture->cullRect().top() == 2); |
1411 REPORTER_ASSERT(r, deserializedPicture->cullRect().right() == 3); | 1411 REPORTER_ASSERT(r, deserializedPicture->cullRect().right() == 3); |
1412 REPORTER_ASSERT(r, deserializedPicture->cullRect().bottom() == 4); | 1412 REPORTER_ASSERT(r, deserializedPicture->cullRect().bottom() == 4); |
1413 } | 1413 } |
OLD | NEW |