forked from google/skia
-
Notifications
You must be signed in to change notification settings - Fork 54
/
BitmapRegionDecoder.h
50 lines (38 loc) · 1.46 KB
/
BitmapRegionDecoder.h
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
46
47
48
49
50
/*
* Copyright 2015 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef BitmapRegionDecoder_DEFINED
#define BitmapRegionDecoder_DEFINED
#include "client_utils/android/BRDAllocator.h"
#include "include/codec/SkAndroidCodec.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkData.h"
namespace android {
namespace skia {
class BitmapRegionDecoder final {
public:
static std::unique_ptr<BitmapRegionDecoder> Make(sk_sp<SkData> data);
bool decodeRegion(SkBitmap* bitmap, BRDAllocator* allocator,
const SkIRect& desiredSubset, int sampleSize,
SkColorType colorType, bool requireUnpremul,
sk_sp<SkColorSpace> prefColorSpace);
SkEncodedImageFormat getEncodedFormat() { return fCodec->getEncodedFormat(); }
SkColorType computeOutputColorType(SkColorType requestedColorType) {
return fCodec->computeOutputColorType(requestedColorType);
}
sk_sp<SkColorSpace> computeOutputColorSpace(SkColorType outputColorType,
sk_sp<SkColorSpace> prefColorSpace = nullptr) {
return fCodec->computeOutputColorSpace(outputColorType, prefColorSpace);
}
int width() const;
int height() const;
private:
BitmapRegionDecoder(std::unique_ptr<SkAndroidCodec> codec);
std::unique_ptr<SkAndroidCodec> fCodec;
};
} // namespace skia
} // namespace android
#endif // BitmapRegionDecoder_DEFINED