DISTRHO Plugin Framework
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

251 lines
6.2KB

  1. /*
  2. * DISTRHO Plugin Framework (DPF)
  3. * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any purpose with
  6. * or without fee is hereby granted, provided that the above copyright notice and this
  7. * permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
  10. * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
  11. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  12. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
  13. * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #include "../Vulkan.hpp"
  17. #include "../Color.hpp"
  18. #include "SubWidgetPrivateData.hpp"
  19. #include "TopLevelWidgetPrivateData.hpp"
  20. #include "WidgetPrivateData.hpp"
  21. #include "WindowPrivateData.hpp"
  22. START_NAMESPACE_DGL
  23. // -----------------------------------------------------------------------
  24. static void notImplemented(const char* const name)
  25. {
  26. d_stderr2("vulkan function not implemented: %s", name);
  27. }
  28. // -----------------------------------------------------------------------
  29. // Color
  30. void Color::setFor(const GraphicsContext&, bool)
  31. {
  32. notImplemented("Color::setFor");
  33. }
  34. // -----------------------------------------------------------------------
  35. // Line
  36. template<typename T>
  37. void Line<T>::draw(const GraphicsContext&, T)
  38. {
  39. notImplemented("Line::draw");
  40. }
  41. template<typename T>
  42. void Line<T>::draw()
  43. {
  44. notImplemented("Line::draw");
  45. }
  46. template class Line<double>;
  47. template class Line<float>;
  48. template class Line<int>;
  49. template class Line<uint>;
  50. template class Line<short>;
  51. template class Line<ushort>;
  52. // -----------------------------------------------------------------------
  53. // Circle
  54. template<typename T>
  55. void Circle<T>::draw(const GraphicsContext&)
  56. {
  57. notImplemented("Circle::draw");
  58. }
  59. template<typename T>
  60. void Circle<T>::drawOutline(const GraphicsContext&, T)
  61. {
  62. notImplemented("Circle::drawOutline");
  63. }
  64. template<typename T>
  65. void Circle<T>::draw()
  66. {
  67. notImplemented("Circle::draw");
  68. }
  69. template<typename T>
  70. void Circle<T>::drawOutline()
  71. {
  72. notImplemented("Circle::drawOutline");
  73. }
  74. template class Circle<double>;
  75. template class Circle<float>;
  76. template class Circle<int>;
  77. template class Circle<uint>;
  78. template class Circle<short>;
  79. template class Circle<ushort>;
  80. // -----------------------------------------------------------------------
  81. // Triangle
  82. template<typename T>
  83. void Triangle<T>::draw(const GraphicsContext&)
  84. {
  85. notImplemented("Triangle::draw");
  86. }
  87. template<typename T>
  88. void Triangle<T>::drawOutline(const GraphicsContext&, T)
  89. {
  90. notImplemented("Triangle::drawOutline");
  91. }
  92. template<typename T>
  93. void Triangle<T>::draw()
  94. {
  95. notImplemented("Triangle::draw");
  96. }
  97. template<typename T>
  98. void Triangle<T>::drawOutline()
  99. {
  100. notImplemented("Triangle::drawOutline");
  101. }
  102. template class Triangle<double>;
  103. template class Triangle<float>;
  104. template class Triangle<int>;
  105. template class Triangle<uint>;
  106. template class Triangle<short>;
  107. template class Triangle<ushort>;
  108. // -----------------------------------------------------------------------
  109. // Rectangle
  110. template<typename T>
  111. void Rectangle<T>::draw(const GraphicsContext&)
  112. {
  113. notImplemented("Rectangle::draw");
  114. }
  115. template<typename T>
  116. void Rectangle<T>::drawOutline(const GraphicsContext&, T)
  117. {
  118. notImplemented("Rectangle::drawOutline");
  119. }
  120. template<typename T>
  121. void Rectangle<T>::draw()
  122. {
  123. notImplemented("Rectangle::draw");
  124. }
  125. template<typename T>
  126. void Rectangle<T>::drawOutline()
  127. {
  128. notImplemented("Rectangle::drawOutline");
  129. }
  130. template class Rectangle<double>;
  131. template class Rectangle<float>;
  132. template class Rectangle<int>;
  133. template class Rectangle<uint>;
  134. template class Rectangle<short>;
  135. template class Rectangle<ushort>;
  136. // -----------------------------------------------------------------------
  137. // VulkanImage
  138. VulkanImage::VulkanImage()
  139. : ImageBase() {}
  140. VulkanImage::VulkanImage(const char* const rdata, const uint w, const uint h, const ImageFormat fmt)
  141. : ImageBase(rdata, w, h, fmt) {}
  142. VulkanImage::VulkanImage(const char* const rdata, const Size<uint>& s, const ImageFormat fmt)
  143. : ImageBase(rdata, s, fmt) {}
  144. VulkanImage::VulkanImage(const VulkanImage& image)
  145. : ImageBase(image.rawData, image.size, image.format) {}
  146. VulkanImage::~VulkanImage() {}
  147. void VulkanImage::loadFromMemory(const char* const rdata, const Size<uint>& s, const ImageFormat fmt) noexcept
  148. {
  149. ImageBase::loadFromMemory(rdata, s, fmt);
  150. }
  151. void VulkanImage::drawAt(const GraphicsContext&, const Point<int>&)
  152. {
  153. }
  154. VulkanImage& VulkanImage::operator=(const VulkanImage& image) noexcept
  155. {
  156. rawData = image.rawData;
  157. size = image.size;
  158. format = image.format;
  159. return *this;
  160. }
  161. // -----------------------------------------------------------------------
  162. void SubWidget::PrivateData::display(const uint width, const uint height, const double autoScaleFactor)
  163. {
  164. // TODO
  165. selfw->pData->displaySubWidgets(width, height, autoScaleFactor);
  166. }
  167. // -----------------------------------------------------------------------
  168. void TopLevelWidget::PrivateData::display()
  169. {
  170. if (! selfw->pData->visible)
  171. return;
  172. const Size<uint> size(window.getSize());
  173. const uint width = size.getWidth();
  174. const uint height = size.getHeight();
  175. const double autoScaleFactor = window.pData->autoScaleFactor;
  176. // TODO
  177. // main widget drawing
  178. self->onDisplay();
  179. // now draw subwidgets if there are any
  180. selfw->pData->displaySubWidgets(width, height, autoScaleFactor);
  181. }
  182. // -----------------------------------------------------------------------
  183. void Window::PrivateData::renderToPicture(const char*, const GraphicsContext&, uint, uint)
  184. {
  185. notImplemented("Window::PrivateData::renderToPicture");
  186. }
  187. // -----------------------------------------------------------------------
  188. const GraphicsContext& Window::PrivateData::getGraphicsContext() const noexcept
  189. {
  190. return (const GraphicsContext&)graphicsContext;
  191. }
  192. // -----------------------------------------------------------------------
  193. END_NAMESPACE_DGL
  194. // -----------------------------------------------------------------------