blob: a7707fec52d3e57c14b387939f432b80289cda17 [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
11#include "SkImageEncoder.h"
Matt Sarettc367d032017-05-05 11:13:26 -040012#include "SkImageInfoPriv.h"
13
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
Hal Canarydb683012016-11-23 08:55:18 -070038#endif // SkImageEncoderPriv_DEFINED