DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Implementation

Mercurial (d8847129d134)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
/*
 * Copyright 2013 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkMipMap_DEFINED
#define SkMipMap_DEFINED

#include "SkRefCnt.h"
#include "SkScalar.h"

class SkBitmap;

class SkMipMap : public SkRefCnt {
public:
    static SkMipMap* Build(const SkBitmap& src);

    struct Level {
        void*       fPixels;
        uint32_t    fRowBytes;
        uint32_t    fWidth, fHeight;
        float       fScale; // < 1.0
    };

    bool extractLevel(SkScalar scale, Level*) const;

    size_t getSize() const { return fSize; }

private:
    size_t  fSize;
    Level*  fLevels;
    int     fCount;

    // we take ownership of levels, and will free it with sk_free()
    SkMipMap(Level* levels, int count, size_t size);
    virtual ~SkMipMap();

    static Level* AllocLevels(int levelCount, size_t pixelSize);
};

#endif