Flutter Engine
The Flutter Engine
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
13
14/** Returns true if mode's value is in the SkBlendMode enum.
15 */
16static 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 */
22static 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 */
28static 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
SkBlendMode
Definition: SkBlendMode.h:38
@ kLastMode
last valid value
static bool SkIsFinite(T x, Pack... values)
static bool SkIsValidRect(const SkRect &rect)
static bool SkIsValidMode(SkBlendMode mode)
static bool SkIsValidIRect(const SkIRect &rect)
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition: switches.h:228
Definition: SkRect.h:32