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 = 101); 27 28 struct SkPDFIccProfileKey { 29 sk_sp<SkData> fData; 30 int fChannels; 31 bool operator==(const SkPDFIccProfileKey& that) const { 32 return fChannels == that.fChannels && fData->equals(that.fData.get()); 33 } 34 bool operator!=(const SkPDFIccProfileKey& rhs) const { return !(*this == rhs); } 35 36 struct Hash { operatorSkPDFIccProfileKey::Hash37 uint32_t operator()(const SkPDFIccProfileKey& k) const { 38 return SkGoodHash()(k.fChannels) ^ SkChecksum::Hash32(k.fData->data(), k.fData->size()); 39 } 40 }; 41 }; 42 43 #endif // SkPDFBitmap_DEFINED 44