39 for (
int i = 0; i < 500; ++i) {
56 sk_bzero(&prevLevel,
sizeof(prevLevel));
59 for (
int j = 0; j < 30; ++j) {
90 const int mipLevelCount = mm->countLevels();
93 for (
int i = 0; i < mipLevelCount; ++i) {
103 int twoToTheMipLevel = 1 << (i + 1);
104 int currentWidth =
width / twoToTheMipLevel;
105 int currentHeight =
height / twoToTheMipLevel;
177 for (
auto& currentTest :
tests) {
223 for (
auto& currentTest :
tests) {
225 currentTest.fBaseHeight,
239 int count = builder->countLevels();
240 for (
int i = 0; i <
count; ++i) {
253 auto img1 = img->withDefaultMipmaps();
260 auto img2 = builder.attachTo(img);
272 auto img2 = builder.attachTo(img);
281 check_fails(img, img->imageInfo().makeWH(img->width() + 2, img->height() - 3));
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static sk_sp< SkImage > make_bitmap()
static void test_mipmap_generation(int width, int height, int expectedMipLevelCount, skiatest::Reporter *reporter)
static void fill_in_mips(SkMipmapBuilder *builder, sk_sp< SkImage > img)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
constexpr SkColor SK_ColorWHITE
static void sk_bzero(void *buffer, size_t size)
#define DEF_TEST(name, reporter)
#define REPORTER_ASSERT(r, cond,...)
void allocPixels(const SkImageInfo &info, size_t rowBytes)
void allocN32Pixels(int width, int height, bool isOpaque=false)
void eraseColor(SkColor4f) const
sk_sp< SkImage > makeRasterImage(GrDirectContext *, CachingHint cachingHint=kDisallow_CachingHint) const
static SkMipmap * Build(const SkPixmap &src, SkDiscardableFactoryProc, bool computeContents=true)
static SkISize ComputeLevelSize(int baseWidth, int baseHeight, int level)
static int ComputeLevelCount(int baseWidth, int baseHeight)
const void * addr() const
SK_API sk_sp< SkSurface > WrapPixels(const SkImageInfo &imageInfo, void *pixels, size_t rowBytes, const SkSurfaceProps *surfaceProps=nullptr)
SkISize fExpectedMipMapLevelSize
static constexpr SkISize Make(int32_t w, int32_t h)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static SkRect MakeIWH(int w, int h)
static constexpr SkSize Make(SkScalar w, SkScalar h)