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

#include "gm.h"
#include "SkCanvas.h"
#include "SkColorPriv.h"
#include "SkShader.h"

/*
 *  Want to ensure that our bitmap sampler (in bitmap shader) keeps plenty of
 *  precision when scaling very large images (where the dx might get very small.
 */

#define W   2560
#define H   1600

class GiantBitmapGM : public skiagm::GM {
    SkBitmap* fBM;
    SkShader::TileMode fMode;
    
    const SkBitmap& getBitmap() {
        if (NULL == fBM) {
            fBM = new SkBitmap;
            fBM->setConfig(SkBitmap::kARGB_8888_Config, W, H);
            fBM->allocPixels();
            fBM->eraseColor(SK_ColorWHITE);

            const SkColor colors[] = {
                SK_ColorBLUE, SK_ColorRED, SK_ColorBLACK, SK_ColorGREEN
            };

            SkCanvas canvas(*fBM);
            SkPaint paint;
            paint.setAntiAlias(true);
            paint.setStrokeWidth(SkIntToScalar(30));
            for (int y = -H; y < H; y += 80) {
                SkScalar yy = SkIntToScalar(y);
                paint.setColor(colors[y/80 & 0x3]);
                canvas.drawLine(0, yy, SkIntToScalar(W), yy + SkIntToScalar(W),
                                paint);
            }
        }
        return *fBM;
    }

public:
    GiantBitmapGM(SkShader::TileMode mode) : fBM(NULL), fMode(mode) {}

    virtual ~GiantBitmapGM() {
        SkDELETE(fBM);
    }

protected:

    virtual SkString onShortName() {
        SkString str("giantbitmap_");
        switch (fMode) {
            case SkShader::kClamp_TileMode:
                str.append("clamp");
                break;
            case SkShader::kRepeat_TileMode:
                str.append("repeat");<commit_msg>disable PDF for now, until http://code.google.com/p/skia/issues/detail?id=520 is fixed<commit_after>/*
 * Copyright 2011 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "gm.h"
#include "SkCanvas.h"
#include "SkColorPriv.h"
#include "SkShader.h"

/*
 *  Want to ensure that our bitmap sampler (in bitmap shader) keeps plenty of
 *  precision when scaling very large images (where the dx might get very small.
 */

#define W   2560
#define H   1600

class GiantBitmapGM : public skiagm::GM {
    SkBitmap* fBM;
    SkShader::TileMode fMode;
    
    const SkBitmap& getBitmap() {
        if (NULL == fBM) {
            fBM = new SkBitmap;
            fBM->setConfig(SkBitmap::kARGB_8888_Config, W, H);
            fBM->allocPixels();
            fBM->eraseColor(SK_ColorWHITE);

            const SkColor colors[] = {
                SK_ColorBLUE, SK_ColorRED, SK_ColorBLACK, SK_ColorGREEN
            };

            SkCanvas canvas(*fBM);
            SkPaint paint;
            paint.setAntiAlias(true);
            paint.setStrokeWidth(SkIntToScalar(30));
            for (int y = -H; y < H; y += 80) {
                SkScalar yy = SkIntToScalar(y);
                paint.setColor(colors[y/80 & 0x3]);
                canvas.drawLine(0, yy, SkIntToScalar(W), yy + SkIntToScalar(W),
                                paint);
            }
        }
        return *fBM;
    }

public:
    GiantBitmapGM(SkShader::TileMode mode) : fBM(NULL), fMode(mode) {}

    virtual ~GiantBitmapGM() {
        SkDELETE(fBM);
    }

protected:
    // work-around for bug http://code.google.com/p/skia/issues/detail?id=520
    //
    virtual uint32_t onGetFlags() const { return kSkipPDF_Flag; }
    
    virtual SkString onShortName() {
        SkString str("giantbitmap_");
        switch (fMode) {
            case SkShader::kClamp_TileMode:
                str.append("clamp");
                break;
            case SkShader::kRepeat_TileMode:
                str.append("repeat");
{'fraction_non_alphanumeric': 0.10999484801648635, 'fraction_numerical': 0.014940752189592994, 'mean_word_length': 1.9892224788298691, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '3172894', 'n_tokens_mistral': 1258, 'n_tokens_neox': 1205, 'n_words': 302}