Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1348)

Side by Side Diff: tests/PictureTest.cpp

Issue 1913173003: SkMD5: .update() -> .write() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-04-22 (Friday) 16:17:21 EDT Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/core/SkMD5.cpp ('K') | « tests/MD5Test.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« src/core/SkMD5.cpp ('K') | « tests/MD5Test.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698