From a6a3df7d64dc81082619ab103450fc6d0af7c644 Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Fri, 23 Mar 2018 16:32:22 -0400 Subject: [PATCH] Move GrPixelConfig to GrTypesPriv BUG= skia:6718 Change-Id: I254a5d289c1216e580b8f7fe613236c090d0e901 Reviewed-on: https://skia-review.googlesource.com/116196 Commit-Queue: Brian Salomon Reviewed-by: Greg Daniel --- include/gpu/GrTypes.h | 45 ---------------------------------- include/private/GrTypesPriv.h | 46 +++++++++++++++++++++++++++++++++++ src/core/SkSpecialSurface.h | 2 +- src/gpu/gl/GrGLUtil.h | 1 + src/gpu/mtl/GrMtlUtil.h | 5 ++-- src/image/SkSurface_Gpu.h | 1 + 6 files changed, 52 insertions(+), 48 deletions(-) diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h index 7cb4abbab5..e21bb2c13a 100644 --- a/include/gpu/GrTypes.h +++ b/include/gpu/GrTypes.h @@ -215,51 +215,6 @@ enum class GrMipMapped : bool { /////////////////////////////////////////////////////////////////////////////// -/** - * Pixel configurations. This type conflates texture formats, CPU pixel formats, and - * premultipliedness. We are moving away from it towards SkColorType and backend API (GL, Vulkan) - * texture formats in the pulbic API. Right now this mostly refers to texture formats as we're - * migrating. - */ -enum GrPixelConfig { - kUnknown_GrPixelConfig, - kAlpha_8_GrPixelConfig, - kGray_8_GrPixelConfig, - kRGB_565_GrPixelConfig, - kRGBA_4444_GrPixelConfig, - kRGBA_8888_GrPixelConfig, - kRGB_888_GrPixelConfig, - kBGRA_8888_GrPixelConfig, - kSRGBA_8888_GrPixelConfig, - kSBGRA_8888_GrPixelConfig, - kRGBA_1010102_GrPixelConfig, - kRGBA_float_GrPixelConfig, - kRG_float_GrPixelConfig, - kAlpha_half_GrPixelConfig, - kRGBA_half_GrPixelConfig, - - /** For internal usage. */ - kPrivateConfig1_GrPixelConfig, - kPrivateConfig2_GrPixelConfig, - kPrivateConfig3_GrPixelConfig, - kPrivateConfig4_GrPixelConfig, - kPrivateConfig5_GrPixelConfig, - - kLast_GrPixelConfig = kPrivateConfig5_GrPixelConfig -}; -static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1; - -// Aliases for pixel configs that match skia's byte order. -#ifndef SK_CPU_LENDIAN - #error "Skia gpu currently assumes little endian" -#endif -#if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) - static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfig; -#elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A) - static const GrPixelConfig kSkia8888_GrPixelConfig = kRGBA_8888_GrPixelConfig; -#else - #error "SK_*32_SHIFT values must correspond to GL_BGRA or GL_RGBA format." -#endif /** * Opaque type for 3D API object handles. We are moving away from this type and towards type-safe diff --git a/include/private/GrTypesPriv.h b/include/private/GrTypesPriv.h index 0c43b783e0..8cabb94f35 100644 --- a/include/private/GrTypesPriv.h +++ b/include/private/GrTypesPriv.h @@ -27,6 +27,52 @@ using GrStdSteadyClock = std::chrono::monotonic_clock; using GrStdSteadyClock = std::chrono::steady_clock; #endif +/** + * Pixel configurations. This type conflates texture formats, CPU pixel formats, and + * premultipliedness. We are moving away from it towards SkColorType and backend API (GL, Vulkan) + * texture formats in the pulbic API. Right now this mostly refers to texture formats as we're + * migrating. + */ +enum GrPixelConfig { + kUnknown_GrPixelConfig, + kAlpha_8_GrPixelConfig, + kGray_8_GrPixelConfig, + kRGB_565_GrPixelConfig, + kRGBA_4444_GrPixelConfig, + kRGBA_8888_GrPixelConfig, + kRGB_888_GrPixelConfig, + kBGRA_8888_GrPixelConfig, + kSRGBA_8888_GrPixelConfig, + kSBGRA_8888_GrPixelConfig, + kRGBA_1010102_GrPixelConfig, + kRGBA_float_GrPixelConfig, + kRG_float_GrPixelConfig, + kAlpha_half_GrPixelConfig, + kRGBA_half_GrPixelConfig, + + /** For internal usage. */ + kPrivateConfig1_GrPixelConfig, + kPrivateConfig2_GrPixelConfig, + kPrivateConfig3_GrPixelConfig, + kPrivateConfig4_GrPixelConfig, + kPrivateConfig5_GrPixelConfig, + + kLast_GrPixelConfig = kPrivateConfig5_GrPixelConfig +}; +static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1; + +// Aliases for pixel configs that match skia's byte order. +#ifndef SK_CPU_LENDIAN +#error "Skia gpu currently assumes little endian" +#endif +#if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) +static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfig; +#elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A) +static const GrPixelConfig kSkia8888_GrPixelConfig = kRGBA_8888_GrPixelConfig; +#else + #error "SK_*32_SHIFT values must correspond to GL_BGRA or GL_RGBA format." +#endif + /** * Geometric primitives used for drawing. */ diff --git a/src/core/SkSpecialSurface.h b/src/core/SkSpecialSurface.h index 96b74a4dac..2c138a3e79 100644 --- a/src/core/SkSpecialSurface.h +++ b/src/core/SkSpecialSurface.h @@ -13,7 +13,7 @@ #include "SkSurfaceProps.h" #if SK_SUPPORT_GPU -#include "GrTypes.h" +#include "GrTypesPriv.h" #endif class GrContext; diff --git a/src/gpu/gl/GrGLUtil.h b/src/gpu/gl/GrGLUtil.h index 416538a749..8062a0dbce 100644 --- a/src/gpu/gl/GrGLUtil.h +++ b/src/gpu/gl/GrGLUtil.h @@ -11,6 +11,7 @@ #include "gl/GrGLInterface.h" #include "GrGLDefines.h" #include "GrStencilSettings.h" +#include "GrTypesPriv.h" class SkMatrix; diff --git a/src/gpu/mtl/GrMtlUtil.h b/src/gpu/mtl/GrMtlUtil.h index a84a636511..1900c3933d 100644 --- a/src/gpu/mtl/GrMtlUtil.h +++ b/src/gpu/mtl/GrMtlUtil.h @@ -8,10 +8,11 @@ #ifndef GrMtlUtil_DEFINED #define GrMtlUtil_DEFINED -#include "GrTypes.h" - #import +#include "GrTypesPriv.h" + + /** * Returns the Metal texture format for the given GrPixelConfig */ diff --git a/src/image/SkSurface_Gpu.h b/src/image/SkSurface_Gpu.h index 9699b01e05..3edb0ca32f 100644 --- a/src/image/SkSurface_Gpu.h +++ b/src/image/SkSurface_Gpu.h @@ -8,6 +8,7 @@ #ifndef SkSurface_Gpu_DEFINED #define SkSurface_Gpu_DEFINED +#include "GrTypesPriv.h" #include "SkSurface_Base.h" #if SK_SUPPORT_GPU