/*--------------------------------------------------------------------------
  Project:  Manual 2D Library - m2d
  File:     drawInfo.h

  Copyright (C)2007-2009 Nintendo  All Rights Reserved.

  These coded instructions, statements, and computer programs contain
  proprietary information of Nintendo of America Inc. and/or Nintendo
  Company Ltd., and are protected by Federal copyright law. They may
  not be disclosed to third parties or copied or duplicated in any form,
  in whole or in part, without the prior written consent of Nintendo.

  $Revision: 1.13 $
 *-------------------------------------------------------------------------*/

#ifndef NTMV_M2D_DRAWINFO_H_
#define NTMV_M2D_DRAWINFO_H_

#if defined(__CWCC__)
#pragma once
#endif

#include <ntmv/m2d/Rect.h>
#include <ntmv/m2d/types.h>

struct NNSG2dFont;

namespace ntmv
{
namespace m2d
{

class Page;

class DrawInfo
{
public:
                        DrawInfo();

    const Rect&         GetPageRect() const                     { return mPageRect; }
    void                SetPageRect(const Rect& value)          { mPageRect = value; }

    u16*                GetFrameBuf() const                     { return mFrameBuf; }
    void                SetFrameBuf(u16* value)                 { mFrameBuf = value; }

    const Size&         GetFrameBufSize() const                 { return mFrameBufSize; }
    void                SetFrameBufSize(const Size& value)
    {
        // The width is fixed at 256.
        NNS_ASSERT(value.width == 0x100);

        // The height should be a multiple of 256.
        NNS_ASSERT(value.height != 0 && (value.height & (0x100 - 1)) == 0);

        mFrameBufSize = value;
    }

    const NNSG2dFont*   GetFont(u16 size) const;
    void                SetFont(const NNSG2dFont *const fonts[]){ mFonts = fonts; }

    const Rect&         GetInvalidateRect() const               { return mInvalidateRect; }
    void                SetInvalidateRect(const Rect& value)    { mInvalidateRect = value; }

    Page*               GetPage() const                         { return mpPage; }
    void                SetPage(Page* value)                    { mpPage = value; }

#if defined(NNS_DEBUG)
    bool                IsDebugDrawMode() const                 { return mFlag.debugDrawMode; }
    void                SetDebugDrawMode(bool bEnable)          { mFlag.debugDrawMode = bEnable; }
#endif

protected:
    Rect                mPageRect;
    Rect                mInvalidateRect;
    u16*                mFrameBuf;
    Size                mFrameBufSize;

    const NNSG2dFont *const *
                        mFonts;

    Page*               mpPage;

    struct
    {
#if defined(NNS_DEBUG)
        u8                  debugDrawMode               : 1;
#endif
    }                   mFlag;
};

}   // namespace m2d
}   // namespace ntmv

/* NTMV_M2D_DRAWINFO_H_ */
#endif

