7
7
// This file is always in the GN sources list, but its contents should not be
8
8
// used for API levels other than HEAD where images2 and sysmem2 are supported.
9
9
10
- #if __Fuchsia_API_level__ < 19
10
+ #if FUCHSIA_API_LEVEL_LESS_THAN(19)
11
11
// Enable a subset of functionality. See https://fxbug.dev/42085119.
12
12
// It cannot be undefined because other Fuchsia headers may indirectly include image_format.h.
13
13
#define __ALLOW_IMAGES2_AND_SYSMEM2_TYPES_ONLY__
@@ -38,7 +38,7 @@ using safemath::CheckDiv;
38
38
using safemath::CheckMul;
39
39
using safemath::CheckSub;
40
40
41
- #if __Fuchsia_API_level__ < 19
41
+ #if FUCHSIA_API_LEVEL_LESS_THAN(19)
42
42
// This is used by the ImageFormatSet implementations before it is defined.
43
43
// Normally, it is declared by the header.
44
44
uint32_t ImageFormatStrideBytesPerWidthPixel (const PixelFormatAndModifier& pixel_format);
@@ -56,7 +56,7 @@ using ImageFormatWire = fuchsia_images2::wire::ImageFormat;
56
56
using ImageFormatConstraintsWire = fuchsia_sysmem2::wire::ImageFormatConstraints;
57
57
using PixelFormatWire = fuchsia_images2::wire::PixelFormat;
58
58
59
- #if __Fuchsia_API_level__ >= 19
59
+ #if FUCHSIA_API_LEVEL_AT_LEAST(19)
60
60
// There are two aspects of the ColorSpaceWire and PixelFormatWire that we care about:
61
61
// * bits-per-sample - bits per primary sample (R, G, B, or Y)
62
62
// * RGB vs. YUV - whether the system supports the ColorSpaceWire or PixelFormatWire
@@ -114,7 +114,7 @@ const std::map<PixelFormatWire, SamplingInfo> kPixelFormatSamplingInfo = {
114
114
{PixelFormat::kA2B10G10R10 , {{8 }, {kColorType_RGB }}},
115
115
{PixelFormat::kA2R10G10B10 , {{8 }, {kColorType_RGB }}},
116
116
};
117
- #endif // __Fuchsia_API_level__ >= 19
117
+ #endif // FUCHSIA_API_LEVEL_AT_LEAST(19)
118
118
119
119
constexpr uint32_t kTransactionEliminationAlignment = 64 ;
120
120
// The transaction elimination buffer is always reported as plane 3.
@@ -990,7 +990,7 @@ constexpr const ImageFormatSet* kImageFormats[] = {
990
990
991
991
} // namespace
992
992
993
- #if __Fuchsia_API_level__ >= 19
993
+ #if FUCHSIA_API_LEVEL_AT_LEAST(19)
994
994
995
995
bool ImageFormatIsPixelFormatEqual (const PixelFormatAndModifier& a,
996
996
const PixelFormatAndModifier& b) {
@@ -1059,7 +1059,7 @@ bool ImageFormatIsSupportedColorSpaceForPixelFormat(
1059
1059
return ImageFormatIsSupportedColorSpaceForPixelFormat (color_space_v2, pixel_format_v2);
1060
1060
}
1061
1061
1062
- #endif // __Fuchsia_API_level__ >= 19
1062
+ #endif // FUCHSIA_API_LEVEL_AT_LEAST(19)
1063
1063
1064
1064
bool ImageFormatIsSupported (const PixelFormatAndModifier& pixel_format) {
1065
1065
return std::any_of (std::begin (kImageFormats ), std::end (kImageFormats ),
@@ -1068,7 +1068,7 @@ bool ImageFormatIsSupported(const PixelFormatAndModifier& pixel_format) {
1068
1068
});
1069
1069
}
1070
1070
1071
- #if __Fuchsia_API_level__ >= 19
1071
+ #if FUCHSIA_API_LEVEL_AT_LEAST(19)
1072
1072
1073
1073
bool ImageFormatIsSupported (const fuchsia_sysmem::wire::PixelFormat& wire_pixel_format_v1) {
1074
1074
auto pixel_format_v1 = fidl::ToNatural (wire_pixel_format_v1);
@@ -1129,7 +1129,7 @@ uint32_t ImageFormatBitsPerPixel(const fuchsia_sysmem::wire::PixelFormat& wire_p
1129
1129
return ImageFormatBitsPerPixel (pixel_format_v2);
1130
1130
}
1131
1131
1132
- #endif // __Fuchsia_API_level__ >= 19
1132
+ #endif // FUCHSIA_API_LEVEL_AT_LEAST(19)
1133
1133
1134
1134
uint32_t ImageFormatStrideBytesPerWidthPixel (const PixelFormatAndModifier& pixel_format) {
1135
1135
ZX_DEBUG_ASSERT (ImageFormatIsSupported (pixel_format));
@@ -1183,7 +1183,7 @@ uint32_t ImageFormatStrideBytesPerWidthPixel(const PixelFormatAndModifier& pixel
1183
1183
}
1184
1184
}
1185
1185
1186
- #if __Fuchsia_API_level__ >= 19
1186
+ #if FUCHSIA_API_LEVEL_AT_LEAST(19)
1187
1187
1188
1188
uint32_t ImageFormatStrideBytesPerWidthPixel (
1189
1189
const fuchsia_sysmem::wire::PixelFormat& wire_pixel_format_v1) {
@@ -1388,7 +1388,7 @@ uint32_t ImageFormatSampleAlignment(const fuchsia_sysmem::wire::PixelFormat& wir
1388
1388
return ImageFormatSampleAlignment (pixel_format_v2);
1389
1389
}
1390
1390
1391
- #endif // __Fuchsia_API_level__ >= 19
1391
+ #endif // FUCHSIA_API_LEVEL_AT_LEAST(19)
1392
1392
1393
1393
bool ImageFormatMinimumRowBytes (const fuchsia_sysmem2::ImageFormatConstraints& constraints,
1394
1394
uint32_t width, uint32_t * minimum_row_bytes_out) {
@@ -1408,7 +1408,7 @@ bool ImageFormatMinimumRowBytes(const fuchsia_sysmem2::ImageFormatConstraints& c
1408
1408
return false ;
1409
1409
}
1410
1410
1411
- #if __Fuchsia_API_level__ >= 19
1411
+ #if FUCHSIA_API_LEVEL_AT_LEAST(19)
1412
1412
1413
1413
bool ImageFormatMinimumRowBytes (
1414
1414
const fuchsia_sysmem2::wire::ImageFormatConstraints& wire_constraints, uint32_t width,
@@ -1468,7 +1468,7 @@ fpromise::result<fuchsia_images2::wire::PixelFormat> ImageFormatConvertZbiToSysm
1468
1468
}
1469
1469
}
1470
1470
1471
- #endif // __Fuchsia_API_level__ >= 19
1471
+ #endif // FUCHSIA_API_LEVEL_AT_LEAST(19)
1472
1472
1473
1473
fpromise::result<ImageFormat> ImageConstraintsToFormat (const ImageFormatConstraints& constraints,
1474
1474
uint32_t width, uint32_t height) {
@@ -1500,7 +1500,7 @@ fpromise::result<ImageFormat> ImageConstraintsToFormat(const ImageFormatConstrai
1500
1500
return fpromise::ok (std::move (result));
1501
1501
}
1502
1502
1503
- #if __Fuchsia_API_level__ >= 19
1503
+ #if FUCHSIA_API_LEVEL_AT_LEAST(19)
1504
1504
fpromise::result<ImageFormatWire> ImageConstraintsToFormat (
1505
1505
fidl::AnyArena& allocator, const ImageFormatConstraintsWire& wire_constraints, uint32_t width,
1506
1506
uint32_t height) {
@@ -1511,7 +1511,7 @@ fpromise::result<ImageFormatWire> ImageConstraintsToFormat(
1511
1511
}
1512
1512
return fpromise::ok (fidl::ToWire (allocator, result.take_value ()));
1513
1513
}
1514
- #endif // __Fuchsia_API_level__ >= 19
1514
+ #endif // FUCHSIA_API_LEVEL_AT_LEAST(19)
1515
1515
1516
1516
fpromise::result<fuchsia_sysmem::wire::ImageFormat2> ImageConstraintsToFormat (
1517
1517
const fuchsia_sysmem::wire::ImageFormatConstraints& wire_image_format_constraints_v1,
@@ -1551,12 +1551,12 @@ bool ImageFormatPlaneByteOffset(const ImageFormat& image_format, uint32_t plane,
1551
1551
return false ;
1552
1552
}
1553
1553
1554
- #if __Fuchsia_API_level__ >= 19
1554
+ #if FUCHSIA_API_LEVEL_AT_LEAST(19)
1555
1555
bool ImageFormatPlaneByteOffset (const ImageFormatWire& image_format, uint32_t plane,
1556
1556
uint64_t * offset_out) {
1557
1557
return ImageFormatPlaneByteOffset (fidl::ToNatural (image_format), plane, offset_out);
1558
1558
}
1559
- #endif // __Fuchsia_API_level__ >= 19
1559
+ #endif // FUCHSIA_API_LEVEL_AT_LEAST(19)
1560
1560
1561
1561
bool ImageFormatPlaneByteOffset (const fuchsia_sysmem::wire::ImageFormat2& wire_image_format_v1,
1562
1562
uint32_t plane, uint64_t * offset_out) {
@@ -1582,12 +1582,12 @@ bool ImageFormatPlaneRowBytes(const ImageFormat& image_format, uint32_t plane,
1582
1582
return false ;
1583
1583
}
1584
1584
1585
- #if __Fuchsia_API_level__ >= 19
1585
+ #if FUCHSIA_API_LEVEL_AT_LEAST(19)
1586
1586
bool ImageFormatPlaneRowBytes (const ImageFormatWire& wire_image_format, uint32_t plane,
1587
1587
uint32_t * row_bytes_out) {
1588
1588
return ImageFormatPlaneRowBytes (fidl::ToNatural (wire_image_format), plane, row_bytes_out);
1589
1589
}
1590
- #endif // __Fuchsia_API_level__ >= 19
1590
+ #endif // FUCHSIA_API_LEVEL_AT_LEAST(19)
1591
1591
1592
1592
bool ImageFormatPlaneRowBytes (const fuchsia_sysmem::wire::ImageFormat2& wire_image_format_v1,
1593
1593
uint32_t plane, uint32_t * row_bytes_out) {
@@ -1601,7 +1601,7 @@ bool ImageFormatPlaneRowBytes(const fuchsia_sysmem::wire::ImageFormat2& wire_ima
1601
1601
return ImageFormatPlaneRowBytes (image_format_v2, plane, row_bytes_out);
1602
1602
}
1603
1603
1604
- #if __Fuchsia_API_level__ >= 19
1604
+ #if FUCHSIA_API_LEVEL_AT_LEAST(19)
1605
1605
1606
1606
bool ImageFormatCompatibleWithProtectedMemory (const PixelFormatAndModifier& pixel_format) {
1607
1607
// AKA kFormatModifierLinear
@@ -1630,4 +1630,4 @@ bool ImageFormatCompatibleWithProtectedMemory(
1630
1630
return ImageFormatCompatibleWithProtectedMemory (pixel_format_v2);
1631
1631
}
1632
1632
1633
- #endif // __Fuchsia_API_level__ >= 19
1633
+ #endif // FUCHSIA_API_LEVEL_AT_LEAST(19)
0 commit comments