Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Side by Side Diff: src/core/SkMaskCache.h

Issue 592843003: Add SkCachedData and use it for SkMipMap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use explicit runtime flag to recognize Discardable, to allow clients to subclass Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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 SkMaskCache_DEFINED
9 #define SkMaskCache_DEFINED
10
11 #include "SkScalar.h"
12 #include "SkMask.h"
13
14 class SkCachedData;
15 class SkDiscardableMemory;
16 struct SkMask;
17 class SkResourceCache;
18 class SkRRect;
19
20 class SkMaskCache {
21 public:
22 static SkCachedData* NewCachedData(size_t size, SkResourceCache* localCache = NULL);
23
24 /**
25 * If a matching mask/pixel-data is found for the specified key, lock the p ixel-data and
26 * return the mask and pixel-data. In the case the caller MUST call unlock( ) on the pixel-data
27 * when they are done using it, after which the pixel-data object will no l onger be valid.
28 *
29 * If NULL is returned, the mask parameter is ignored.
30 */
31 static SkCachedData* FindAndLock(SkScalar sigma, const SkRect&,
32 SkMask* result, SkResourceCache* loca lCache = NULL);
33 static SkCachedData* FindAndLock(SkScalar sigma, const SkRect& r0, const SkR ect& r1,
34 SkMask* result, SkResourceCache* loca lCache = NULL);
35 static SkCachedData* FindAndLock(SkScalar sigma, const SkRRect&,
36 SkMask* result, SkResourceCache* loca lCache = NULL);
37
38 /**
39 * Add a mask and its pixel-data to the cache. The pixel-data MUST be locke d.
40 * Ownership of the pixel-data is transfered to the cache, so the caller mu st not reference
41 * it after this call.
42 */
43 static void Add(SkScalar sigma, const SkRect&,
44 const SkMask& result, SkCachedData* data, SkResourceCache* l ocalCache = NULL);
45 static void Add(SkScalar sigma, const SkRect& r0, const SkRect& r1,
46 const SkMask& result, SkCachedData* data, SkResourceCache* l ocalCache = NULL);
47 static void Add(SkScalar sigma, const SkRRect&,
48 const SkMask& result, SkCachedData* data, SkResourceCache* l ocalCache = NULL);
49 };
50
51 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698