chromium/third_party/skia/src/core/SkCompressedDataUtils.cpp

/*
 * Copyright 2020 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "src/core/SkCompressedDataUtils.h"

#include "include/core/SkBitmap.h"
#include "include/core/SkColor.h"
#include "include/core/SkColorPriv.h"
#include "include/core/SkData.h"
#include "include/core/SkScalar.h"
#include "include/core/SkSize.h"
#include "include/private/SkColorData.h"
#include "include/private/base/SkTPin.h"
#include "include/private/base/SkTo.h"
#include "src/base/SkMathPriv.h"
#include "src/core/SkMipmap.h"

#include <algorithm>
#include <cstdint>

usingnamespaceskia_private;

struct ETC1Block {};

constexpr uint32_t kFlipBit =; // set -> T/B sub-blocks; not-set -> L/R sub-blocks
constexpr uint32_t kDiffBit =; // set -> differential; not-set -> individual

static inline int extend_4To8bits(int b) {}

static inline int extend_5To8bits(int b) {}

static inline int extend_5plus3To8Bits(int base, int diff) {}

static const int kNumETC1ModifierTables =;
static const int kNumETC1PixelIndices =;

// The index of each row in this table is the ETC1 table codeword
// The index of each column in this table is the ETC1 pixel index value
static const int kETC1ModifierTables[kNumETC1ModifierTables][kNumETC1PixelIndices] =;

static int num_4x4_blocks(int size) {}

// Return which sub-block a given x,y location in the overall 4x4 block belongs to
static int xy_to_subblock_index(int x, int y, bool flip) {}

struct IColor {};

static SkPMColor add_delta_and_clamp(const IColor& col, int delta) {}

static bool decompress_etc1(SkISize dimensions, const uint8_t* srcData, SkBitmap* dst) {}

//------------------------------------------------------------------------------------------------
struct BC1Block {};

static SkPMColor from565(uint16_t rgb565) {}

// return t*col0 + (1-t)*col1
static SkPMColor lerp(float t, SkPMColor col0, SkPMColor col1) {}

static bool decompress_bc1(SkISize dimensions, const uint8_t* srcData,
                           bool isOpaque, SkBitmap* dst) {}

bool SkDecompress(sk_sp<SkData> data,
                  SkISize dimensions,
                  SkTextureCompressionType compressionType,
                  SkBitmap* dst) {}

size_t SkCompressedDataSize(SkTextureCompressionType type, SkISize dimensions,
                            TArray<size_t>* individualMipOffsets, bool mipmapped) {}

size_t SkCompressedBlockSize(SkTextureCompressionType type) {}

size_t SkCompressedFormatDataSize(SkTextureCompressionType compressionType,
                                  SkISize dimensions, bool mipmapped) {}