1 /* 2 * Copyright 2016 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 8 #ifndef SkImageEncoderPriv_DEFINED 9 #define SkImageEncoderPriv_DEFINED 10 11 #include "include/core/SkImageEncoder.h" 12 #include "include/private/SkImageInfoPriv.h" 13 SkPixmapIsValid(const SkPixmap & src)14static inline bool SkPixmapIsValid(const SkPixmap& src) { 15 if (!SkImageInfoIsValid(src.info())) { 16 return false; 17 } 18 19 if (!src.addr() || src.rowBytes() < src.info().minRowBytes()) { 20 return false; 21 } 22 23 return true; 24 } 25 26 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) 27 bool SkEncodeImageWithCG(SkWStream*, const SkPixmap&, SkEncodedImageFormat); 28 #else 29 #define SkEncodeImageWithCG(...) false 30 #endif 31 32 #ifdef SK_BUILD_FOR_WIN 33 bool SkEncodeImageWithWIC(SkWStream*, const SkPixmap&, SkEncodedImageFormat, int quality); 34 #else 35 #define SkEncodeImageWithWIC(...) false 36 #endif 37 38 #ifdef SK_ENABLE_NDK_IMAGES 39 bool SkEncodeImageWithNDK(SkWStream*, const SkPixmap&, SkEncodedImageFormat, int quality); 40 #else 41 #define SkEncodeImageWithNDK(...) false 42 #endif 43 44 #endif // SkImageEncoderPriv_DEFINED 45