YSTest  PreAlpha_b400_20130424
The YSLib Test Project
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
ydesktop.cpp
浏览该文件的文档.
1 /*
2  Copyright by FrankHB 2010 - 2013.
3 
4  This file is part of the YSLib project, and may only be used,
5  modified, and distributed under the terms of the YSLib project
6  license, LICENSE.TXT. By continuing to use, modify, or distribute
7  this file you indicate that you have read the license and
8  understand and accept it fully.
9 */
10 
28 #include "YSLib/UI/ydesktop.h"
29 #include "YSLib/UI/YBrush.h"
30 #include <ystdex/cast.hpp> // for ystdex::polymorphic_downcast;
31 
33 
34 using namespace Drawing;
35 
37 
38 namespace
39 {
40 
42 BufferedRenderer&
43 GetBufferedRendererOf(const IWidget& wgt) ynothrow
44 {
45  return ystdex::polymorphic_downcast<BufferedRenderer&>(wgt.GetRenderer());
46 }
47 
48 } // unnamed namespace;
49 
50 
51 Desktop::Desktop(Devices::Screen& s, Color c, const shared_ptr<Image>& hImg)
52  : Window(Rect(s.GetSize()), hImg),
53  screen(s)
54 {
55  Background = SolidBrush(c),
56  GetBufferedRendererOf(*this).IgnoreBackground = true;
57 }
58 
59 void
60 Desktop::Update()
61 {
62 // if(!GetBufferedRendererOf(*this).RequiresRefresh())
63  screen.Update(GetBufferedRendererOf(*this).GetContext().GetBufferPtr());
64 }
65 
66 Rect
68 {
69  auto& rd(GetBufferedRendererOf(*this));
70 
71  return rd.Validate(*this, *this,
72  {rd.GetContext(), Point(), GetBoundsOf(*this)});
73 }
74 
76 
77 YSL_END
78