| 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 "SkPDFImage.h" | 8 #include "SkPDFImage.h" |
| 9 | 9 |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 bitsPerComp = 4; | 603 bitsPerComp = 4; |
| 604 } else if (isAlpha && config == SkBitmap::kA1_Config) { | 604 } else if (isAlpha && config == SkBitmap::kA1_Config) { |
| 605 bitsPerComp = 1; | 605 bitsPerComp = 1; |
| 606 } | 606 } |
| 607 insertInt("BitsPerComponent", bitsPerComp); | 607 insertInt("BitsPerComponent", bitsPerComp); |
| 608 | 608 |
| 609 if (config == SkBitmap::kRGB_565_Config) { | 609 if (config == SkBitmap::kRGB_565_Config) { |
| 610 SkASSERT(!isAlpha); | 610 SkASSERT(!isAlpha); |
| 611 SkAutoTUnref<SkPDFInt> zeroVal(new SkPDFInt(0)); | 611 SkAutoTUnref<SkPDFInt> zeroVal(new SkPDFInt(0)); |
| 612 SkAutoTUnref<SkPDFScalar> scale5Val( | 612 SkAutoTUnref<SkPDFScalar> scale5Val( |
| 613 new SkPDFScalar(SkFloatToScalar(8.2258f))); // 255/2^5-1 | 613 new SkPDFScalar(8.2258f)); // 255/2^5-1 |
| 614 SkAutoTUnref<SkPDFScalar> scale6Val( | 614 SkAutoTUnref<SkPDFScalar> scale6Val( |
| 615 new SkPDFScalar(SkFloatToScalar(4.0476f))); // 255/2^6-1 | 615 new SkPDFScalar(4.0476f)); // 255/2^6-1 |
| 616 SkAutoTUnref<SkPDFArray> decodeValue(new SkPDFArray()); | 616 SkAutoTUnref<SkPDFArray> decodeValue(new SkPDFArray()); |
| 617 decodeValue->reserve(6); | 617 decodeValue->reserve(6); |
| 618 decodeValue->append(zeroVal.get()); | 618 decodeValue->append(zeroVal.get()); |
| 619 decodeValue->append(scale5Val.get()); | 619 decodeValue->append(scale5Val.get()); |
| 620 decodeValue->append(zeroVal.get()); | 620 decodeValue->append(zeroVal.get()); |
| 621 decodeValue->append(scale6Val.get()); | 621 decodeValue->append(scale6Val.get()); |
| 622 decodeValue->append(zeroVal.get()); | 622 decodeValue->append(zeroVal.get()); |
| 623 decodeValue->append(scale5Val.get()); | 623 decodeValue->append(scale5Val.get()); |
| 624 insert("Decode", decodeValue.get()); | 624 insert("Decode", decodeValue.get()); |
| 625 } | 625 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 // but the new catalog wants it compressed. | 680 // but the new catalog wants it compressed. |
| 681 if (!getSubstitute()) { | 681 if (!getSubstitute()) { |
| 682 SkPDFStream* substitute = SkNEW_ARGS(SkPDFImage, (*this)); | 682 SkPDFStream* substitute = SkNEW_ARGS(SkPDFImage, (*this)); |
| 683 setSubstitute(substitute); | 683 setSubstitute(substitute); |
| 684 catalog->setSubstitute(this, substitute); | 684 catalog->setSubstitute(this, substitute); |
| 685 } | 685 } |
| 686 return false; | 686 return false; |
| 687 } | 687 } |
| 688 return true; | 688 return true; |
| 689 } | 689 } |
| OLD | NEW |