aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkBitmapCache.h
blob: ebade0ebd9b67fa277d6e9b2407cd2e691f20676 (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 2014 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkBitmapCache_DEFINED
#define SkBitmapCache_DEFINED

#include "SkScaledImageCache.h"

class SkBitmapCache {
public:
    typedef SkScaledImageCache::ID ID;

    static void Unlock(ID* id) {
        SkScaledImageCache::Unlock(id);
    }

    /* Input: bitmap+inverse_scale */
    static ID* FindAndLock(const SkBitmap& src, SkScalar invScaleX, SkScalar invScaleY,
                           SkBitmap* result);
    static ID* AddAndLock(const SkBitmap& src, SkScalar invScaleX, SkScalar invScaleY,
                          const SkBitmap& result);

    /* Input: bitmap_genID+width+height */
    static ID* FindAndLock(uint32_t genID, int width, int height, SkBitmap* result);

    static ID* AddAndLock(uint32_t genID, int width, int height, const SkBitmap& result);
};

class SkMipMapCache {
public:
    typedef SkScaledImageCache::ID ID;

    static void Unlock(ID* id) {
        SkScaledImageCache::Unlock(id);
    }

    static ID* FindAndLock(const SkBitmap& src, const SkMipMap** result);
    static ID* AddAndLock(const SkBitmap& src, const SkMipMap* result);
};

#endif