blob: 90c4e62a5498e6a2191dec57910f6f9e094c76e6 (
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
46
47
48
|
/*
* Copyright 2015 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkBitmapProvider.h"
#include "SkImage_Base.h"
#include "SkPixelRef.h"
int SkBitmapProvider::width() const {
return fImage->width();
}
int SkBitmapProvider::height() const {
return fImage->height();
}
uint32_t SkBitmapProvider::getID() const {
return fImage->uniqueID();
}
SkImageInfo SkBitmapProvider::info() const {
return as_IB(fImage)->onImageInfo();
}
bool SkBitmapProvider::isVolatile() const {
// add flag to images?
const SkBitmap* bm = as_IB(fImage)->onPeekBitmap();
return bm ? bm->isVolatile() : false;
}
SkBitmapCacheDesc SkBitmapProvider::makeCacheDesc(int w, int h) const {
return SkBitmapCacheDesc::Make(fImage, w, h);
}
SkBitmapCacheDesc SkBitmapProvider::makeCacheDesc() const {
return SkBitmapCacheDesc::Make(fImage);
}
void SkBitmapProvider::notifyAddedToCache() const {
as_IB(fImage)->notifyAddedToCache();
}
bool SkBitmapProvider::asBitmap(SkBitmap* bm) const {
return as_IB(fImage)->getROPixels(bm, fDstColorSpace, SkImage::kAllow_CachingHint);
}
|