Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

generic_bitmap.cpp

00001 /*****************************************************************************
00002  * generic_bitmap.cpp
00003  *****************************************************************************
00004  * Copyright (C) 2004 the VideoLAN team
00005  * $Id: generic_bitmap.cpp 11664 2005-07-09 06:17:09Z courmisch $
00006  *
00007  * Authors: Cyril Deguet     <[email protected]>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00022  *****************************************************************************/
00023 
00024 #include "generic_bitmap.hpp"
00025 
00026 
00027 BitmapImpl::BitmapImpl( intf_thread_t *pIntf, int width, int height ):
00028     GenericBitmap( pIntf ), m_width( width ), m_height( height ),
00029     m_pData( NULL )
00030 {
00031     m_pData = new uint8_t[width * height * 4];
00032     memset( m_pData, 0, width * height * 4 );
00033 }
00034 
00035 
00036 BitmapImpl::~BitmapImpl()
00037 {
00038     delete[] m_pData;
00039 }
00040 
00041 
00042 void BitmapImpl::drawBitmap( const GenericBitmap &rSource, int xSrc, int ySrc,
00043                              int xDest, int yDest, int width, int height )
00044 {
00045     int srcWidth = rSource.getWidth();
00046     uint32_t *pSrc = (uint32_t*)rSource.getData() + ySrc * srcWidth + xSrc;
00047     uint32_t *pDest = (uint32_t*)m_pData + yDest * m_width + xDest ;
00048     for( int y = 0; y < height; y++ )
00049     {
00050         memcpy( pDest, pSrc, 4 * width );
00051         pSrc += srcWidth;
00052         pDest += m_width;
00053     }
00054 }
00055 

Generated on Tue Dec 20 10:14:42 2005 for vlc-0.8.4a by  doxygen 1.4.2