blob: f8753cdc1b77cb1e59d5145bba1c4018ea579e29 (
plain)
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
44
45
|
/*
* 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;
};
bool extractLevel(SkScalar scale, Level*) const;
private:
Level* fLevels;
int fCount;
// we take ownership of levels, and will free it with sk_free()
SkMipMap(Level* levels, int count) : fLevels(levels), fCount(count) {
SkASSERT(levels);
SkASSERT(count > 0);
}
virtual ~SkMipMap() {
sk_free(fLevels);
}
static Level* AllocLevels(int levelCount, size_t pixelSize);
};
#endif
|