Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
src
core
SkValidationUtils.h
Go to the documentation of this file.
1
/*
2
* Copyright 2013 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 SkValidationUtils_DEFINED
9
#define SkValidationUtils_DEFINED
10
11
#include "
include/core/SkBitmap.h
"
12
#include "
include/core/SkBlendMode.h
"
13
14
/** Returns true if mode's value is in the SkBlendMode enum.
15
*/
16
static
inline
bool
SkIsValidMode
(
SkBlendMode
mode) {
17
return
(
unsigned
)mode <= (unsigned)
SkBlendMode::kLastMode
;
18
}
19
20
/** Returns true if the rect's dimensions are between 0 and SK_MaxS32
21
*/
22
static
inline
bool
SkIsValidIRect
(
const
SkIRect
& rect) {
23
return
rect.width() >= 0 && rect.height() >= 0;
24
}
25
26
/** Returns true if the rect's dimensions are between 0 and SK_ScalarMax
27
*/
28
static
inline
bool
SkIsValidRect
(
const
SkRect
& rect) {
29
return
(rect.fLeft <= rect.fRight) &&
30
(rect.fTop <= rect.fBottom) &&
31
SkIsFinite
(rect.width(), rect.height());
32
}
33
34
#endif
SkBitmap.h
SkBlendMode.h
SkBlendMode
SkBlendMode
Definition
SkBlendMode.h:38
SkBlendMode::kLastMode
@ kLastMode
last valid value
SkIsFinite
static bool SkIsFinite(T x, Pack... values)
Definition
SkFloatingPoint.h:50
SkIsValidRect
static bool SkIsValidRect(const SkRect &rect)
Definition
SkValidationUtils.h:28
SkIsValidMode
static bool SkIsValidMode(SkBlendMode mode)
Definition
SkValidationUtils.h:16
SkIsValidIRect
static bool SkIsValidIRect(const SkIRect &rect)
Definition
SkValidationUtils.h:22
SkIRect
Definition
SkRect.h:32
SkRect
Definition
extension.cpp:13
Generated on Fri Apr 26 2024 06:16:50 for Flutter Engine by
1.9.8