YSTest  PreAlpha_b380_20130211
The YSLib Test Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
YSLib::Components::BufferedRenderer Class Reference

带缓冲的部件渲染器。 More...

#include <yrender.h>

Inheritance diagram for YSLib::Components::BufferedRenderer:
Collaboration diagram for YSLib::Components::BufferedRenderer:

Public Member Functions

 BufferedRenderer (bool b=false)
 构造:指定是否忽略上层缓冲区背景。
 
 BufferedRenderer (const BufferedRenderer &)=default
 
 BufferedRenderer (BufferedRenderer &&)=default
 
virtual BufferedRendererClone () const
 
bool RequiresRefresh () const
 判断是否需要刷新。
 
const RectGetInvalidatedArea () const ynothrow
 取无效区域。
 
const GraphicsGetContext () const ynothrow
 取图形接口上下文。
 
void SetSize (const Size &) override
 设置缓冲区大小。
 
Rect CommitInvalidation (const Rect &) override
 提交无效区域,使之合并至现有无效区域中。
 
Rect Paint (IWidget &wgt, PaintEventArgs &&) override
 按参数绘制。
 
void UpdateTo (const PaintContext &) const
 更新至指定图形设备上下文的指定点。
 
Rect Validate (IWidget &wgt, IWidget &sender, const PaintContext &)
 验证并按需绘制。
 
- Public Member Functions inherited from YSLib::Components::Renderer
 Renderer ()=default
 
 Renderer (const Renderer &)=default
 
 Renderer (Renderer &&)=default
 
virtual ~Renderer ()
 

Public Attributes

Drawing::BitmapBuffer Buffer
 显示缓冲区。
 
bool IgnoreBackground
 指定验证时忽略上层缓冲区背景。
 

Protected Attributes

Rect rInvalidated
 无效区域:包含所有新绘制请求的区域(不一定是最小的)。
 

Detailed Description

带缓冲的部件渲染器。

Since
build 237

缓冲渲染策略:保存部件渲染状态和有效的图形接口上下文。

Definition at line 89 of file yrender.h.

Constructor & Destructor Documentation

YSLib::Components::BufferedRenderer::BufferedRenderer ( bool  b = false)
inline

构造:指定是否忽略上层缓冲区背景。

Since
build 278

Definition at line 107 of file yrender.h.

YSLib::Components::BufferedRenderer::BufferedRenderer ( const BufferedRenderer )
default
YSLib::Components::BufferedRenderer::BufferedRenderer ( BufferedRenderer &&  )
default

Member Function Documentation

virtual BufferedRenderer* YSLib::Components::BufferedRenderer::Clone ( ) const
inlinevirtual

Reimplemented from YSLib::Components::Renderer.

Definition at line 112 of file yrender.h.

Rect BufferedRenderer::CommitInvalidation ( const Rect r)
overridevirtual

提交无效区域,使之合并至现有无效区域中。

Returns
新的无效区域。
Note
由于无效区域的形状限制,可能会存在部分有效区域被合并。

Reimplemented from YSLib::Components::Renderer.

Definition at line 60 of file yrender.cpp.

const Graphics& YSLib::Components::BufferedRenderer::GetContext ( ) const
inline

取图形接口上下文。

Returns
缓冲区图形接口上下文。

Definition at line 129 of file yrender.h.

const Rect& YSLib::Components::BufferedRenderer::GetInvalidatedArea ( ) const
inline

取无效区域。

Definition at line 124 of file yrender.h.

Rect BufferedRenderer::Paint ( IWidget wgt,
PaintEventArgs &&  e 
)
overridevirtual

按参数绘制。

Precondition
断言: &e.GetSender().GetRenderer() == this
Note
在 Validate 后 Update 。
不调用 wgt.IsVisible() 检查可见性。
Since
build 263

Reimplemented from YSLib::Components::Renderer.

Definition at line 66 of file yrender.cpp.

References Validate(), and YAssert.

Here is the call graph for this function:

bool BufferedRenderer::RequiresRefresh ( ) const

判断是否需要刷新。

Note
若无效区域长宽都不为零,则需要刷新。

Definition at line 47 of file yrender.cpp.

void BufferedRenderer::SetSize ( const Size s)
overridevirtual

设置缓冲区大小。

Reimplemented from YSLib::Components::Renderer.

Definition at line 53 of file yrender.cpp.

References YSLib::Drawing::Size::Height, and YSLib::Drawing::Size::Width.

void BufferedRenderer::UpdateTo ( const PaintContext pc) const

更新至指定图形设备上下文的指定点。

Note
复制显示缓冲区内容。

Definition at line 77 of file yrender.cpp.

References YSLib::Drawing::PaintContext::ClipArea, YSLib::Drawing::CopyTo(), YSLib::Drawing::Rect::GetPoint(), YSLib::Drawing::Rect::GetSize(), YSLib::Drawing::PaintContext::Location, and YSLib::Drawing::PaintContext::Target.

Here is the call graph for this function:

Rect BufferedRenderer::Validate ( IWidget wgt,
IWidget sender,
const PaintContext pc 
)

验证并按需绘制。

Returns
验证中被刷新的区域边界。
Since
build 293

验证 sender 的指定图形设备上下文的关联的缓冲区, 若存在无效区域则调用 wgt 的 Paint 事件绘制。

Definition at line 87 of file yrender.cpp.

References YSLib::Drawing::PaintContext::ClipArea, YSLib::Drawing::CopyTo(), YSLib::Components::FetchContainerPtr(), YSLib::Components::GetLocationOf(), YSLib::Drawing::Rect::GetPoint(), YSLib::Drawing::Rect::GetSize(), YSLib::Drawing::Graphics::GetSize(), YSLib::Components::Invalidate(), YSLib::Drawing::PaintContext::Location, and YSLib::Drawing::PaintContext::Target.

Here is the call graph for this function:

Member Data Documentation

Drawing::BitmapBuffer YSLib::Components::BufferedRenderer::Buffer

显示缓冲区。

Definition at line 96 of file yrender.h.

bool YSLib::Components::BufferedRenderer::IgnoreBackground

指定验证时忽略上层缓冲区背景。

Since
build 278

Definition at line 101 of file yrender.h.

Rect YSLib::Components::BufferedRenderer::rInvalidated
mutableprotected

无效区域:包含所有新绘制请求的区域(不一定是最小的)。

Definition at line 93 of file yrender.h.


The documentation for this class was generated from the following files: