blob: cb061283065f72c5277772083d719ffcebc079a7 [file] [log] [blame]
reed@android.com8a1c16f2008-12-17 15:59:43 +00001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef SkGraphics_DEFINED
18#define SkGraphics_DEFINED
19
20#include "SkTypes.h"
21
22class SkGraphics {
23public:
24 static void Init(bool runUnitTests);
25 static void Term();
26
27 /** Return the (approximate) number of bytes used by the font cache.
28 */
29 static size_t GetFontCacheUsed();
30
31 /** Attempt to purge the font cache until <= the specified amount remains
32 in the cache. Specifying 0 will attempt to purge the entire cache.
33 Returns true if some amount was purged from the font cache.
34 */
35 static bool SetFontCacheUsed(size_t usageInBytes);
36
37private:
38 /** This is automatically called by SkGraphics::Init(), and must be
39 implemented by the host OS. This allows the host OS to register a callback
40 with the C++ runtime to call SkGraphics::FreeCaches()
41 */
42 static void InstallNewHandler();
43};
44
45#endif
46