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

Side by Side Diff: tests/PictureTest.cpp

Issue 1372593002: SkInstallDiscardablePixelRef is deprecated, enforce that (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « tests/PDFJpegEmbedTest.cpp ('k') | tools/LazyDecodeBitmap.cpp » ('j') | 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 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 // Create a bitmap that will be encoded. 880 // Create a bitmap that will be encoded.
881 SkBitmap original; 881 SkBitmap original;
882 make_bm(&original, 100, 100, SK_ColorBLUE, true); 882 make_bm(&original, 100, 100, SK_ColorBLUE, true);
883 SkDynamicMemoryWStream wStream; 883 SkDynamicMemoryWStream wStream;
884 if (!SkImageEncoder::EncodeStream(&wStream, original, SkImageEncoder::kPNG_T ype, 100)) { 884 if (!SkImageEncoder::EncodeStream(&wStream, original, SkImageEncoder::kPNG_T ype, 100)) {
885 return; 885 return;
886 } 886 }
887 SkAutoDataUnref data(wStream.copyToData()); 887 SkAutoDataUnref data(wStream.copyToData());
888 888
889 SkBitmap bm; 889 SkBitmap bm;
890 bool installSuccess = SkInstallDiscardablePixelRef(data, &bm); 890 bool installSuccess = SkDEPRECATED_InstallDiscardablePixelRef(data, &bm);
891 REPORTER_ASSERT(reporter, installSuccess); 891 REPORTER_ASSERT(reporter, installSuccess);
892 892
893 // Write both bitmaps to pictures, and ensure that the resulting data stream s are the same. 893 // Write both bitmaps to pictures, and ensure that the resulting data stream s are the same.
894 // Flattening original will follow the old path of performing an encode, whi le flattening bm 894 // Flattening original will follow the old path of performing an encode, whi le flattening bm
895 // will use the already encoded data. 895 // will use the already encoded data.
896 SkAutoDataUnref picture1(serialized_picture_from_bitmap(original)); 896 SkAutoDataUnref picture1(serialized_picture_from_bitmap(original));
897 SkAutoDataUnref picture2(serialized_picture_from_bitmap(bm)); 897 SkAutoDataUnref picture2(serialized_picture_from_bitmap(bm));
898 REPORTER_ASSERT(reporter, picture1->equals(picture2)); 898 REPORTER_ASSERT(reporter, picture1->equals(picture2));
899 // Now test that a parse error was generated when trying to create a new SkP icture without 899 // Now test that a parse error was generated when trying to create a new SkP icture without
900 // providing a function to decode the bitmap. 900 // providing a function to decode the bitmap.
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 1383
1384 SkAutoTDelete<SkStream> rstream(wstream.detachAsStream()); 1384 SkAutoTDelete<SkStream> rstream(wstream.detachAsStream());
1385 SkAutoTUnref<SkPicture> deserializedPicture(SkPicture::CreateFromStream(rstr eam)); 1385 SkAutoTUnref<SkPicture> deserializedPicture(SkPicture::CreateFromStream(rstr eam));
1386 1386
1387 REPORTER_ASSERT(r, SkToBool(deserializedPicture)); 1387 REPORTER_ASSERT(r, SkToBool(deserializedPicture));
1388 REPORTER_ASSERT(r, deserializedPicture->cullRect().left() == 1); 1388 REPORTER_ASSERT(r, deserializedPicture->cullRect().left() == 1);
1389 REPORTER_ASSERT(r, deserializedPicture->cullRect().top() == 2); 1389 REPORTER_ASSERT(r, deserializedPicture->cullRect().top() == 2);
1390 REPORTER_ASSERT(r, deserializedPicture->cullRect().right() == 3); 1390 REPORTER_ASSERT(r, deserializedPicture->cullRect().right() == 3);
1391 REPORTER_ASSERT(r, deserializedPicture->cullRect().bottom() == 4); 1391 REPORTER_ASSERT(r, deserializedPicture->cullRect().bottom() == 4);
1392 } 1392 }
OLDNEW
« no previous file with comments | « tests/PDFJpegEmbedTest.cpp ('k') | tools/LazyDecodeBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698