RenderInterface.cpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 <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(vertices), int ROCKET_UNUSED(num_vertices), int* ROCKET_UNUSED(indices), int ROCKET_UNUSED(num_indices), TextureHandle ROCKET_UNUSED(texture))
  41. {
  42. return NULL;
  43. }
  44. // Called by Rocket when it wants to render application-compiled geometry.
  45. void RenderInterface::RenderCompiledGeometry(CompiledGeometryHandle ROCKET_UNUSED(geometry), const Vector2f& ROCKET_UNUSED(translation))
  46. {
  47. }
  48. // Called by Rocket when it wants to release application-compiled geometry.
  49. void RenderInterface::ReleaseCompiledGeometry(CompiledGeometryHandle ROCKET_UNUSED(geometry))
  50. {
  51. }
  52. // Called by Rocket when a texture is required by the library.
  53. bool RenderInterface::LoadTexture(TextureHandle& ROCKET_UNUSED(texture_handle), Vector2i& ROCKET_UNUSED(texture_dimensions), const String& ROCKET_UNUSED(source))
  54. {
  55. return false;
  56. }
  57. // Called by Rocket when a texture is required to be built from an internally-generated sequence of pixels.
  58. bool RenderInterface::GenerateTexture(TextureHandle& ROCKET_UNUSED(texture_handle), const byte* ROCKET_UNUSED(source), const Vector2i& ROCKET_UNUSED(source_dimensions))
  59. {
  60. return false;
  61. }
  62. // Called by Rocket when a loaded texture is no longer required.
  63. void RenderInterface::ReleaseTexture(TextureHandle ROCKET_UNUSED(texture))
  64. {
  65. }
  66. // Returns the native horizontal texel offset for the renderer.
  67. float RenderInterface::GetHorizontalTexelOffset()
  68. {
  69. return 0;
  70. }
  71. // Returns the native vertical texel offset for the renderer.
  72. float RenderInterface::GetVerticalTexelOffset()
  73. {
  74. return 0;
  75. }
  76. // Called when this render interface is released.
  77. void RenderInterface::Release()
  78. {
  79. }
  80. void RenderInterface::OnReferenceDeactivate()
  81. {
  82. TextureDatabase::ReleaseTextures(this);
  83. Release();
  84. }
  85. // Get the context currently being rendered.
  86. Context* RenderInterface::GetContext() const
  87. {
  88. return context;
  89. }
  90. }
  91. }