Пример #1
0
        // operations

        /**
         * @fn  void bitmap_t::set_palette(palette_t *palette)
         *
         * @brief   -------------------------------------------------
         *            set_palette -- associate a palette with a bitmap
         *          -------------------------------------------------.
         *
         * @param [in,out]  palette If non-null, the palette.
         */
        public void set_palette(palette_t palette)
        {
            // first dereference any existing palette
            if (m_palette != null)
            {
                m_palette.deref();
                m_palette = null;
            }

            // then reference any new palette
            if (palette != null)
            {
                palette.ref_();
                m_palette = palette;
            }
        }
Пример #2
0
        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;
        }