canvasbitmap.cxx (9f62ea84) canvasbitmap.cxx (87bc88d3)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 527 unchanged lines hidden (view full) ---

536 {
537 sal_Int8* pOutScan = pOutBuf;
538
539 if( m_nBitsPerInputPixel < 8 )
540 {
541 // input less than a byte - copy via GetPixel()
542 for( long x=aRequestedArea.Left(); x<aRequestedArea.Right(); ++x )
543 {
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 527 unchanged lines hidden (view full) ---

536 {
537 sal_Int8* pOutScan = pOutBuf;
538
539 if( m_nBitsPerInputPixel < 8 )
540 {
541 // input less than a byte - copy via GetPixel()
542 for( long x=aRequestedArea.Left(); x<aRequestedArea.Right(); ++x )
543 {
544 *pOutScan++ = m_pBmpAcc->GetPixel(y,x);
545 *pOutScan++ = m_pAlphaAcc->GetPixel(y,x);
544 *pOutScan++ = m_pBmpAcc->GetPixelIndex(y,x);
545 *pOutScan++ = m_pAlphaAcc->GetPixelIndex(y,x);
546 }
547 }
548 else
549 {
550 const long nNonAlphaBytes( m_nBitsPerInputPixel/8 );
551 const long nScanlineOffsetLeft(aRequestedArea.Left()*nNonAlphaBytes);
552 Scanline pScan = m_pBmpAcc->GetScanline(y) + nScanlineOffsetLeft;
553
554 // input integer multiple of byte - copy directly
555 for( long x=aRequestedArea.Left(); x<aRequestedArea.Right(); ++x )
556 {
557 for( long i=0; i<nNonAlphaBytes; ++i )
558 *pOutScan++ = *pScan++;
546 }
547 }
548 else
549 {
550 const long nNonAlphaBytes( m_nBitsPerInputPixel/8 );
551 const long nScanlineOffsetLeft(aRequestedArea.Left()*nNonAlphaBytes);
552 Scanline pScan = m_pBmpAcc->GetScanline(y) + nScanlineOffsetLeft;
553
554 // input integer multiple of byte - copy directly
555 for( long x=aRequestedArea.Left(); x<aRequestedArea.Right(); ++x )
556 {
557 for( long i=0; i<nNonAlphaBytes; ++i )
558 *pOutScan++ = *pScan++;
559 *pOutScan++ = m_pAlphaAcc->GetPixel(y,x);
559 *pOutScan++ = m_pAlphaAcc->GetPixelIndex( y, x );
560 }
561 }
562
563 pOutBuf += nScanlineStride;
564 }
565 }
566
567 return aRet;

--- 45 unchanged lines hidden (view full) ---

613 // interleave alpha with bitmap data - note, bitcount is
614 // always integer multiple of 8
615 OSL_ENSURE((m_nBitsPerOutputPixel & 0x07) == 0,
616 "Transparent bitmap bitcount not integer multiple of 8" );
617
618 if( m_nBitsPerInputPixel < 8 )
619 {
620 // input less than a byte - copy via GetPixel()
560 }
561 }
562
563 pOutBuf += nScanlineStride;
564 }
565 }
566
567 return aRet;

--- 45 unchanged lines hidden (view full) ---

613 // interleave alpha with bitmap data - note, bitcount is
614 // always integer multiple of 8
615 OSL_ENSURE((m_nBitsPerOutputPixel & 0x07) == 0,
616 "Transparent bitmap bitcount not integer multiple of 8" );
617
618 if( m_nBitsPerInputPixel < 8 )
619 {
620 // input less than a byte - copy via GetPixel()
621 *pOutBuf++ = m_pBmpAcc->GetPixel(pos.Y,pos.X);
622 *pOutBuf = m_pAlphaAcc->GetPixel(pos.Y,pos.X);
621 *pOutBuf++ = m_pBmpAcc->GetPixelIndex(pos.Y,pos.X);
622 *pOutBuf = m_pAlphaAcc->GetPixelIndex(pos.Y,pos.X);
623 }
624 else
625 {
626 const long nNonAlphaBytes( m_nBitsPerInputPixel/8 );
627 Scanline pScan = m_pBmpAcc->GetScanline(pos.Y);
628
629 // input integer multiple of byte - copy directly
630 rtl_copyMemory(pOutBuf, pScan+nScanlineLeftOffset, nNonAlphaBytes );
631 pOutBuf += nNonAlphaBytes;
623 }
624 else
625 {
626 const long nNonAlphaBytes( m_nBitsPerInputPixel/8 );
627 Scanline pScan = m_pBmpAcc->GetScanline(pos.Y);
628
629 // input integer multiple of byte - copy directly
630 rtl_copyMemory(pOutBuf, pScan+nScanlineLeftOffset, nNonAlphaBytes );
631 pOutBuf += nNonAlphaBytes;
632 *pOutBuf++ = m_pAlphaAcc->GetPixel(pos.Y,pos.X);
632 *pOutBuf++ = m_pAlphaAcc->GetPixelIndex(pos.Y,pos.X);
633 }
634 }
635
636 return aRet;
637}
638
639uno::Reference< rendering::XBitmapPalette > SAL_CALL VclCanvasBitmap::getPalette() throw (uno::RuntimeException)
640{

--- 530 unchanged lines hidden (view full) ---

1171 }
1172 }
1173 else
1174 {
1175 for( sal_Int32 i=0; i<nNumColors; ++i )
1176 {
1177 const BitmapColor aCol =
1178 m_bPalette ?
633 }
634 }
635
636 return aRet;
637}
638
639uno::Reference< rendering::XBitmapPalette > SAL_CALL VclCanvasBitmap::getPalette() throw (uno::RuntimeException)
640{

--- 530 unchanged lines hidden (view full) ---

1171 }
1172 }
1173 else
1174 {
1175 for( sal_Int32 i=0; i<nNumColors; ++i )
1176 {
1177 const BitmapColor aCol =
1178 m_bPalette ?
1179 m_pBmpAcc->GetPaletteColor(
1180 sal::static_int_cast<sal_uInt16>(
1181 m_pBmpAcc->GetPixelFromData(
1182 pIn, i ))) :
1179 m_pBmpAcc->GetPaletteColor( m_pBmpAcc->GetPixelFromData( pIn, i ).GetIndex()) :
1183 m_pBmpAcc->GetPixelFromData(pIn, i);
1184
1185 // TODO(F3): Convert result to sRGB color space
1186 *pOut++ = rendering::RGBColor(toDoubleColor(aCol.GetRed()),
1187 toDoubleColor(aCol.GetGreen()),
1188 toDoubleColor(aCol.GetBlue()));
1189 }
1190 }

--- 37 unchanged lines hidden (view full) ---

1228 }
1229 }
1230 else
1231 {
1232 for( sal_Int32 i=0; i<nNumColors; ++i )
1233 {
1234 const BitmapColor aCol =
1235 m_bPalette ?
1180 m_pBmpAcc->GetPixelFromData(pIn, i);
1181
1182 // TODO(F3): Convert result to sRGB color space
1183 *pOut++ = rendering::RGBColor(toDoubleColor(aCol.GetRed()),
1184 toDoubleColor(aCol.GetGreen()),
1185 toDoubleColor(aCol.GetBlue()));
1186 }
1187 }

--- 37 unchanged lines hidden (view full) ---

1225 }
1226 }
1227 else
1228 {
1229 for( sal_Int32 i=0; i<nNumColors; ++i )
1230 {
1231 const BitmapColor aCol =
1232 m_bPalette ?
1236 m_pBmpAcc->GetPaletteColor(
1237 sal::static_int_cast<sal_uInt16>(
1238 m_pBmpAcc->GetPixelFromData(
1239 pIn, i ))) :
1233 m_pBmpAcc->GetPaletteColor( m_pBmpAcc->GetPixelFromData( pIn, i ).GetIndex() ) :
1240 m_pBmpAcc->GetPixelFromData(pIn, i);
1241
1242 // TODO(F3): Convert result to sRGB color space
1243 *pOut++ = rendering::ARGBColor(1.0,
1244 toDoubleColor(aCol.GetRed()),
1245 toDoubleColor(aCol.GetGreen()),
1246 toDoubleColor(aCol.GetBlue()));
1247 }

--- 39 unchanged lines hidden (view full) ---

1287 }
1288 }
1289 else
1290 {
1291 for( sal_Int32 i=0; i<nNumColors; ++i )
1292 {
1293 const BitmapColor aCol =
1294 m_bPalette ?
1234 m_pBmpAcc->GetPixelFromData(pIn, i);
1235
1236 // TODO(F3): Convert result to sRGB color space
1237 *pOut++ = rendering::ARGBColor(1.0,
1238 toDoubleColor(aCol.GetRed()),
1239 toDoubleColor(aCol.GetGreen()),
1240 toDoubleColor(aCol.GetBlue()));
1241 }

--- 39 unchanged lines hidden (view full) ---

1281 }
1282 }
1283 else
1284 {
1285 for( sal_Int32 i=0; i<nNumColors; ++i )
1286 {
1287 const BitmapColor aCol =
1288 m_bPalette ?
1295 m_pBmpAcc->GetPaletteColor(
1296 sal::static_int_cast<sal_uInt16>(
1297 m_pBmpAcc->GetPixelFromData(
1298 pIn, i ))) :
1289 m_pBmpAcc->GetPaletteColor( m_pBmpAcc->GetPixelFromData( pIn, i ).GetIndex() ) :
1299 m_pBmpAcc->GetPixelFromData(pIn, i);
1300
1301 // TODO(F3): Convert result to sRGB color space
1302 *pOut++ = rendering::ARGBColor(1.0,
1303 toDoubleColor(aCol.GetRed()),
1304 toDoubleColor(aCol.GetGreen()),
1305 toDoubleColor(aCol.GetBlue()));
1306 }

--- 157 unchanged lines hidden ---
1290 m_pBmpAcc->GetPixelFromData(pIn, i);
1291
1292 // TODO(F3): Convert result to sRGB color space
1293 *pOut++ = rendering::ARGBColor(1.0,
1294 toDoubleColor(aCol.GetRed()),
1295 toDoubleColor(aCol.GetGreen()),
1296 toDoubleColor(aCol.GetBlue()));
1297 }

--- 157 unchanged lines hidden ---