#ifndef CCFontAtlas_h
#define CCFontAtlas_h
#if USE(ACCELERATED_COMPOSITING)
#include "IntRect.h"
#include "SkBitmap.h"
#include <string>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
class SkCanvas;
namespace cc {
class Color;
class FontDescription;
class GraphicsContext;
class IntPoint;
class IntSize;
class CCFontAtlas {
WTF_MAKE_NONCOPYABLE(CCFontAtlas);
public:
static PassOwnPtr<CCFontAtlas> create(SkBitmap bitmap, IntRect asciiToRectTable[128], int fontHeight)
{
return adoptPtr(new CCFontAtlas(bitmap, asciiToRectTable, fontHeight));
}
~CCFontAtlas();
void drawText(SkCanvas*, const SkPaint&, const std::string& text, const IntPoint& destPosition, const IntSize& clip) const;
void drawDebugAtlas(SkCanvas*, const IntPoint& destPosition) const;
private:
CCFontAtlas(SkBitmap, IntRect asciiToRectTable[128], int fontHeight);
void drawOneLineOfTextInternal(SkCanvas*, const SkPaint&, const std::string&, const IntPoint& destPosition) const;
SkBitmap m_atlas;
IntRect m_asciiToRectTable[128];
int m_fontHeight;
};
}
#endif
#endif