MCPcopy Create free account
hub / github.com/MyGUI/mygui / updateTexture

Method updateTexture

Tools/EditorFramework/ColourPanel.cpp:92–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90 }
91
92 void ColourPanel::updateTexture(const MyGUI::Colour& _colour)
93 {
94 size_t size = 32;
95
96 MyGUI::uint8* pDest = static_cast<MyGUI::uint8*>(mTexture->lock(MyGUI::TextureUsage::Write));
97
98 for (size_t j = 0; j < size; j++)
99 {
100 for (size_t i = 0; i < size; i++)
101 {
102 float x = static_cast<float>(i) / size;
103 float y = static_cast<float>(j) / size;
104 *pDest++ = MyGUI::uint8((1.f - y) * (_colour.blue * x + (1.f - x)) * 255); // B
105 *pDest++ = MyGUI::uint8((1.f - y) * (_colour.green * x + (1.f - x)) * 255); // G
106 *pDest++ = MyGUI::uint8((1.f - y) * (_colour.red * x + (1.f - x)) * 255); // R
107 *pDest++ = 255; // A
108 }
109 }
110
111 // Unlock the pixel buffer
112 mTexture->unlock();
113 }
114
115 void ColourPanel::notifyMouseDrag(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id)
116 {

Callers

nothing calls this directly

Calls 2

lockMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected