Hal Canary | db68301 | 2016-11-23 08:55:18 -0700 | [diff] [blame] | 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 "SkImageEncoder.h" |
Matt Sarett | c367d03 | 2017-05-05 11:13:26 -0400 | [diff] [blame] | 12 | #include "SkImageInfoPriv.h" |
| 13 | |
Brian Osman | e1adc3a | 2018-06-04 09:21:17 -0400 | [diff] [blame] | 14 | static inline bool SkPixmapIsValid(const SkPixmap& src) { |
| 15 | if (!SkImageInfoIsValid(src.info())) { |
| 16 | return false; |
Matt Sarett | c367d03 | 2017-05-05 11:13:26 -0400 | [diff] [blame] | 17 | } |
| 18 | |
| 19 | if (!src.addr() || src.rowBytes() < src.info().minRowBytes()) { |
| 20 | return false; |
| 21 | } |
| 22 | |
| 23 | return true; |
| 24 | } |
Hal Canary | db68301 | 2016-11-23 08:55:18 -0700 | [diff] [blame] | 25 | |
Hal Canary | db68301 | 2016-11-23 08:55:18 -0700 | [diff] [blame] | 26 | #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
Hal Canary | 1fcc404 | 2016-11-30 17:07:59 -0500 | [diff] [blame] | 27 | bool SkEncodeImageWithCG(SkWStream*, const SkPixmap&, SkEncodedImageFormat); |
| 28 | #else |
| 29 | #define SkEncodeImageWithCG(...) false |
Hal Canary | db68301 | 2016-11-23 08:55:18 -0700 | [diff] [blame] | 30 | #endif |
| 31 | |
Hal Canary | 1fcc404 | 2016-11-30 17:07:59 -0500 | [diff] [blame] | 32 | #ifdef SK_BUILD_FOR_WIN |
| 33 | bool SkEncodeImageWithWIC(SkWStream*, const SkPixmap&, SkEncodedImageFormat, int quality); |
| 34 | #else |
| 35 | #define SkEncodeImageWithWIC(...) false |
Hal Canary | db68301 | 2016-11-23 08:55:18 -0700 | [diff] [blame] | 36 | #endif |
| 37 | |
Hal Canary | db68301 | 2016-11-23 08:55:18 -0700 | [diff] [blame] | 38 | #endif // SkImageEncoderPriv_DEFINED |