blob: dc1f6da606e82630f6c55c0ffe032a072ca8a46b [file] [log] [blame]
Hal Canarydb683012016-11-23 08:55:18 -07001/*
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
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "include/core/SkImageEncoder.h"
12#include "include/private/SkImageInfoPriv.h"
Matt Sarettc367d032017-05-05 11:13:26 -040013
Brian Osmane1adc3a2018-06-04 09:21:17 -040014static inline bool SkPixmapIsValid(const SkPixmap& src) {
15 if (!SkImageInfoIsValid(src.info())) {
16 return false;
Matt Sarettc367d032017-05-05 11:13:26 -040017 }
18
19 if (!src.addr() || src.rowBytes() < src.info().minRowBytes()) {
20 return false;
21 }
22
23 return true;
24}
Hal Canarydb683012016-11-23 08:55:18 -070025
Hal Canarydb683012016-11-23 08:55:18 -070026#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
Hal Canary1fcc4042016-11-30 17:07:59 -050027 bool SkEncodeImageWithCG(SkWStream*, const SkPixmap&, SkEncodedImageFormat);
28#else
29 #define SkEncodeImageWithCG(...) false
Hal Canarydb683012016-11-23 08:55:18 -070030#endif
31
Hal Canary1fcc4042016-11-30 17:07:59 -050032#ifdef SK_BUILD_FOR_WIN
33 bool SkEncodeImageWithWIC(SkWStream*, const SkPixmap&, SkEncodedImageFormat, int quality);
34#else
35 #define SkEncodeImageWithWIC(...) false
Hal Canarydb683012016-11-23 08:55:18 -070036#endif
37
Leon Scroggins III326b9892020-08-05 16:51:10 -040038#ifdef SK_ENABLE_NDK_IMAGES
39 bool SkEncodeImageWithNDK(SkWStream*, const SkPixmap&, SkEncodedImageFormat, int quality);
40#else
41 #define SkEncodeImageWithNDK(...) false
42#endif
43
Hal Canarydb683012016-11-23 08:55:18 -070044#endif // SkImageEncoderPriv_DEFINED