| 1 |
/* |
| 2 |
* Copyright 2015 Google Inc. |
| 3 |
* |
| 4 |
* Use of this source code is governed by a BSD-style license that can be |
| 5 |
* found in the LICENSE file. |
| 6 |
*/ |
| 7 |
#ifndef SkPDFBitmap_DEFINED |
| 8 |
#define SkPDFBitmap_DEFINED |
| 9 |
|
| 10 |
#include "include/core/SkData.h" |
| 11 |
#include "include/core/SkRefCnt.h" |
| 12 |
#include "src/core/SkChecksum.h" |
| 13 |
|
| 14 |
#include <cstdint> |
| 15 |
|
| 16 |
class SkImage; |
| 17 |
class SkPDFDocument; |
| 18 |
struct SkPDFIndirectReference; |
| 19 |
|
| 20 |
/** |
| 21 |
* Serialize a SkImage as an Image Xobject. |
| 22 |
* quality > 100 means lossless |
| 23 |
*/ |
| 24 |
SkPDFIndirectReference SkPDFSerializeImage(const SkImage* img, |
| 25 |
SkPDFDocument* doc, |
| 26 |
int encodingQuality); |
| 27 |
|
| 28 |
size_t SkPDFSerializeImageSize(const SkImage* img, SkPDFDocument* doc, int encodingQuality); |
| 29 |
|
| 30 |
struct SkPDFIccProfileKey { |
| 31 |
sk_sp<const SkData> fData; |
| 32 |
int fChannels; |
| 33 |
bool operator==(const SkPDFIccProfileKey& that) const { |
| 34 |
return fChannels == that.fChannels && fData->equals(that.fData.get()); |
| 35 |
} |
| 36 |
bool operator!=(const SkPDFIccProfileKey& rhs) const { return !(*this == rhs); } |
| 37 |
|
| 38 |
struct Hash { |
| 39 |
uint32_t operator()(const SkPDFIccProfileKey& k) const { |
| 40 |
return SkGoodHash()(k.fChannels) ^ SkChecksum::Hash32(k.fData->data(), k.fData->size()); |
| 41 |
} |
| 42 |
}; |
| 43 |
}; |
| 44 |
|
| 45 |
#endif // SkPDFBitmap_DEFINED |