michael@0: /* michael@0: * Copyright 2013 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #ifndef SkMipMap_DEFINED michael@0: #define SkMipMap_DEFINED michael@0: michael@0: #include "SkRefCnt.h" michael@0: #include "SkScalar.h" michael@0: michael@0: class SkBitmap; michael@0: michael@0: class SkMipMap : public SkRefCnt { michael@0: public: michael@0: static SkMipMap* Build(const SkBitmap& src); michael@0: michael@0: struct Level { michael@0: void* fPixels; michael@0: uint32_t fRowBytes; michael@0: uint32_t fWidth, fHeight; michael@0: float fScale; // < 1.0 michael@0: }; michael@0: michael@0: bool extractLevel(SkScalar scale, Level*) const; michael@0: michael@0: size_t getSize() const { return fSize; } michael@0: michael@0: private: michael@0: size_t fSize; michael@0: Level* fLevels; michael@0: int fCount; michael@0: michael@0: // we take ownership of levels, and will free it with sk_free() michael@0: SkMipMap(Level* levels, int count, size_t size); michael@0: virtual ~SkMipMap(); michael@0: michael@0: static Level* AllocLevels(int levelCount, size_t pixelSize); michael@0: }; michael@0: michael@0: #endif