MythTV  master
mythcombobuffervulkan.cpp
Go to the documentation of this file.
1 // MythTV
3 
5  : m_width(Width),
6  m_height(Height)
7 {
8 }
9 
10 const void* MythComboBufferVulkan::Data(void) const
11 {
12  return &m_data.back();
13 }
14 
16 {
17  m_data.pop_back();
18 }
19 
20 void MythComboBufferVulkan::PushData(const QMatrix4x4 &Transform, const QRect Source,
21  const QRect Destination, int Alpha)
22 {
23  m_data.push_back({});
24  VulkanComboBuffer* data = &m_data.back();
25  data->color[0] = data->color[1] = data->color[2] = 1.0F;
26 
27  float width = std::min(static_cast<float>(Source.width()), m_width);
28  float height = std::min(static_cast<float>(Source.height()), m_height);
29 
30  // Transform
31  memcpy(&data->transform[0], Transform.constData(), sizeof(float) * 16);
32 
33  // Position/destination
34  data->position[0] = Destination.x();
35  data->position[1] = Destination.y();
36  data->position[2] = data->position[0] + width;
37  data->position[3] = data->position[1] + height;
38 
39  // Texture coordinates
40  data->texcoords[0] = Source.left() / m_width;
41  data->texcoords[1] = Source.top() / m_height;
42  data->texcoords[2] = (Source.left() + width) / m_width;
43  data->texcoords[3] = (Source.top() + height) / m_height;
44 
45  // Alpha/color
46  data->color[3] = Alpha / 255.0F;
47 }
Transform
static void Transform(SIMI *Simi, F_PT xo, F_PT yo, F_PT *x, F_PT *y)
Definition: ifs.cpp:290
VulkanComboBuffer
Definition: mythcombobuffervulkan.h:15
MythComboBufferVulkan::m_width
float m_width
Definition: mythcombobuffervulkan.h:37
MythComboBufferVulkan::PushData
void PushData(const QMatrix4x4 &Transform, QRect Source, QRect Destination, int Alpha)
Definition: mythcombobuffervulkan.cpp:20
mythcombobuffervulkan.h
VulkanComboBuffer::position
float position[4]
Definition: mythcombobuffervulkan.h:18
Source
Definition: channelsettings.cpp:93
VulkanComboBuffer::color
float color[4]
Definition: mythcombobuffervulkan.h:20
MythComboBufferVulkan::PopData
void PopData(void)
Definition: mythcombobuffervulkan.cpp:15
VulkanComboBuffer::transform
float transform[16]
Definition: mythcombobuffervulkan.h:17
VulkanComboBuffer::texcoords
float texcoords[4]
Definition: mythcombobuffervulkan.h:19
MythComboBufferVulkan::Data
const void * Data(void) const
Definition: mythcombobuffervulkan.cpp:10
MythComboBufferVulkan::m_height
float m_height
Definition: mythcombobuffervulkan.h:38
MythComboBufferVulkan::m_data
std::vector< VulkanComboBuffer > m_data
Definition: mythcombobuffervulkan.h:36
MythComboBufferVulkan::MythComboBufferVulkan
MythComboBufferVulkan(float Width, float Height)
Definition: mythcombobuffervulkan.cpp:4