OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 The Android Open Source Project | 2 * Copyright 2010 The Android Open Source Project |
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 "SkBitmap.h" | 9 #include "SkBitmap.h" |
9 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
10 #include "SkData.h" | 11 #include "SkData.h" |
11 #include "SkDocument.h" | 12 #include "SkDocument.h" |
12 #include "SkDeflate.h" | 13 #include "SkDeflate.h" |
13 #include "SkImageEncoder.h" | 14 #include "SkImageEncoder.h" |
14 #include "SkMatrix.h" | 15 #include "SkMatrix.h" |
15 #include "SkPDFCanon.h" | 16 #include "SkPDFCanon.h" |
16 #include "SkPDFDevice.h" | 17 #include "SkPDFDevice.h" |
| 18 #include "SkPDFFont.h" |
17 #include "SkPDFStream.h" | 19 #include "SkPDFStream.h" |
18 #include "SkPDFTypes.h" | 20 #include "SkPDFTypes.h" |
19 #include "SkReadBuffer.h" | 21 #include "SkReadBuffer.h" |
20 #include "SkScalar.h" | 22 #include "SkScalar.h" |
21 #include "SkStream.h" | 23 #include "SkStream.h" |
22 #include "SkTypes.h" | 24 #include "SkTypes.h" |
23 #include "Test.h" | 25 #include "Test.h" |
| 26 #include "sk_tool_utils.h" |
24 | 27 |
25 #define DUMMY_TEXT "DCT compessed stream." | 28 #define DUMMY_TEXT "DCT compessed stream." |
26 | 29 |
27 namespace { | 30 namespace { |
28 struct Catalog { | 31 struct Catalog { |
29 SkPDFSubstituteMap substitutes; | 32 SkPDFSubstituteMap substitutes; |
30 SkPDFObjNumMap numbers; | 33 SkPDFObjNumMap numbers; |
31 }; | 34 }; |
32 } // namespace | 35 } // namespace |
33 | 36 |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 // Filter just created; should be unvisited. | 411 // Filter just created; should be unvisited. |
409 REPORTER_ASSERT(reporter, !filter->visited()); | 412 REPORTER_ASSERT(reporter, !filter->visited()); |
410 SkPaint paint; | 413 SkPaint paint; |
411 paint.setImageFilter(filter.get()); | 414 paint.setImageFilter(filter.get()); |
412 canvas->drawRect(SkRect::MakeWH(100, 100), paint); | 415 canvas->drawRect(SkRect::MakeWH(100, 100), paint); |
413 doc->close(); | 416 doc->close(); |
414 | 417 |
415 // Filter was used in rendering; should be visited. | 418 // Filter was used in rendering; should be visited. |
416 REPORTER_ASSERT(reporter, filter->visited()); | 419 REPORTER_ASSERT(reporter, filter->visited()); |
417 } | 420 } |
| 421 |
| 422 // Check that PDF rendering of image filters successfully falls back to |
| 423 // CPU rasterization. |
| 424 DEF_TEST(PDFFontCanEmbedTypeface, reporter) { |
| 425 SkPDFCanon canon; |
| 426 |
| 427 const char resource[] = "fonts/Roboto2-Regular_NoEmbed.ttf"; |
| 428 SkAutoTUnref<SkTypeface> noEmbedTypeface(GetResourceAsTypeface(resource)); |
| 429 if (noEmbedTypeface) { |
| 430 REPORTER_ASSERT(reporter, |
| 431 !SkPDFFont::CanEmbedTypeface(noEmbedTypeface, &canon)); |
| 432 } |
| 433 SkAutoTUnref<SkTypeface> portableTypeface( |
| 434 sk_tool_utils::create_portable_typeface(NULL, SkTypeface::kNormal)); |
| 435 REPORTER_ASSERT(reporter, |
| 436 SkPDFFont::CanEmbedTypeface(portableTypeface, &canon)); |
| 437 } |
OLD | NEW |