RenderInterface.cpp 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * This source file is part of libRocket, the HTML/CSS Interface Middleware
  3. *
  4. * For the latest information, see http://www.librocket.com
  5. *
  6. * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
  7. *
  8. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9. * of this software and associated documentation files (the "Software"), to deal
  10. * in the Software without restriction, including without limitation the rights
  11. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12. * copies of the Software, and to permit persons to whom the Software is
  13. * furnished to do so, subject to the following conditions:
  14. *
  15. * The above copyright notice and this permission notice shall be included in
  16. * all copies or substantial portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  23. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  24. * THE SOFTWARE.
  25. *
  26. */
  27. #include "precompiled.h"
  28. #include "../../Include/Rocket/Core/RenderInterface.h"
  29. #include "TextureDatabase.h"
  30. namespace Rocket {
  31. namespace Core {
  32. RenderInterface::RenderInterface() : ReferenceCountable(0)
  33. {
  34. context = NULL;
  35. }
  36. RenderInterface::~RenderInterface()
  37. {
  38. }
  39. // Called by Rocket when it wants to compile geometry it believes will be static for the forseeable future.
  40. CompiledGeometryHandle RenderInterface::CompileGeometry(Vertex* ROCKET_UNUSED_PARAMETER(vertices), int ROCKET_UNUSED_PARAMETER(num_vertices), int* ROCKET_UNUSED_PARAMETER(indices), int ROCKET_UNUSED_PARAMETER(num_indices), TextureHandle ROCKET_UNUSED_PARAMETER(texture))
  41. {
  42. ROCKET_UNUSED(vertices);
  43. ROCKET_UNUSED(num_vertices);
  44. ROCKET_UNUSED(indices);
  45. ROCKET_UNUSED(num_indices);
  46. ROCKET_UNUSED(texture);
  47. return 0;
  48. }
  49. // Called by Rocket when it wants to render application-compiled geometry.
  50. void RenderInterface::RenderCompiledGeometry(CompiledGeometryHandle ROCKET_UNUSED_PARAMETER(geometry), const Vector2f& ROCKET_UNUSED_PARAMETER(translation))
  51. {
  52. ROCKET_UNUSED(geometry);
  53. ROCKET_UNUSED(translation);
  54. }
  55. // Called by Rocket when it wants to release application-compiled geometry.
  56. void RenderInterface::ReleaseCompiledGeometry(CompiledGeometryHandle ROCKET_UNUSED_PARAMETER(geometry))
  57. {
  58. ROCKET_UNUSED(geometry);
  59. }
  60. // Called by Rocket when a texture is required by the library.
  61. bool RenderInterface::LoadTexture(TextureHandle& ROCKET_UNUSED_PARAMETER(texture_handle), Vector2i& ROCKET_UNUSED_PARAMETER(texture_dimensions), const String& ROCKET_UNUSED_PARAMETER(source))
  62. {
  63. ROCKET_UNUSED(texture_handle);
  64. ROCKET_UNUSED(texture_dimensions);
  65. ROCKET_UNUSED(source);
  66. return false;
  67. }
  68. // Called by Rocket when a texture is required to be built from an internally-generated sequence of pixels.
  69. bool RenderInterface::GenerateTexture(TextureHandle& ROCKET_UNUSED_PARAMETER(texture_handle), const byte* ROCKET_UNUSED_PARAMETER(source), const Vector2i& ROCKET_UNUSED_PARAMETER(source_dimensions))
  70. {
  71. ROCKET_UNUSED(texture_handle);
  72. ROCKET_UNUSED(source);
  73. ROCKET_UNUSED(source_dimensions);
  74. return false;
  75. }
  76. // Called by Rocket when a loaded texture is no longer required.
  77. void RenderInterface::ReleaseTexture(TextureHandle ROCKET_UNUSED_PARAMETER(texture))
  78. {
  79. ROCKET_UNUSED(texture);
  80. }
  81. // Returns the native horizontal texel offset for the renderer.
  82. float RenderInterface::GetHorizontalTexelOffset()
  83. {
  84. return 0;
  85. }
  86. // Returns the native vertical texel offset for the renderer.
  87. float RenderInterface::GetVerticalTexelOffset()
  88. {
  89. return 0;
  90. }
  91. // Returns the number of pixels per inch.
  92. float RenderInterface::GetPixelsPerInch()
  93. {
  94. return 100;
  95. }
  96. // Called when this render interface is released.
  97. void RenderInterface::Release()
  98. {
  99. }
  100. void RenderInterface::OnReferenceDeactivate()
  101. {
  102. TextureDatabase::ReleaseTextures(this);
  103. Release();
  104. }
  105. // Get the context currently being rendered.
  106. Context* RenderInterface::GetContext() const
  107. {
  108. return context;
  109. }
  110. }
  111. }