2016-11-23 15:55:18 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2016 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SkImageEncoderPriv_DEFINED
|
|
|
|
#define SkImageEncoderPriv_DEFINED
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkImageEncoder.h"
|
|
|
|
#include "include/private/SkImageInfoPriv.h"
|
2017-05-05 15:13:26 +00:00
|
|
|
|
2018-06-04 13:21:17 +00:00
|
|
|
static inline bool SkPixmapIsValid(const SkPixmap& src) {
|
|
|
|
if (!SkImageInfoIsValid(src.info())) {
|
|
|
|
return false;
|
2017-05-05 15:13:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!src.addr() || src.rowBytes() < src.info().minRowBytes()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2016-11-23 15:55:18 +00:00
|
|
|
|
|
|
|
#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
|
2016-11-30 22:07:59 +00:00
|
|
|
bool SkEncodeImageWithCG(SkWStream*, const SkPixmap&, SkEncodedImageFormat);
|
|
|
|
#else
|
|
|
|
#define SkEncodeImageWithCG(...) false
|
2016-11-23 15:55:18 +00:00
|
|
|
#endif
|
|
|
|
|
2016-11-30 22:07:59 +00:00
|
|
|
#ifdef SK_BUILD_FOR_WIN
|
|
|
|
bool SkEncodeImageWithWIC(SkWStream*, const SkPixmap&, SkEncodedImageFormat, int quality);
|
|
|
|
#else
|
|
|
|
#define SkEncodeImageWithWIC(...) false
|
2016-11-23 15:55:18 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // SkImageEncoderPriv_DEFINED
|