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

#include "Test.h"
#include "SkMipMap.h"
#include "SkBitmap.h"
#include "SkRandom.h"

static void make_bitmap(SkBitmap* bm, SkRandom& rand) {
    // for now, Build needs a min size of 2, otherwise it will return NULL.
    // should fix that to support 1 X N, where N > 1 to return non-null.
    int w = 2 + rand.nextU() % 1000;
    int h = 2 + rand.nextU() % 1000;
    bm->setConfig(SkBitmap::kARGB_8888_Config, w, h);
    bm->allocPixels();
    bm->eraseColor(SK_ColorWHITE);
}

static void TestMipMap(skiatest::Reporter* reporter) {
    SkBitmap bm;
    SkRandom rand;

    for (int i = 0; i < 500; ++i) {
        make_bitmap(&bm, rand);
        SkAutoTUnref<SkMipMap> mm(SkMipMap::Build(bm));
        
        REPORTER_ASSERT(reporter, !mm->extractLevel(SK_Scalar1, NULL));
        REPORTER_ASSERT(reporter, !mm->extractLevel(SK_Scalar1 * 2, NULL));
        
        SkMipMap::Level prevLevel = { 0 };  // make warnings happy
        prevLevel.fPixels = NULL;   // sentinel

        SkScalar scale = SK_Scalar1;<commit_msg>use { 0, 0, 0, 0 } to fix warning<commit_after>/*
 * Copyright 2013 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "Test.h"
#include "SkMipMap.h"
#include "SkBitmap.h"
#include "SkRandom.h"

static void make_bitmap(SkBitmap* bm, SkRandom& rand) {
    // for now, Build needs a min size of 2, otherwise it will return NULL.
    // should fix that to support 1 X N, where N > 1 to return non-null.
    int w = 2 + rand.nextU() % 1000;
    int h = 2 + rand.nextU() % 1000;
    bm->setConfig(SkBitmap::kARGB_8888_Config, w, h);
    bm->allocPixels();
    bm->eraseColor(SK_ColorWHITE);
}

static void TestMipMap(skiatest::Reporter* reporter) {
    SkBitmap bm;
    SkRandom rand;

    for (int i = 0; i < 500; ++i) {
        make_bitmap(&bm, rand);
        SkAutoTUnref<SkMipMap> mm(SkMipMap::Build(bm));
        
        REPORTER_ASSERT(reporter, !mm->extractLevel(SK_Scalar1, NULL));
        REPORTER_ASSERT(reporter, !mm->extractLevel(SK_Scalar1 * 2, NULL));
        
        SkMipMap::Level prevLevel = { 0, 0, 0, 0 };

        SkScalar scale = SK_Scalar1;
{'fraction_non_alphanumeric': 0.12763214439192092, 'fraction_numerical': 0.028792436613665665, 'mean_word_length': 2.9457627118644067, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '471886', 'n_tokens_mistral': 875, 'n_tokens_neox': 811, 'n_words': 241}