SkBitmapCache.h revision 04617139f7f715bdc05a32a58e65e3c208bccff4
1/* 2 * Copyright 2014 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8#ifndef SkBitmapCache_DEFINED 9#define SkBitmapCache_DEFINED 10 11#include "SkScaledImageCache.h" 12 13class SkBitmapCache { 14public: 15 typedef SkScaledImageCache::ID ID; 16 17 static void Unlock(ID* id) { 18 SkScaledImageCache::Unlock(id); 19 } 20 21 /* Input: bitmap+inverse_scale */ 22 static ID* FindAndLock(const SkBitmap& src, SkScalar invScaleX, SkScalar invScaleY, 23 SkBitmap* result); 24 static ID* AddAndLock(const SkBitmap& src, SkScalar invScaleX, SkScalar invScaleY, 25 const SkBitmap& result); 26 27 /* Input: bitmap_genID+width+height */ 28 static ID* FindAndLock(uint32_t genID, int width, int height, SkBitmap* result); 29 30 static ID* AddAndLock(uint32_t genID, int width, int height, const SkBitmap& result); 31}; 32 33class SkMipMapCache { 34public: 35 typedef SkScaledImageCache::ID ID; 36 37 static void Unlock(ID* id) { 38 SkScaledImageCache::Unlock(id); 39 } 40 41 static ID* FindAndLock(const SkBitmap& src, const SkMipMap** result); 42 static ID* AddAndLock(const SkBitmap& src, const SkMipMap* result); 43}; 44 45#endif 46