Fix clang-tidy warnings about enum names.
This commit is contained in:
@@ -23,7 +23,7 @@ class Texture;
|
||||
/// component, and then one or more qualifiers to its
|
||||
/// interpretation.
|
||||
///
|
||||
/// For instance, `kR8G8B8A8_UNormInt_SRGB` is a 32 bits-per-pixel
|
||||
/// For instance, `kR8G8B8A8UNormIntSRGB` is a 32 bits-per-pixel
|
||||
/// format ordered in RGBA with 8 bits per component with each
|
||||
/// component expressed as an unsigned normalized integer and a
|
||||
/// conversion from sRGB to linear color space.
|
||||
@@ -46,12 +46,12 @@ class Texture;
|
||||
///
|
||||
enum class PixelFormat {
|
||||
kUnknown,
|
||||
kR8G8B8A8_UNormInt,
|
||||
kR8G8B8A8_UNormInt_SRGB,
|
||||
kB8G8R8A8_UNormInt,
|
||||
kB8G8R8A8_UNormInt_SRGB,
|
||||
kR8G8B8A8UNormInt,
|
||||
kR8G8B8A8UNormIntSRGB,
|
||||
kB8G8R8A8UNormInt,
|
||||
kB8G8R8A8UNormIntSRGB,
|
||||
// Esoteric formats only used as render targets.
|
||||
kD32_Float_S8_UNormInt,
|
||||
kD32FloatS8UNormInt,
|
||||
};
|
||||
|
||||
enum class BlendFactor {
|
||||
@@ -140,12 +140,12 @@ constexpr size_t BytesPerPixelForPixelFormat(PixelFormat format) {
|
||||
switch (format) {
|
||||
case PixelFormat::kUnknown:
|
||||
return 0u;
|
||||
case PixelFormat::kR8G8B8A8_UNormInt:
|
||||
case PixelFormat::kR8G8B8A8_UNormInt_SRGB:
|
||||
case PixelFormat::kB8G8R8A8_UNormInt:
|
||||
case PixelFormat::kB8G8R8A8_UNormInt_SRGB:
|
||||
case PixelFormat::kR8G8B8A8UNormInt:
|
||||
case PixelFormat::kR8G8B8A8UNormIntSRGB:
|
||||
case PixelFormat::kB8G8R8A8UNormInt:
|
||||
case PixelFormat::kB8G8R8A8UNormIntSRGB:
|
||||
return 4u;
|
||||
case PixelFormat::kD32_Float_S8_UNormInt:
|
||||
case PixelFormat::kD32FloatS8UNormInt:
|
||||
// This is an esoteric format and implementations may use 64 bits.
|
||||
// Impeller doesn't work with these natively and this return is only here
|
||||
// for completeness. The 40 bits is as documented.
|
||||
|
||||
@@ -21,15 +21,15 @@ constexpr MTLPixelFormat ToMTLPixelFormat(PixelFormat format) {
|
||||
switch (format) {
|
||||
case PixelFormat::kUnknown:
|
||||
return MTLPixelFormatInvalid;
|
||||
case PixelFormat::kB8G8R8A8_UNormInt:
|
||||
case PixelFormat::kB8G8R8A8UNormInt:
|
||||
return MTLPixelFormatBGRA8Unorm;
|
||||
case PixelFormat::kB8G8R8A8_UNormInt_SRGB:
|
||||
case PixelFormat::kB8G8R8A8UNormIntSRGB:
|
||||
return MTLPixelFormatBGRA8Unorm_sRGB;
|
||||
case PixelFormat::kD32_Float_S8_UNormInt:
|
||||
case PixelFormat::kD32FloatS8UNormInt:
|
||||
return MTLPixelFormatDepth32Float_Stencil8;
|
||||
case PixelFormat::kR8G8B8A8_UNormInt:
|
||||
case PixelFormat::kR8G8B8A8UNormInt:
|
||||
return MTLPixelFormatRGBA8Unorm;
|
||||
case PixelFormat::kR8G8B8A8_UNormInt_SRGB:
|
||||
case PixelFormat::kR8G8B8A8UNormIntSRGB:
|
||||
return MTLPixelFormatRGBA8Unorm_sRGB;
|
||||
}
|
||||
return MTLPixelFormatInvalid;
|
||||
|
||||
@@ -85,7 +85,7 @@ struct PipelineBuilder {
|
||||
// TODO(csg): This can be easily reflected but we are sticking to the
|
||||
// convention that the first stage output is the color output.
|
||||
PipelineColorAttachment color0;
|
||||
color0.format = PixelFormat::kB8G8R8A8_UNormInt;
|
||||
color0.format = PixelFormat::kB8G8R8A8UNormInt;
|
||||
desc.SetColorAttachmentDescriptor(0u, std::move(color0));
|
||||
}
|
||||
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
namespace impeller {
|
||||
|
||||
ColorHSB ColorHSB::FromRGB(Color rgb) {
|
||||
double R = rgb.red;
|
||||
double G = rgb.green;
|
||||
double B = rgb.blue;
|
||||
Scalar R = rgb.red;
|
||||
Scalar G = rgb.green;
|
||||
Scalar B = rgb.blue;
|
||||
|
||||
double v = 0.0;
|
||||
double x = 0.0;
|
||||
double f = 0.0;
|
||||
Scalar v = 0.0;
|
||||
Scalar x = 0.0;
|
||||
Scalar f = 0.0;
|
||||
|
||||
int64_t i = 0;
|
||||
|
||||
@@ -38,13 +38,13 @@ ColorHSB ColorHSB::FromRGB(Color rgb) {
|
||||
}
|
||||
|
||||
Color ColorHSB::ToRGBA() const {
|
||||
double h = hue * 6.0;
|
||||
double s = saturation;
|
||||
double v = brightness;
|
||||
Scalar h = hue * 6.0;
|
||||
Scalar s = saturation;
|
||||
Scalar v = brightness;
|
||||
|
||||
double m = 0.0;
|
||||
double n = 0.0;
|
||||
double f = 0.0;
|
||||
Scalar m = 0.0;
|
||||
Scalar n = 0.0;
|
||||
Scalar f = 0.0;
|
||||
|
||||
int64_t i = 0;
|
||||
|
||||
|
||||
@@ -47,27 +47,27 @@ DecompressedImage CompressedImage::Decode() const {
|
||||
/*
|
||||
* Make sure we got a valid component set.
|
||||
*/
|
||||
auto components = DecompressedImage::Format::Invalid;
|
||||
auto components = DecompressedImage::Format::kInvalid;
|
||||
|
||||
switch (comps) {
|
||||
case STBI_grey:
|
||||
components = DecompressedImage::Format::Grey;
|
||||
components = DecompressedImage::Format::kGrey;
|
||||
break;
|
||||
case STBI_grey_alpha:
|
||||
components = DecompressedImage::Format::GreyAlpha;
|
||||
components = DecompressedImage::Format::kGreyAlpha;
|
||||
break;
|
||||
case STBI_rgb:
|
||||
components = DecompressedImage::Format::RGB;
|
||||
components = DecompressedImage::Format::kRGB;
|
||||
break;
|
||||
case STBI_rgb_alpha:
|
||||
components = DecompressedImage::Format::RGBA;
|
||||
components = DecompressedImage::Format::kRGBA;
|
||||
break;
|
||||
default:
|
||||
components = DecompressedImage::Format::Invalid;
|
||||
components = DecompressedImage::Format::kInvalid;
|
||||
break;
|
||||
}
|
||||
|
||||
if (components == DecompressedImage::Format::Invalid) {
|
||||
if (components == DecompressedImage::Format::kInvalid) {
|
||||
FML_LOG(ERROR) << "Could not detect image components when decoding.";
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ DecompressedImage::DecompressedImage(
|
||||
Format format,
|
||||
std::shared_ptr<const fml::Mapping> allocation)
|
||||
: size_(size), format_(format), allocation_(std::move(allocation)) {
|
||||
if (!allocation_ || !size.IsPositive() || format_ == Format::Invalid) {
|
||||
if (!allocation_ || !size.IsPositive() || format_ == Format::kInvalid) {
|
||||
return;
|
||||
}
|
||||
is_valid_ = true;
|
||||
@@ -45,15 +45,15 @@ const std::shared_ptr<const fml::Mapping>& DecompressedImage::GetAllocation()
|
||||
|
||||
static size_t GetBytesPerPixel(DecompressedImage::Format format) {
|
||||
switch (format) {
|
||||
case DecompressedImage::Format::Invalid:
|
||||
case DecompressedImage::Format::kInvalid:
|
||||
return 0u;
|
||||
case DecompressedImage::Format::Grey:
|
||||
case DecompressedImage::Format::kGrey:
|
||||
return 1u;
|
||||
case DecompressedImage::Format::GreyAlpha:
|
||||
case DecompressedImage::Format::kGreyAlpha:
|
||||
return 1u;
|
||||
case DecompressedImage::Format::RGB:
|
||||
case DecompressedImage::Format::kRGB:
|
||||
return 3u;
|
||||
case DecompressedImage::Format::RGBA:
|
||||
case DecompressedImage::Format::kRGBA:
|
||||
return 4;
|
||||
}
|
||||
return 0u;
|
||||
@@ -64,7 +64,7 @@ DecompressedImage DecompressedImage::ConvertToRGBA() const {
|
||||
return {};
|
||||
}
|
||||
|
||||
if (format_ == Format::RGBA) {
|
||||
if (format_ == Format::kRGBA) {
|
||||
return DecompressedImage{size_, format_, allocation_};
|
||||
}
|
||||
|
||||
@@ -84,26 +84,26 @@ DecompressedImage DecompressedImage::ConvertToRGBA() const {
|
||||
|
||||
for (size_t i = 0, j = 0; i < source_byte_size; i += bpp, j += 4u) {
|
||||
switch (format_) {
|
||||
case DecompressedImage::Format::Grey:
|
||||
case DecompressedImage::Format::kGrey:
|
||||
dest[j + 0] = source[i];
|
||||
dest[j + 1] = source[i];
|
||||
dest[j + 2] = source[i];
|
||||
dest[j + 3] = std::numeric_limits<uint8_t>::max();
|
||||
break;
|
||||
case DecompressedImage::Format::GreyAlpha:
|
||||
case DecompressedImage::Format::kGreyAlpha:
|
||||
dest[j + 0] = std::numeric_limits<uint8_t>::max();
|
||||
dest[j + 1] = std::numeric_limits<uint8_t>::max();
|
||||
dest[j + 2] = std::numeric_limits<uint8_t>::max();
|
||||
dest[j + 3] = source[i];
|
||||
break;
|
||||
case DecompressedImage::Format::RGB:
|
||||
case DecompressedImage::Format::kRGB:
|
||||
dest[j + 0] = source[i + 0];
|
||||
dest[j + 1] = source[i + 1];
|
||||
dest[j + 2] = source[i + 2];
|
||||
dest[j + 3] = std::numeric_limits<uint8_t>::max();
|
||||
break;
|
||||
case DecompressedImage::Format::Invalid:
|
||||
case DecompressedImage::Format::RGBA:
|
||||
case DecompressedImage::Format::kInvalid:
|
||||
case DecompressedImage::Format::kRGBA:
|
||||
// Should never happen. The necessary checks have already been
|
||||
// performed.
|
||||
FML_CHECK(false);
|
||||
@@ -112,7 +112,7 @@ DecompressedImage DecompressedImage::ConvertToRGBA() const {
|
||||
}
|
||||
|
||||
return DecompressedImage{
|
||||
size_, Format::RGBA,
|
||||
size_, Format::kRGBA,
|
||||
std::make_shared<fml::NonOwnedMapping>(
|
||||
rgba_allocation->GetBuffer(), //
|
||||
rgba_allocation->GetLength(), //
|
||||
|
||||
@@ -16,11 +16,11 @@ namespace impeller {
|
||||
class DecompressedImage {
|
||||
public:
|
||||
enum class Format {
|
||||
Invalid,
|
||||
Grey,
|
||||
GreyAlpha,
|
||||
RGB,
|
||||
RGBA,
|
||||
kInvalid,
|
||||
kGrey,
|
||||
kGreyAlpha,
|
||||
kRGB,
|
||||
kRGBA,
|
||||
};
|
||||
|
||||
DecompressedImage();
|
||||
@@ -43,7 +43,7 @@ class DecompressedImage {
|
||||
|
||||
private:
|
||||
ISize size_;
|
||||
Format format_ = Format::Invalid;
|
||||
Format format_ = Format::kInvalid;
|
||||
std::shared_ptr<const fml::Mapping> allocation_;
|
||||
bool is_valid_ = false;
|
||||
};
|
||||
|
||||
@@ -131,7 +131,7 @@ bool Playground::OpenPlaygroundHere(Renderer::RenderCallback render_callback) {
|
||||
}
|
||||
|
||||
TextureDescriptor color0_desc;
|
||||
color0_desc.format = PixelFormat::kB8G8R8A8_UNormInt;
|
||||
color0_desc.format = PixelFormat::kB8G8R8A8UNormInt;
|
||||
color0_desc.size = {
|
||||
static_cast<ISize::Type>(current_drawable.texture.width),
|
||||
static_cast<ISize::Type>(current_drawable.texture.height)};
|
||||
@@ -181,7 +181,7 @@ std::shared_ptr<Texture> Playground::CreateTextureForFixture(
|
||||
}
|
||||
|
||||
auto texture_descriptor = TextureDescriptor{};
|
||||
texture_descriptor.format = PixelFormat::kR8G8B8A8_UNormInt;
|
||||
texture_descriptor.format = PixelFormat::kR8G8B8A8UNormInt;
|
||||
texture_descriptor.size = image.GetSize();
|
||||
texture_descriptor.mip_count = 1u;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user