Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #ifndef SkMipMap_DEFINED | |
|
tfarina
2013/07/18 21:02:07
copyright
| |
| 2 #define SkMipMap_DEFINED | |
| 3 | |
| 4 #include "SkRefCnt.h" | |
| 5 #include "SkScalar.h" | |
| 6 | |
| 7 class SkBitmap; | |
| 8 | |
| 9 class SkMipMap : public SkRefCnt { | |
| 10 public: | |
| 11 static SkMipMap* Build(const SkBitmap& src); | |
| 12 | |
| 13 struct Level { | |
| 14 void* fPixels; | |
| 15 uint32_t fRowBytes; | |
| 16 uint32_t fWidth, fHeight; | |
| 17 }; | |
| 18 | |
| 19 bool extractLevel(SkScalar scale, Level*) const; | |
| 20 | |
| 21 private: | |
| 22 Level* fLevels; | |
| 23 int fCount; | |
| 24 | |
| 25 // we take ownership of levels, and will free it with sk_free() | |
| 26 SkMipMap(Level* levels, int count) : fLevels(levels), fCount(count) { | |
| 27 SkASSERT(levels); | |
| 28 SkASSERT(count > 0); | |
| 29 } | |
| 30 | |
| 31 virtual ~SkMipMap() { | |
| 32 sk_free(fLevels); | |
| 33 } | |
| 34 | |
| 35 static Level* AllocLevels(int levelCount, size_t pixelSize); | |
| 36 }; | |
| 37 | |
| 38 #endif | |
| OLD | NEW |