-
-
Notifications
You must be signed in to change notification settings - Fork 492
/
Copy pathPixelBuffer.cpp
64 lines (51 loc) · 1.19 KB
/
PixelBuffer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "pch.h"
#include "PixelBuffer.h"
#if __has_include("PixelBuffer.g.cpp")
#include "PixelBuffer.g.cpp"
#endif
namespace winrt::Telegram::Native::implementation
{
PixelBuffer::PixelBuffer(WriteableBitmap bitmap)
: m_bitmap(bitmap)
{
auto buffer = bitmap.PixelBuffer();
m_pixels = buffer.data();
m_capacity = buffer.Capacity();
m_length = buffer.Length();
m_bitmapWidth = bitmap.PixelWidth();
m_bitmapHeight = bitmap.PixelHeight();
}
PixelBuffer::~PixelBuffer()
{
//m_pixels = nullptr;
m_bitmap = nullptr;
}
uint32_t PixelBuffer::Capacity()
{
return m_capacity;
}
uint32_t PixelBuffer::Length()
{
return m_length;
}
void PixelBuffer::Length(uint32_t value)
{
}
HRESULT __stdcall PixelBuffer::Buffer(uint8_t** value)
{
*value = m_pixels;
return S_OK;
}
int32_t PixelBuffer::PixelWidth() noexcept
{
return m_bitmapWidth;
}
int32_t PixelBuffer::PixelHeight() noexcept
{
return m_bitmapHeight;
}
WriteableBitmap PixelBuffer::Source() noexcept
{
return m_bitmap;
}
}