Flutter Engine
The Flutter Engine
SkCGBase.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 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 SkCGBase_DEFINED
9#define SkCGBase_DEFINED
10
12
13#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
14
16
17#ifdef SK_BUILD_FOR_MAC
18#import <ApplicationServices/ApplicationServices.h>
19#endif
20
21#ifdef SK_BUILD_FOR_IOS
22#include <CoreGraphics/CoreGraphics.h>
23#endif
24
25// Skia extensions for types in CGBase.h
26
27static inline CGFloat SkScalarToCGFloat(SkScalar scalar) {
28 return CGFLOAT_IS_DOUBLE ? SkScalarToDouble(scalar) : scalar;
29}
30
31static inline SkScalar SkScalarFromCGFloat(CGFloat cgFloat) {
32 return CGFLOAT_IS_DOUBLE ? SkDoubleToScalar(cgFloat) : cgFloat;
33}
34
35static inline float SkFloatFromCGFloat(CGFloat cgFloat) {
36 return CGFLOAT_IS_DOUBLE ? static_cast<float>(cgFloat) : cgFloat;
37}
38
39#endif
40#endif //SkCGBase_DEFINED
#define SkScalarToDouble(x)
Definition: SkScalar.h:63
#define SkDoubleToScalar(x)
Definition: SkScalar.h:64
float SkScalar
Definition: extension.cpp:12