YSTest  PreAlpha_b400_20130424
The YSLib Test Project
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
DSScreen.cpp
浏览该文件的文档.
1 /*
2  Copyright by FrankHB 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 "DSScreen.h"
29 #include "Host.h"
30 #ifdef YCL_DS
31 # include "YSLib/Service/yblit.h" // for Drawing::FillPixel;
32 #endif
33 
35 
36 using namespace Drawing;
37 
38 YSL_BEGIN_NAMESPACE(Devices)
39 
40 #if YCL_DS
41 DSScreen::DSScreen(bool b) ynothrow
42  : Devices::Screen(MainScreenWidth, MainScreenHeight)
43 {
44  pBuffer = (b ? DS::InitScrDown : DS::InitScrUp)(bg);
45 }
46 
47 void
48 DSScreen::Update(BitmapPtr buf) ynothrow
49 {
50  DS::ScreenSynchronize(GetCheckedBufferPtr(), buf);
51 }
52 void
53 DSScreen::Update(Color c)
54 {
55  FillPixel<PixelType>(GetCheckedBufferPtr(), GetAreaOf(GetSize()), c);
56 }
57 #elif YCL_MINGW32
58 DSScreen::DSScreen(bool b) ynothrow
59  : Devices::Screen(MainScreenWidth, MainScreenHeight),
60  Offset(), WindowHandle(),
62 {
63  pBuffer = rbuf.GetBufferPtr();
64  if(b)
65  Offset.Y = MainScreenHeight;
66 }
67 
68 void
69 DSScreen::Update(Drawing::BitmapPtr buf) ynothrow
70 {
71  YAssert(bool(WindowHandle), "Null handle found.");
72 
73  rbuf.UpdateFrom(buf);
74  rbuf.UpdateTo(WindowHandle, Offset);
75 }
76 #else
77 # error Unsupported platform found!
78 #endif
79 
80 YSL_END_NAMESPACE(Devices)
81 
82 YSL_END
83