YSTest: DSScreen.cpp 源文件

YSTest PreAlpha_b800_20170810 The YSLib Test Project

- 首页
- 相关页面
- 模块
- 命名空间
- 类
- 文件

- 文件列表
- 文件成员

DSScreen.cpp
浏览该文件的文档.
1 /*
2 © 2013-2015 FrankHB.
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
29 #include "DSScreen.h"
30 #include YFM_DS_YCLib_DSVideo
31
32 namespace YSLib
33 {
34
35 using namespace Drawing;
36
37 namespace Devices
38 {
39
40 #if YCL_DS
41 DSScreen::DSScreen(bool b) ynothrow
42 : Screen({MainScreenWidth, MainScreenHeight})
43 {
44 pBuffer = (b ? DS::InitScrDown : DS::InitScrUp)(bg);
45 }
46
47 void
48 DSScreen::Update(ConstBitmapPtr p_buf) ynothrow
49 {
50 DS::ScreenSynchronize(GetCheckedBufferPtr(), p_buf);
51 }
52 #elif YCL_HostedUI
53 DSScreen::DSScreen(bool b) ynothrow
54 : Screen({MainScreenWidth, MainScreenHeight}),
55 Offset(), WindowHandle(),
56 rbuf({MainScreenWidth, MainScreenHeight})
57 {
58 // TODO: Explicitly specify thread safety.
59 pBuffer = Deref(rbuf.Lock()).GetBufferPtr();
60 if(b)
61 Offset.Y = MainScreenHeight;
62 }
63
64 void
65 DSScreen::Update(ConstBitmapPtr p) ynothrow
66 {
67 const auto p_buf(rbuf.Lock());
68 auto& buf(Deref(p_buf));
69
70 buf.UpdateFrom(p);
71 buf.UpdateTo(Nonnull(WindowHandle), Offset);
72 }
73 #else
74 # error "Unsupported platform found."
75 #endif
76
77 } // namespace Devices;
78
79 } // namespace YSLib;
80
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:45
platform::Deref
yconstfn auto Deref(_type &&p) -> decltype(*p)
断言并解引用非空指针。
Definition: Debug.h:451
YSLib::Text::buf
const char * buf
Definition: TextFile.h:81
YSLib::Devices::Screen
屏幕。
Definition: YDevice.h:136
Drawing
DSScreen.h
DS 屏幕。
YSLib::ynothrow
YB_PURE const _type size_t n ynothrow
Definition: YCoreUtilities.h:168
platform::Nonnull
_type && Nonnull(_type &&p) ynothrowv
断言并返回非空参数。
Definition: Debug.h:422
YSLib::Drawing::ConstBitmapPtr
const Pixel * ConstBitmapPtr
Definition: YGraphics.h:44
CHRLib::p
const auto p(d)