#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/platform/graphics/gpu/webgl_image_conversion.h"
#include <cstring>
#include <limits>
#include <memory>
#include "base/compiler_specific.h"
#include "base/numerics/checked_math.h"
#include "build/build_config.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/platform/graphics/cpu/arm/webgl_image_conversion_neon.h"
#include "third_party/blink/renderer/platform/graphics/cpu/loongarch64/webgl_image_conversion_lsx.h"
#include "third_party/blink/renderer/platform/graphics/cpu/mips/webgl_image_conversion_msa.h"
#include "third_party/blink/renderer/platform/graphics/cpu/x86/webgl_image_conversion_sse.h"
#include "third_party/blink/renderer/platform/graphics/image_observer.h"
#include "third_party/blink/renderer/platform/graphics/skia/skia_utils.h"
#include "third_party/blink/renderer/platform/image-decoders/image_decoder.h"
#include "third_party/skia/include/core/SkColorSpace.h"
#include "third_party/skia/include/core/SkImage.h"
namespace blink {
namespace {
const float kMaxInt8Value = …;
const float kMaxUInt8Value = …;
const float kMaxInt16Value = …;
const float kMaxUInt16Value = …;
const double kMaxInt32Value = …;
const double kMaxUInt32Value = …;
int8_t ClampMin(int8_t value) { … }
int16_t ClampMin(int16_t value) { … }
int32_t ClampMin(int32_t value) { … }
template <class T>
T ClampImpl(const float& v, const T& lo, const T& hi) { … }
template <class T>
T ClampFloat(float value) { … }
template <class T>
T ClampAndScaleFloat(float value) { … }
}
WebGLImageConversion::DataFormat WebGLImageConversion::GetDataFormat(
GLenum format,
GLenum type) { … }
namespace {
const uint16_t g_base_table[512] = …;
const unsigned char g_shift_table[512] = …;
uint16_t ConvertFloatToHalfFloat(float f) { … }
const uint32_t g_mantissa_table[2048] = …;
const uint16_t g_offset_table[64] = …;
const uint32_t g_exponent_table[64] = …;
float ConvertHalfFloatToFloat(uint16_t half) { … }
template <int format, typename SourceType, typename DstType>
void Unpack(const SourceType*, DstType*, unsigned) { … }
template <>
void Unpack<WebGLImageConversion::kDataFormatARGB8, uint8_t, uint8_t>(
const uint8_t* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Unpack<WebGLImageConversion::kDataFormatABGR8, uint8_t, uint8_t>(
const uint8_t* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Unpack<WebGLImageConversion::kDataFormatBGRA8, uint8_t, uint8_t>(
const uint8_t* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Unpack<WebGLImageConversion::kDataFormatRGBA5551, uint16_t, uint8_t>(
const uint16_t* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Unpack<WebGLImageConversion::kDataFormatRGBA4444, uint16_t, uint8_t>(
const uint16_t* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Unpack<WebGLImageConversion::kDataFormatRA8, uint8_t, uint8_t>(
const uint8_t* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Unpack<WebGLImageConversion::kDataFormatAR8, uint8_t, uint8_t>(
const uint8_t* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Unpack<WebGLImageConversion::kDataFormatRGBA8, uint8_t, float>(
const uint8_t* source,
float* destination,
unsigned pixels_per_row) { … }
template <>
void Unpack<WebGLImageConversion::kDataFormatBGRA8, uint8_t, float>(
const uint8_t* source,
float* destination,
unsigned pixels_per_row) { … }
template <>
void Unpack<WebGLImageConversion::kDataFormatABGR8, uint8_t, float>(
const uint8_t* source,
float* destination,
unsigned pixels_per_row) { … }
template <>
void Unpack<WebGLImageConversion::kDataFormatARGB8, uint8_t, float>(
const uint8_t* source,
float* destination,
unsigned pixels_per_row) { … }
template <>
void Unpack<WebGLImageConversion::kDataFormatRA32F, float, float>(
const float* source,
float* destination,
unsigned pixels_per_row) { … }
template <>
void Unpack<WebGLImageConversion::kDataFormatRGBA2_10_10_10, uint32_t, float>(
const uint32_t* source,
float* destination,
unsigned pixels_per_row) { … }
template <>
void Unpack<WebGLImageConversion::kDataFormatRGBA16F, uint16_t, float>(
const uint16_t* source,
float* destination,
unsigned pixels_per_row) { … }
template <>
void Unpack<WebGLImageConversion::kDataFormatRGBA16F, uint16_t, uint8_t>(
const uint16_t* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <int format, int alphaOp, typename SourceType, typename DstType>
void Pack(const SourceType*, DstType*, unsigned) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatA8,
WebGLImageConversion::kAlphaDoNothing,
uint8_t,
uint8_t>(const uint8_t* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatA8,
WebGLImageConversion::kAlphaDoNothing,
float,
uint8_t>(const float* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatR8,
WebGLImageConversion::kAlphaDoNothing,
uint8_t,
uint8_t>(const uint8_t* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatR8,
WebGLImageConversion::kAlphaDoNothing,
float,
uint8_t>(const float* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatR8,
WebGLImageConversion::kAlphaDoPremultiply,
uint8_t,
uint8_t>(const uint8_t* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatR8,
WebGLImageConversion::kAlphaDoPremultiply,
float,
uint8_t>(const float* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatR8,
WebGLImageConversion::kAlphaDoUnmultiply,
uint8_t,
uint8_t>(const uint8_t* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatR8,
WebGLImageConversion::kAlphaDoUnmultiply,
float,
uint8_t>(const float* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRA8,
WebGLImageConversion::kAlphaDoNothing,
uint8_t,
uint8_t>(const uint8_t* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRA8,
WebGLImageConversion::kAlphaDoNothing,
float,
uint8_t>(const float* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRA8,
WebGLImageConversion::kAlphaDoPremultiply,
uint8_t,
uint8_t>(const uint8_t* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRA8,
WebGLImageConversion::kAlphaDoPremultiply,
float,
uint8_t>(const float* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRA8,
WebGLImageConversion::kAlphaDoUnmultiply,
uint8_t,
uint8_t>(const uint8_t* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRA8,
WebGLImageConversion::kAlphaDoUnmultiply,
float,
uint8_t>(const float* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGB8,
WebGLImageConversion::kAlphaDoNothing,
uint8_t,
uint8_t>(const uint8_t* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGB8,
WebGLImageConversion::kAlphaDoNothing,
float,
uint8_t>(const float* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGB8,
WebGLImageConversion::kAlphaDoPremultiply,
uint8_t,
uint8_t>(const uint8_t* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGB8,
WebGLImageConversion::kAlphaDoPremultiply,
float,
uint8_t>(const float* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGB8,
WebGLImageConversion::kAlphaDoUnmultiply,
uint8_t,
uint8_t>(const uint8_t* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGB8,
WebGLImageConversion::kAlphaDoUnmultiply,
float,
uint8_t>(const float* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA8,
WebGLImageConversion::kAlphaDoPremultiply,
uint8_t,
uint8_t>(const uint8_t* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA8,
WebGLImageConversion::kAlphaDoPremultiply,
float,
uint8_t>(const float* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA8,
WebGLImageConversion::kAlphaDoUnmultiply,
uint8_t,
uint8_t>(const uint8_t* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA8,
WebGLImageConversion::kAlphaDoUnmultiply,
float,
uint8_t>(const float* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA4444,
WebGLImageConversion::kAlphaDoNothing,
uint8_t,
uint16_t>(const uint8_t* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA4444,
WebGLImageConversion::kAlphaDoNothing,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA4444,
WebGLImageConversion::kAlphaDoPremultiply,
uint8_t,
uint16_t>(const uint8_t* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA4444,
WebGLImageConversion::kAlphaDoPremultiply,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA4444,
WebGLImageConversion::kAlphaDoUnmultiply,
uint8_t,
uint16_t>(const uint8_t* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA4444,
WebGLImageConversion::kAlphaDoUnmultiply,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA5551,
WebGLImageConversion::kAlphaDoNothing,
uint8_t,
uint16_t>(const uint8_t* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA5551,
WebGLImageConversion::kAlphaDoNothing,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA5551,
WebGLImageConversion::kAlphaDoPremultiply,
uint8_t,
uint16_t>(const uint8_t* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA5551,
WebGLImageConversion::kAlphaDoPremultiply,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA5551,
WebGLImageConversion::kAlphaDoUnmultiply,
uint8_t,
uint16_t>(const uint8_t* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA5551,
WebGLImageConversion::kAlphaDoUnmultiply,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGB565,
WebGLImageConversion::kAlphaDoNothing,
uint8_t,
uint16_t>(const uint8_t* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGB565,
WebGLImageConversion::kAlphaDoNothing,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGB565,
WebGLImageConversion::kAlphaDoPremultiply,
uint8_t,
uint16_t>(const uint8_t* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGB565,
WebGLImageConversion::kAlphaDoPremultiply,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGB565,
WebGLImageConversion::kAlphaDoUnmultiply,
uint8_t,
uint16_t>(const uint8_t* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGB565,
WebGLImageConversion::kAlphaDoUnmultiply,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGB32F,
WebGLImageConversion::kAlphaDoNothing,
float,
float>(const float* source,
float* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGB32F,
WebGLImageConversion::kAlphaDoPremultiply,
float,
float>(const float* source,
float* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGB32F,
WebGLImageConversion::kAlphaDoUnmultiply,
float,
float>(const float* source,
float* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA32F,
WebGLImageConversion::kAlphaDoPremultiply,
float,
float>(const float* source,
float* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA32F,
WebGLImageConversion::kAlphaDoUnmultiply,
float,
float>(const float* source,
float* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatA32F,
WebGLImageConversion::kAlphaDoNothing,
float,
float>(const float* source,
float* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatR32F,
WebGLImageConversion::kAlphaDoNothing,
float,
float>(const float* source,
float* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatR32F,
WebGLImageConversion::kAlphaDoPremultiply,
float,
float>(const float* source,
float* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatR32F,
WebGLImageConversion::kAlphaDoUnmultiply,
float,
float>(const float* source,
float* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRA32F,
WebGLImageConversion::kAlphaDoNothing,
float,
float>(const float* source,
float* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRA32F,
WebGLImageConversion::kAlphaDoPremultiply,
float,
float>(const float* source,
float* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRA32F,
WebGLImageConversion::kAlphaDoUnmultiply,
float,
float>(const float* source,
float* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA16F,
WebGLImageConversion::kAlphaDoNothing,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA16F,
WebGLImageConversion::kAlphaDoPremultiply,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA16F,
WebGLImageConversion::kAlphaDoUnmultiply,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGB16F,
WebGLImageConversion::kAlphaDoNothing,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGB16F,
WebGLImageConversion::kAlphaDoPremultiply,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGB16F,
WebGLImageConversion::kAlphaDoUnmultiply,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRA16F,
WebGLImageConversion::kAlphaDoNothing,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRA16F,
WebGLImageConversion::kAlphaDoPremultiply,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRA16F,
WebGLImageConversion::kAlphaDoUnmultiply,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatR16F,
WebGLImageConversion::kAlphaDoNothing,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatR16F,
WebGLImageConversion::kAlphaDoPremultiply,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatR16F,
WebGLImageConversion::kAlphaDoUnmultiply,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatA16F,
WebGLImageConversion::kAlphaDoNothing,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA8_S,
WebGLImageConversion::kAlphaDoPremultiply,
int8_t,
int8_t>(const int8_t* source,
int8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA16,
WebGLImageConversion::kAlphaDoPremultiply,
uint16_t,
uint16_t>(const uint16_t* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA16,
WebGLImageConversion::kAlphaDoPremultiply,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA16_S,
WebGLImageConversion::kAlphaDoPremultiply,
int16_t,
int16_t>(const int16_t* source,
int16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA32,
WebGLImageConversion::kAlphaDoPremultiply,
uint32_t,
uint32_t>(const uint32_t* source,
uint32_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA32_S,
WebGLImageConversion::kAlphaDoPremultiply,
int32_t,
int32_t>(const int32_t* source,
int32_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA2_10_10_10,
WebGLImageConversion::kAlphaDoNothing,
float,
uint32_t>(const float* source,
uint32_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA2_10_10_10,
WebGLImageConversion::kAlphaDoPremultiply,
float,
uint32_t>(const float* source,
uint32_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRGBA2_10_10_10,
WebGLImageConversion::kAlphaDoUnmultiply,
float,
uint32_t>(const float* source,
uint32_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRG8,
WebGLImageConversion::kAlphaDoNothing,
uint8_t,
uint8_t>(const uint8_t* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRG8,
WebGLImageConversion::kAlphaDoNothing,
float,
uint8_t>(const float* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRG8,
WebGLImageConversion::kAlphaDoPremultiply,
uint8_t,
uint8_t>(const uint8_t* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRG8,
WebGLImageConversion::kAlphaDoPremultiply,
float,
uint8_t>(const float* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRG8,
WebGLImageConversion::kAlphaDoUnmultiply,
uint8_t,
uint8_t>(const uint8_t* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRG8,
WebGLImageConversion::kAlphaDoUnmultiply,
float,
uint8_t>(const float* source,
uint8_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRG16F,
WebGLImageConversion::kAlphaDoNothing,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRG16F,
WebGLImageConversion::kAlphaDoPremultiply,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRG16F,
WebGLImageConversion::kAlphaDoUnmultiply,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRG32F,
WebGLImageConversion::kAlphaDoNothing,
float,
float>(const float* source,
float* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRG32F,
WebGLImageConversion::kAlphaDoPremultiply,
float,
float>(const float* source,
float* destination,
unsigned pixels_per_row) { … }
template <>
void Pack<WebGLImageConversion::kDataFormatRG32F,
WebGLImageConversion::kAlphaDoUnmultiply,
float,
float>(const float* source,
float* destination,
unsigned pixels_per_row) { … }
bool HasAlpha(int format) { … }
bool HasColor(int format) { … }
template <int Format>
struct IsInt8Format { … };
template <int Format>
struct IsInt16Format { … };
template <int Format>
struct IsInt32Format { … };
template <int Format>
struct IsUInt8Format { … };
template <int Format>
struct IsUInt16Format { … };
template <int Format>
struct IsUInt32Format { … };
template <int Format>
struct IsFloatFormat { … };
template <int Format>
struct IsHalfFloatFormat { … };
template <int Format>
struct Is32bppFormat { … };
template <int Format>
struct Is16bppFormat { … };
template <int Format,
bool IsInt8Format = IsInt8Format<Format>::value,
bool IsUInt8Format = IsUInt8Format<Format>::value,
bool IsInt16Format = IsInt16Format<Format>::value,
bool IsUInt16Format = IsUInt16Format<Format>::value,
bool IsInt32Format = IsInt32Format<Format>::value,
bool IsUInt32Format = IsUInt32Format<Format>::value,
bool IsFloat = IsFloatFormat<Format>::value,
bool IsHalfFloat = IsHalfFloatFormat<Format>::value,
bool Is16bpp = Is16bppFormat<Format>::value,
bool Is32bpp = Is32bppFormat<Format>::value>
struct DataTypeForFormat { … };
DataTypeForFormat<Format, true, false, false, false, false, false, false, false, false, false>;
DataTypeForFormat<Format, false, true, false, false, false, false, false, false, false, false>;
DataTypeForFormat<Format, false, false, true, false, false, false, false, false, false, false>;
DataTypeForFormat<Format, false, false, false, true, false, false, false, false, false, false>;
DataTypeForFormat<Format, false, false, false, false, true, false, false, false, false, false>;
DataTypeForFormat<Format, false, false, false, false, false, true, false, false, false, false>;
DataTypeForFormat<Format, false, false, false, false, false, false, true, false, false, false>;
DataTypeForFormat<Format, false, false, false, false, false, false, false, true, false, false>;
DataTypeForFormat<Format, false, false, false, false, false, false, false, false, true, false>;
DataTypeForFormat<Format, false, false, false, false, false, false, false, false, false, true>;
template <int Format>
struct UsesFloatIntermediateFormat { … };
template <int Format>
struct IntermediateFormat { … };
unsigned TexelBytesForFormat(WebGLImageConversion::DataFormat format) { … }
class FormatConverter { … };
void FormatConverter::Convert(WebGLImageConversion::DataFormat src_format,
WebGLImageConversion::DataFormat dst_format,
WebGLImageConversion::AlphaOp alpha_op) { … }
template <WebGLImageConversion::DataFormat SrcFormat>
void FormatConverter::Convert(WebGLImageConversion::DataFormat dst_format,
WebGLImageConversion::AlphaOp alpha_op) { … }
template <WebGLImageConversion::DataFormat SrcFormat,
WebGLImageConversion::DataFormat DstFormat>
void FormatConverter::Convert(WebGLImageConversion::AlphaOp alpha_op) { … }
template <int Format>
struct SupportsConversionFromDomElements { … };
template <WebGLImageConversion::DataFormat SrcFormat,
WebGLImageConversion::DataFormat DstFormat,
WebGLImageConversion::AlphaOp alphaOp>
void FormatConverter::Convert() { … }
}
WebGLImageConversion::PixelStoreParams::PixelStoreParams()
: … { … }
WebGLImageConversion::DataFormat WebGLImageConversion::SkColorTypeToDataFormat(
SkColorType color_type) { … }
SkColorType WebGLImageConversion::DataFormatToSkColorType(
WebGLImageConversion::DataFormat data_format,
SkColorType default_color_type) { … }
bool WebGLImageConversion::ComputeFormatAndTypeParameters(
GLenum format,
GLenum type,
unsigned* components_per_pixel,
unsigned* bytes_per_component) { … }
GLenum WebGLImageConversion::ComputeImageSizeInBytes(
GLenum format,
GLenum type,
GLsizei width,
GLsizei height,
GLsizei depth,
const PixelStoreParams& params,
unsigned* image_size_in_bytes,
unsigned* padding_in_bytes,
unsigned* skip_size_in_bytes) { … }
unsigned WebGLImageConversion::GetChannelBitsByFormat(GLenum format) { … }
bool WebGLImageConversion::PackSkPixmap(
const SkPixmap* pixmap,
GLenum format,
GLenum type,
bool flip_y,
AlphaOp alpha_op,
const gfx::Rect& source_image_sub_rectangle,
int depth,
unsigned source_unpack_alignment,
int unpack_image_height,
Vector<uint8_t>& data) { … }
bool WebGLImageConversion::ExtractTextureData(
unsigned width,
unsigned height,
GLenum format,
GLenum type,
const PixelStoreParams& unpack_params,
bool flip_y,
bool premultiply_alpha,
const void* pixels,
Vector<uint8_t>& data) { … }
bool WebGLImageConversion::PackPixels(
const void* source_data,
DataFormat source_data_format,
unsigned source_data_width,
unsigned source_data_height,
const gfx::Rect& source_data_sub_rectangle,
int depth,
unsigned source_unpack_alignment,
int unpack_image_height,
unsigned destination_format,
unsigned destination_type,
AlphaOp alpha_op,
void* destination_data,
bool flip_y) { … }
void WebGLImageConversion::UnpackPixels(const uint16_t* source_data,
DataFormat source_data_format,
unsigned pixels_per_row,
uint8_t* destination_data) { … }
void WebGLImageConversion::PackPixels(const uint8_t* source_data,
DataFormat source_data_format,
unsigned pixels_per_row,
uint8_t* destination_data) { … }
}