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 "Resources.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
11 #include "SkData.h" | 11 #include "SkData.h" |
12 #include "SkDocument.h" | 12 #include "SkDocument.h" |
13 #include "SkDeflate.h" | 13 #include "SkDeflate.h" |
14 #include "SkImageEncoder.h" | 14 #include "SkImageEncoder.h" |
15 #include "SkMatrix.h" | 15 #include "SkMatrix.h" |
16 #include "SkPDFCanon.h" | 16 #include "SkPDFCanon.h" |
17 #include "SkPDFDevice.h" | 17 #include "SkPDFDevice.h" |
18 #include "SkPDFFont.h" | 18 #include "SkPDFFont.h" |
19 #include "SkPDFStream.h" | 19 #include "SkPDFStream.h" |
20 #include "SkPDFTypes.h" | 20 #include "SkPDFTypes.h" |
21 #include "SkPDFUtils.h" | 21 #include "SkPDFUtils.h" |
22 #include "SkReadBuffer.h" | 22 #include "SkReadBuffer.h" |
23 #include "SkScalar.h" | 23 #include "SkScalar.h" |
| 24 #include "SkSpecialImage.h" |
24 #include "SkStream.h" | 25 #include "SkStream.h" |
25 #include "SkTypes.h" | 26 #include "SkTypes.h" |
26 #include "Test.h" | 27 #include "Test.h" |
27 #include "sk_tool_utils.h" | 28 #include "sk_tool_utils.h" |
28 | 29 |
29 #define DUMMY_TEXT "DCT compessed stream." | 30 #define DUMMY_TEXT "DCT compessed stream." |
30 | 31 |
31 namespace { | 32 namespace { |
32 struct Catalog { | 33 struct Catalog { |
33 SkPDFSubstituteMap substitutes; | 34 SkPDFSubstituteMap substitutes; |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 public: | 367 public: |
367 static sk_sp<DummyImageFilter> Make(bool visited = false) { | 368 static sk_sp<DummyImageFilter> Make(bool visited = false) { |
368 return sk_sp<DummyImageFilter>(new DummyImageFilter(visited)); | 369 return sk_sp<DummyImageFilter>(new DummyImageFilter(visited)); |
369 } | 370 } |
370 | 371 |
371 SK_TO_STRING_OVERRIDE() | 372 SK_TO_STRING_OVERRIDE() |
372 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DummyImageFilter) | 373 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DummyImageFilter) |
373 bool visited() const { return fVisited; } | 374 bool visited() const { return fVisited; } |
374 | 375 |
375 protected: | 376 protected: |
376 bool onFilterImageDeprecated(Proxy*, const SkBitmap& src, const Context&, | 377 sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&, |
377 SkBitmap* result, SkIPoint* offset) const overr
ide { | 378 SkIPoint* offset) const override { |
378 fVisited = true; | 379 fVisited = true; |
379 offset->fX = offset->fY = 0; | 380 offset->fX = offset->fY = 0; |
380 *result = src; | 381 return sk_ref_sp<SkSpecialImage>(source); |
381 return true; | |
382 } | 382 } |
383 | 383 |
384 private: | 384 private: |
385 DummyImageFilter(bool visited) : INHERITED(nullptr, 0, nullptr), fVisited(vi
sited) {} | 385 DummyImageFilter(bool visited) : INHERITED(nullptr, 0, nullptr), fVisited(vi
sited) {} |
386 | 386 |
387 mutable bool fVisited; | 387 mutable bool fVisited; |
388 | 388 |
389 typedef SkImageFilter INHERITED; | 389 typedef SkImageFilter INHERITED; |
390 }; | 390 }; |
391 | 391 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 float alwaysCheck[] = { | 482 float alwaysCheck[] = { |
483 0.0f, -0.0f, 1.0f, -1.0f, SK_ScalarPI, 0.1f, FLT_MIN, FLT_MAX, | 483 0.0f, -0.0f, 1.0f, -1.0f, SK_ScalarPI, 0.1f, FLT_MIN, FLT_MAX, |
484 -FLT_MIN, -FLT_MAX, FLT_MIN / 16.0f, -FLT_MIN / 16.0f, | 484 -FLT_MIN, -FLT_MAX, FLT_MIN / 16.0f, -FLT_MIN / 16.0f, |
485 SK_FloatNaN, SK_FloatInfinity, SK_FloatNegativeInfinity, | 485 SK_FloatNaN, SK_FloatInfinity, SK_FloatNegativeInfinity, |
486 -FLT_MIN / 8388608.0 | 486 -FLT_MIN / 8388608.0 |
487 }; | 487 }; |
488 for (float inputFloat: alwaysCheck) { | 488 for (float inputFloat: alwaysCheck) { |
489 check_pdf_scalar_serialization(reporter, inputFloat); | 489 check_pdf_scalar_serialization(reporter, inputFloat); |
490 } | 490 } |
491 } | 491 } |
OLD | NEW |