diff options
author | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2018-08-27 12:37:52 +0300 |
---|---|---|
committer | Aleksey Belousov <beloal@users.noreply.github.com> | 2018-09-25 12:33:08 +0300 |
commit | a81f1fc4d1f698a0f0aaaa1e7a29f41516b05d11 (patch) | |
tree | cf7c511247ca2ae4da08e2a11d2b22232846a3da /drape/texture.hpp | |
parent | 5cca83542d89b081d668bccca7bf14c5c8c165ad (diff) |
[drape][metal] Added states.
Diffstat (limited to 'drape/texture.hpp')
-rw-r--r-- | drape/texture.hpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drape/texture.hpp b/drape/texture.hpp index 8dff145036..ed6b58b594 100644 --- a/drape/texture.hpp +++ b/drape/texture.hpp @@ -1,5 +1,6 @@ #pragma once +#include "drape/graphics_context.hpp" #include "drape/hw_texture.hpp" #include "drape/pointers.hpp" #include "drape/texture_types.hpp" @@ -44,11 +45,11 @@ public: m2::RectF m_texRect; }; - Texture(); + Texture() = default; virtual ~Texture(); virtual ref_ptr<ResourceInfo> FindResource(Key const & key, bool & newResource) = 0; - virtual void UpdateState() {} + virtual void UpdateState(ref_ptr<dp::GraphicsContext> context) {} virtual bool HasEnoughSpace(uint32_t /* newKeysCount */) const { return true; } using Params = HWTexture::Params; @@ -64,16 +65,21 @@ public: // Texture must be bound before calling this method. virtual void SetFilter(TextureFilter filter); - virtual void Create(Params const & params); - virtual void Create(Params const & params, ref_ptr<void> data); - void UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_t height, ref_ptr<void> data); + virtual void Create(ref_ptr<dp::GraphicsContext> context, Params const & params); + virtual void Create(ref_ptr<dp::GraphicsContext> context, Params const & params, + ref_ptr<void> data); + void UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_t height, + ref_ptr<void> data); + + ref_ptr<HWTexture> GetHardwareTexture() const; static uint32_t GetMaxTextureSize(); static bool IsPowerOfTwo(uint32_t width, uint32_t height); protected: void Destroy(); - bool AllocateTexture(ref_ptr<HWTextureAllocator> allocator); + bool AllocateTexture(ref_ptr<dp::GraphicsContext> context, + ref_ptr<HWTextureAllocator> allocator); drape_ptr<HWTexture> m_hwTexture; |