2011-07-28 14:26:00 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
/*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Copyright 2006 The Android Open Source Project
|
2008-12-17 15:59:43 +00:00
|
|
|
*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
2008-12-17 15:59:43 +00:00
|
|
|
*/
|
|
|
|
|
2011-07-28 14:26:00 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
#ifndef SkGraphics_DEFINED
|
|
|
|
#define SkGraphics_DEFINED
|
|
|
|
|
|
|
|
#include "SkTypes.h"
|
|
|
|
|
|
|
|
class SkGraphics {
|
|
|
|
public:
|
2009-03-07 03:39:23 +00:00
|
|
|
static void Init();
|
2008-12-17 15:59:43 +00:00
|
|
|
static void Term();
|
|
|
|
|
2011-11-08 13:48:32 +00:00
|
|
|
/**
|
|
|
|
* Return the version numbers for the library. If the parameter is not
|
|
|
|
* null, it is set to the version number.
|
|
|
|
*/
|
|
|
|
static void GetVersion(int32_t* major, int32_t* minor, int32_t* patch);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the max number of bytes that should be used by the font cache.
|
|
|
|
* If the cache needs to allocate more, it will purge previous entries.
|
|
|
|
* This max can be changed by calling SetFontCacheLimit().
|
2010-04-13 13:22:54 +00:00
|
|
|
*/
|
2011-11-08 13:48:32 +00:00
|
|
|
static size_t GetFontCacheLimit();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Specify the max number of bytes that should be used by the font cache.
|
|
|
|
* If the cache needs to allocate more, it will purge previous entries.
|
|
|
|
*
|
|
|
|
* This function returns the previous setting, as if GetFontCacheLimit()
|
|
|
|
* had be called before the new limit was set.
|
|
|
|
*/
|
|
|
|
static size_t SetFontCacheLimit(size_t bytes);
|
2010-04-13 13:22:54 +00:00
|
|
|
|
2011-11-08 20:03:48 +00:00
|
|
|
/**
|
|
|
|
* For debugging purposes, this will attempt to purge the font cache. It
|
|
|
|
* does not change the limit, but will cause subsequent font measures and
|
|
|
|
* draws to be recreated, since they will no longer be in the cache.
|
|
|
|
*/
|
|
|
|
static void PurgeFontCache();
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
private:
|
|
|
|
/** This is automatically called by SkGraphics::Init(), and must be
|
|
|
|
implemented by the host OS. This allows the host OS to register a callback
|
|
|
|
with the C++ runtime to call SkGraphics::FreeCaches()
|
|
|
|
*/
|
|
|
|
static void InstallNewHandler();
|
|
|
|
};
|
|
|
|
|
2009-06-21 00:49:18 +00:00
|
|
|
class SkAutoGraphics {
|
|
|
|
public:
|
|
|
|
SkAutoGraphics() {
|
|
|
|
SkGraphics::Init();
|
|
|
|
}
|
|
|
|
~SkAutoGraphics() {
|
|
|
|
SkGraphics::Term();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
#endif
|
|
|
|
|