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

Side by Side Diff: tests/SerializationTest.cpp

Issue 2343933002: Revert of SkFontData to use smart pointers. (Closed)
Patch Set: Created 4 years, 3 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/ExifTest.cpp ('k') | tests/YUVTest.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 2013 Google Inc. 2 * Copyright 2013 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 "Resources.h" 8 #include "Resources.h"
9 #include "SkAnnotationKeys.h" 9 #include "SkAnnotationKeys.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
11 #include "SkFixed.h" 11 #include "SkFixed.h"
12 #include "SkFontDescriptor.h" 12 #include "SkFontDescriptor.h"
13 #include "SkImage.h" 13 #include "SkImage.h"
14 #include "SkImageSource.h" 14 #include "SkImageSource.h"
15 #include "SkLightingShader.h" 15 #include "SkLightingShader.h"
16 #include "SkMakeUnique.h"
17 #include "SkMallocPixelRef.h" 16 #include "SkMallocPixelRef.h"
18 #include "SkNormalSource.h" 17 #include "SkNormalSource.h"
19 #include "SkOSFile.h" 18 #include "SkOSFile.h"
20 #include "SkPictureRecorder.h" 19 #include "SkPictureRecorder.h"
21 #include "SkTableColorFilter.h" 20 #include "SkTableColorFilter.h"
22 #include "SkTemplates.h" 21 #include "SkTemplates.h"
23 #include "SkTypeface.h" 22 #include "SkTypeface.h"
24 #include "SkWriteBuffer.h" 23 #include "SkWriteBuffer.h"
25 #include "SkValidatingReadBuffer.h" 24 #include "SkValidatingReadBuffer.h"
26 #include "SkXfermodeImageFilter.h" 25 #include "SkXfermodeImageFilter.h"
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 sk_sp<SkTypeface> typeface(SkTypeface::MakeFromFile(filename.c_str(), 1) ); 363 sk_sp<SkTypeface> typeface(SkTypeface::MakeFromFile(filename.c_str(), 1) );
365 if (!typeface) { 364 if (!typeface) {
366 INFOF(reporter, "Could not run fontstream test because test.ttc not found."); 365 INFOF(reporter, "Could not run fontstream test because test.ttc not found.");
367 } else { 366 } else {
368 serialize_and_compare_typeface(std::move(typeface), "A!", reporter); 367 serialize_and_compare_typeface(std::move(typeface), "A!", reporter);
369 } 368 }
370 } 369 }
371 370
372 { 371 {
373 // Load typeface as stream to create with axis settings. 372 // Load typeface as stream to create with axis settings.
374 std::unique_ptr<SkStreamAsset> distortable(GetResourceAsStream("/fonts/D istortable.ttf")); 373 SkAutoTDelete<SkStreamAsset> distortable(GetResourceAsStream("/fonts/Dis tortable.ttf"));
375 if (!distortable) { 374 if (!distortable) {
376 INFOF(reporter, "Could not run fontstream test because Distortable.t tf not found."); 375 INFOF(reporter, "Could not run fontstream test because Distortable.t tf not found.");
377 } else { 376 } else {
378 SkFixed axis = SK_FixedSqrt2; 377 SkFixed axis = SK_FixedSqrt2;
379 sk_sp<SkTypeface> typeface(SkTypeface::MakeFromFontData( 378 sk_sp<SkTypeface> typeface(SkTypeface::MakeFromFontData(
380 skstd::make_unique<SkFontData>(std::move(distortable), 0, &axis, 1))); 379 new SkFontData(distortable.release(), 0, &axis, 1)));
381 if (!typeface) { 380 if (!typeface) {
382 INFOF(reporter, "Could not run fontstream test because Distortab le.ttf not created."); 381 INFOF(reporter, "Could not run fontstream test because Distortab le.ttf not created.");
383 } else { 382 } else {
384 serialize_and_compare_typeface(std::move(typeface), "abc", repor ter); 383 serialize_and_compare_typeface(std::move(typeface), "abc", repor ter);
385 } 384 }
386 } 385 }
387 } 386 }
388 } 387 }
389 388
390 static void setup_bitmap_for_canvas(SkBitmap* bitmap) { 389 static void setup_bitmap_for_canvas(SkBitmap* bitmap) {
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 { r1, SkAnnotationKeys::Define_Named_Dest_Key(), std::move(d1) }, 693 { r1, SkAnnotationKeys::Define_Named_Dest_Key(), std::move(d1) },
695 { r2, SkAnnotationKeys::Link_Named_Dest_Key(), std::move(d2) }, 694 { r2, SkAnnotationKeys::Link_Named_Dest_Key(), std::move(d2) },
696 }; 695 };
697 696
698 sk_sp<SkPicture> pict0(recorder.finishRecordingAsPicture()); 697 sk_sp<SkPicture> pict0(recorder.finishRecordingAsPicture());
699 sk_sp<SkPicture> pict1(copy_picture_via_serialization(pict0.get())); 698 sk_sp<SkPicture> pict1(copy_picture_via_serialization(pict0.get()));
700 699
701 TestAnnotationCanvas canvas(reporter, recs, SK_ARRAY_COUNT(recs)); 700 TestAnnotationCanvas canvas(reporter, recs, SK_ARRAY_COUNT(recs));
702 canvas.drawPicture(pict1); 701 canvas.drawPicture(pict1);
703 } 702 }
OLDNEW
« no previous file with comments | « tests/ExifTest.cpp ('k') | tests/YUVTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698