xref: /aosp_15_r20/external/skia/src/encode/SkImageEncoderPriv.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
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/SkImageInfo.h"
12 #include "include/core/SkPixmap.h"
13 #include "src/core/SkImageInfoPriv.h"
14 
SkPixmapIsValid(const SkPixmap & src)15 static inline bool SkPixmapIsValid(const SkPixmap& src) {
16     if (!SkImageInfoIsValid(src.info())) {
17         return false;
18     }
19 
20     if (!src.addr() || src.rowBytes() < src.info().minRowBytes()) {
21         return false;
22     }
23 
24     return true;
25 }
26 
27 #endif // SkImageEncoderPriv_DEFINED
28