//------------------------------------------------- // allocate_color_tables - allocate memory for // pen and color tables //------------------------------------------------- void allocate_color_tables() { int total_colors = m_palette.num_colors() * m_palette.num_groups(); // allocate memory for the pen table switch (m_format) { case bitmap_format.BITMAP_FORMAT_IND16: // create a dummy 1:1 mapping { m_pen_array.resize(total_colors + 2); ListPointer <rgb_t> pentable = new ListPointer <rgb_t>(m_pen_array); //pen_t *pentable = &m_pen_array[0]; m_pens = new ListPointer <rgb_t>(m_pen_array); //m_pens = &m_pen_array[0]; for (int i = 0; i < total_colors + 2; i++) { pentable[i] = new rgb_t((UInt32)i); //pentable[i] = i; } } break; case bitmap_format.BITMAP_FORMAT_RGB32: m_pens = new ListPointer <rgb_t>(m_palette.entry_list_adjusted()); // reinterpret_cast<const pen_t *>(m_palette.entry_list_adjusted()); break; default: m_pens = null; break; } }
dirty_state [] m_dirty = new dirty_state[2]; // two dirty states // construction/destruction //------------------------------------------------- // palette_client - constructor //------------------------------------------------- public palette_client(palette_t palette) { m_palette = palette; m_next = null; m_liveIdx = 0; // m_live(&m_dirty[0]), m_previousIdx = 1; // m_previous(&m_dirty[1]) // add a reference to the palette palette.ref_(); // resize the dirty lists uint32_t total_colors = (uint32_t)(palette.num_colors() * palette.num_groups()); m_dirty[0] = new dirty_state(); m_dirty[1] = new dirty_state(); m_dirty[0].resize(total_colors); m_dirty[1].resize(total_colors); // now add us to the list of clients m_next = palette.m_client_list; palette.m_client_list = this; }