Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include <bmpfast.hxx>
22 :
23 : #ifndef NO_OPTIMIZED_BITMAP_ACCESS
24 :
25 : #include <tools/debug.hxx>
26 : #include <vcl/bmpacc.hxx>
27 :
28 : #define FAST_ARGB_BGRA
29 :
30 : #include <stdlib.h>
31 :
32 : typedef unsigned char PIXBYTE;
33 :
34 : class BasePixelPtr
35 : {
36 : public:
37 0 : BasePixelPtr( PIXBYTE* p = NULL ) : mpPixel( p ) {}
38 0 : void SetRawPtr( PIXBYTE* pRawPtr ) { mpPixel = pRawPtr; }
39 0 : PIXBYTE* GetRawPtr( void ) const { return mpPixel; }
40 0 : void AddByteOffset( int nByteOffset ) { mpPixel += nByteOffset; }
41 : bool operator<( const BasePixelPtr& rCmp ) const { return (mpPixel < rCmp.mpPixel); }
42 :
43 : protected:
44 : PIXBYTE* mpPixel;
45 : };
46 :
47 : template <sal_uLong PIXFMT>
48 : class TrueColorPixelPtr : public BasePixelPtr
49 : {
50 : public:
51 : PIXBYTE GetRed() const;
52 : PIXBYTE GetGreen() const;
53 : PIXBYTE GetBlue() const;
54 : PIXBYTE GetAlpha() const;
55 :
56 : void SetColor( PIXBYTE r, PIXBYTE g, PIXBYTE b ) const;
57 : void SetAlpha( PIXBYTE a ) const;
58 : void operator++(int);
59 : };
60 :
61 : // =======================================================================
62 : // template specializations for truecolor pixel formats
63 :
64 : template <>
65 0 : class TrueColorPixelPtr<BMP_FORMAT_24BIT_TC_RGB> : public BasePixelPtr
66 : {
67 : public:
68 0 : void operator++() { mpPixel += 3; }
69 :
70 0 : PIXBYTE GetRed() const { return mpPixel[0]; }
71 0 : PIXBYTE GetGreen() const { return mpPixel[1]; }
72 0 : PIXBYTE GetBlue() const { return mpPixel[2]; }
73 0 : PIXBYTE GetAlpha() const { return 0; }
74 0 : void SetAlpha( PIXBYTE ) const {}
75 :
76 0 : void SetColor( PIXBYTE r, PIXBYTE g, PIXBYTE b ) const
77 : {
78 0 : mpPixel[0] = r;
79 0 : mpPixel[1] = g;
80 0 : mpPixel[2] = b;
81 0 : }
82 : };
83 :
84 : template <>
85 0 : class TrueColorPixelPtr<BMP_FORMAT_24BIT_TC_BGR> : public BasePixelPtr
86 : {
87 : public:
88 0 : void operator++() { mpPixel += 3; }
89 :
90 0 : PIXBYTE GetRed() const { return mpPixel[2]; }
91 0 : PIXBYTE GetGreen() const { return mpPixel[1]; }
92 0 : PIXBYTE GetBlue() const { return mpPixel[0]; }
93 0 : PIXBYTE GetAlpha() const { return 0; }
94 0 : void SetAlpha( PIXBYTE ) const {}
95 :
96 0 : void SetColor( PIXBYTE r, PIXBYTE g, PIXBYTE b ) const
97 : {
98 0 : mpPixel[0] = b;
99 0 : mpPixel[1] = g;
100 0 : mpPixel[2] = r;
101 0 : }
102 : };
103 :
104 : template <>
105 0 : class TrueColorPixelPtr<BMP_FORMAT_32BIT_TC_ARGB> : public BasePixelPtr
106 : {
107 : public:
108 0 : void operator++() { mpPixel += 4; }
109 :
110 0 : PIXBYTE GetRed() const { return mpPixel[1]; }
111 0 : PIXBYTE GetGreen() const { return mpPixel[2]; }
112 0 : PIXBYTE GetBlue() const { return mpPixel[3]; }
113 0 : PIXBYTE GetAlpha() const { return mpPixel[0]; }
114 0 : void SetAlpha( PIXBYTE a ) const { mpPixel[0] = a; }
115 :
116 0 : void SetColor( PIXBYTE r, PIXBYTE g, PIXBYTE b ) const
117 : {
118 0 : mpPixel[1] = r;
119 0 : mpPixel[2] = g;
120 0 : mpPixel[3] = b;
121 0 : }
122 : };
123 :
124 : template <>
125 0 : class TrueColorPixelPtr<BMP_FORMAT_32BIT_TC_ABGR> : public BasePixelPtr
126 : {
127 : public:
128 0 : void operator++() { mpPixel += 4; }
129 :
130 0 : PIXBYTE GetRed() const { return mpPixel[3]; }
131 0 : PIXBYTE GetGreen() const { return mpPixel[2]; }
132 0 : PIXBYTE GetBlue() const { return mpPixel[1]; }
133 0 : PIXBYTE GetAlpha() const { return mpPixel[0]; }
134 0 : void SetAlpha( PIXBYTE a ) const { mpPixel[0] = a; }
135 :
136 0 : void SetColor( PIXBYTE r, PIXBYTE g, PIXBYTE b ) const
137 : {
138 0 : mpPixel[1] = b;
139 0 : mpPixel[2] = g;
140 0 : mpPixel[3] = r;
141 0 : }
142 : };
143 :
144 : template <>
145 0 : class TrueColorPixelPtr<BMP_FORMAT_32BIT_TC_RGBA> : public BasePixelPtr
146 : {
147 : public:
148 0 : void operator++() { mpPixel += 4; }
149 :
150 0 : PIXBYTE GetRed() const { return mpPixel[0]; }
151 0 : PIXBYTE GetGreen() const { return mpPixel[1]; }
152 0 : PIXBYTE GetBlue() const { return mpPixel[2]; }
153 0 : PIXBYTE GetAlpha() const { return mpPixel[3]; }
154 0 : void SetAlpha( PIXBYTE a ) const{ mpPixel[3] = a; }
155 :
156 0 : void SetColor( PIXBYTE r, PIXBYTE g, PIXBYTE b ) const
157 : {
158 0 : mpPixel[0] = r;
159 0 : mpPixel[1] = g;
160 0 : mpPixel[2] = b;
161 0 : }
162 : };
163 :
164 : template <>
165 0 : class TrueColorPixelPtr<BMP_FORMAT_32BIT_TC_BGRA> : public BasePixelPtr
166 : {
167 : public:
168 0 : void operator++() { mpPixel += 4; }
169 :
170 0 : PIXBYTE GetRed() const { return mpPixel[2]; }
171 0 : PIXBYTE GetGreen() const { return mpPixel[1]; }
172 0 : PIXBYTE GetBlue() const { return mpPixel[0]; }
173 0 : PIXBYTE GetAlpha() const { return mpPixel[3]; }
174 0 : void SetAlpha( PIXBYTE a ) const{ mpPixel[3] = a; }
175 :
176 0 : void SetColor( PIXBYTE r, PIXBYTE g, PIXBYTE b ) const
177 : {
178 0 : mpPixel[0] = b;
179 0 : mpPixel[1] = g;
180 0 : mpPixel[2] = r;
181 0 : }
182 : };
183 :
184 : template <>
185 0 : class TrueColorPixelPtr<BMP_FORMAT_16BIT_TC_MSB_MASK> : public BasePixelPtr
186 : {
187 : public:
188 0 : void operator++() { mpPixel += 2; }
189 :
190 : // TODO: non565-RGB
191 0 : PIXBYTE GetRed() const { return (mpPixel[0] & 0xF8U); }
192 0 : PIXBYTE GetGreen() const { return (mpPixel[0]<<5U) | ((mpPixel[1]>>3U)&28U); }
193 0 : PIXBYTE GetBlue() const { return (mpPixel[1]<<3U); }
194 0 : PIXBYTE GetAlpha() const { return 0; }
195 0 : void SetAlpha( PIXBYTE ) const {}
196 :
197 0 : void SetColor( PIXBYTE r, PIXBYTE g, PIXBYTE b ) const
198 : {
199 0 : mpPixel[0] = ((g >> 5U) & 7U) | (r & 0xF8U);
200 0 : mpPixel[1] = ((g & 28U)<< 3U) | (b >> 3U);
201 0 : }
202 : };
203 :
204 : template <>
205 0 : class TrueColorPixelPtr<BMP_FORMAT_16BIT_TC_LSB_MASK> : public BasePixelPtr
206 : {
207 : public:
208 0 : void operator++() { mpPixel += 2; }
209 :
210 : // TODO: non565-RGB
211 0 : PIXBYTE GetRed() const { return (mpPixel[1] & 0xF8U); }
212 0 : PIXBYTE GetGreen() const { return (mpPixel[1]<<5U) | ((mpPixel[0]>>3U)&28U); }
213 0 : PIXBYTE GetBlue() const { return (mpPixel[0]<<3U); }
214 0 : PIXBYTE GetAlpha() const { return 0; }
215 0 : void SetAlpha( PIXBYTE ) const {}
216 :
217 0 : void SetColor( PIXBYTE r, PIXBYTE g, PIXBYTE b ) const
218 : {
219 0 : mpPixel[0] = ((g & 28U)<< 3U) | (b >> 3U);
220 0 : mpPixel[1] = ((g >> 5U) & 7U) | (r & 0xF8U);
221 0 : }
222 : };
223 :
224 : // -----------------------------------------------------------------------
225 :
226 : template <>
227 0 : class TrueColorPixelPtr<BMP_FORMAT_8BIT_TC_MASK> : public BasePixelPtr
228 : {
229 : public:
230 0 : void operator++() { mpPixel += 1; }
231 0 : PIXBYTE GetAlpha() const { return mpPixel[0]; }
232 : void SetAlpha( PIXBYTE a ) const { mpPixel[0] = a; }
233 : void SetColor( PIXBYTE, PIXBYTE, PIXBYTE ) const {}
234 : };
235 :
236 : // TODO: for some reason many Alpha maps are BMP_FORMAT_8BIT_PAL
237 : // they should be BMP_FORMAT_8BIT_TC_MASK
238 : template <>
239 0 : class TrueColorPixelPtr<BMP_FORMAT_8BIT_PAL>
240 : : public TrueColorPixelPtr<BMP_FORMAT_8BIT_TC_MASK>
241 : {};
242 :
243 : // =======================================================================
244 : // converting truecolor formats
245 :
246 : template <sal_uLong SRCFMT, sal_uLong DSTFMT>
247 0 : inline void ImplConvertPixel( const TrueColorPixelPtr<DSTFMT>& rDst,
248 : const TrueColorPixelPtr<SRCFMT>& rSrc )
249 : {
250 0 : rDst.SetColor( rSrc.GetRed(), rSrc.GetGreen(), rSrc.GetBlue() );
251 0 : rDst.SetAlpha( rSrc.GetAlpha() );
252 0 : }
253 :
254 : // -----------------------------------------------------------------------
255 :
256 : template <>
257 0 : inline void ImplConvertPixel<BMP_FORMAT_16BIT_TC_LSB_MASK, BMP_FORMAT_16BIT_TC_MSB_MASK> (
258 : const TrueColorPixelPtr<BMP_FORMAT_16BIT_TC_MSB_MASK>& rDst,
259 : const TrueColorPixelPtr<BMP_FORMAT_16BIT_TC_LSB_MASK>& rSrc )
260 : {
261 : // byte swapping
262 0 : const PIXBYTE* pSrc = rSrc.GetRawPtr();
263 0 : PIXBYTE* pDst = rDst.GetRawPtr();
264 0 : pDst[1] = pSrc[0];
265 0 : pDst[0] = pSrc[1];
266 0 : }
267 :
268 : // -----------------------------------------------------------------------
269 :
270 : template <sal_uLong SRCFMT, sal_uLong DSTFMT>
271 0 : inline void ImplConvertLine( const TrueColorPixelPtr<DSTFMT>& rDst,
272 : const TrueColorPixelPtr<SRCFMT>& rSrc, int nPixelCount )
273 : {
274 0 : TrueColorPixelPtr<DSTFMT> aDst( rDst );
275 0 : TrueColorPixelPtr<SRCFMT> aSrc( rSrc );
276 0 : while( --nPixelCount >= 0 )
277 : {
278 0 : ImplConvertPixel( aDst, aSrc );
279 0 : ++aSrc;
280 0 : ++aDst;
281 : }
282 0 : }
283 :
284 : // =======================================================================
285 : // alpha blending truecolor pixels
286 :
287 : template <unsigned ALPHABITS, sal_uLong SRCFMT, sal_uLong DSTFMT>
288 0 : inline void ImplBlendPixels( const TrueColorPixelPtr<DSTFMT>& rDst,
289 : const TrueColorPixelPtr<SRCFMT>& rSrc, unsigned nAlphaVal )
290 : {
291 0 : if( !nAlphaVal )
292 0 : ImplConvertPixel( rDst, rSrc );
293 0 : else if( nAlphaVal != ~(~0 << ALPHABITS) )
294 : {
295 : static const unsigned nAlphaShift = (ALPHABITS > 8) ? 8 : ALPHABITS;
296 : if( ALPHABITS > nAlphaShift )
297 : nAlphaVal >>= ALPHABITS - nAlphaShift;
298 :
299 0 : int nR = rDst.GetRed();
300 0 : int nS = rSrc.GetRed();
301 0 : nR = nS + (((nR - nS) * nAlphaVal) >> nAlphaShift);
302 :
303 0 : int nG = rDst.GetGreen();
304 0 : nS = rSrc.GetGreen();
305 0 : nG = nS + (((nG - nS) * nAlphaVal) >> nAlphaShift);
306 :
307 0 : int nB = rDst.GetBlue();
308 0 : nS = rSrc.GetBlue();
309 0 : nB = nS + (((nB - nS) * nAlphaVal) >> nAlphaShift);
310 :
311 0 : rDst.SetColor( sal::static_int_cast<PIXBYTE>(nR),
312 : sal::static_int_cast<PIXBYTE>(nG),
313 : sal::static_int_cast<PIXBYTE>(nB) );
314 : }
315 0 : }
316 :
317 : // -----------------------------------------------------------------------
318 :
319 : template <unsigned ALPHABITS, sal_uLong MASKFMT, sal_uLong SRCFMT, sal_uLong DSTFMT>
320 0 : inline void ImplBlendLines( const TrueColorPixelPtr<DSTFMT>& rDst,
321 : const TrueColorPixelPtr<SRCFMT>& rSrc, const TrueColorPixelPtr<MASKFMT>& rMsk,
322 : int nPixelCount )
323 : {
324 0 : TrueColorPixelPtr<MASKFMT> aMsk( rMsk );
325 0 : TrueColorPixelPtr<DSTFMT> aDst( rDst );
326 0 : TrueColorPixelPtr<SRCFMT> aSrc( rSrc );
327 0 : while( --nPixelCount >= 0 )
328 : {
329 0 : ImplBlendPixels<ALPHABITS>( aDst, aSrc, aMsk.GetAlpha() );
330 0 : ++aDst;
331 0 : ++aSrc;
332 0 : ++aMsk;
333 : }
334 0 : }
335 :
336 : // -----------------------------------------------------------------------
337 :
338 : template <unsigned ALPHABITS, sal_uLong SRCFMT, sal_uLong DSTFMT>
339 : inline void ImplBlendLines( const TrueColorPixelPtr<DSTFMT>& rDst,
340 : const TrueColorPixelPtr<SRCFMT>& rSrc, unsigned nAlphaVal,
341 : int nPixelCount )
342 : {
343 : if( nAlphaVal == ~(~0 << ALPHABITS) )
344 : ImplConvertLine( rDst, rSrc, nPixelCount );
345 : else if( nAlphaVal )
346 : {
347 : TrueColorPixelPtr<SRCFMT> aSrc( rSrc );
348 : TrueColorPixelPtr<DSTFMT> aDst( rDst );
349 : while( --nPixelCount >= 0 )
350 : {
351 : ImplBlendPixels<ALPHABITS>( aDst, aSrc, nAlphaVal );
352 : ++aDst;
353 : ++aSrc;
354 : }
355 : }
356 : }
357 :
358 : // =======================================================================
359 :
360 0 : static bool ImplCopyImage( BitmapBuffer& rDstBuffer, const BitmapBuffer& rSrcBuffer )
361 : {
362 0 : const int nSrcLinestep = rSrcBuffer.mnScanlineSize;
363 0 : int nDstLinestep = rDstBuffer.mnScanlineSize;
364 :
365 0 : const PIXBYTE* pRawSrc = rSrcBuffer.mpBits;
366 0 : PIXBYTE* pRawDst = rDstBuffer.mpBits;
367 :
368 : // source and destination don't match upside down
369 0 : if( BMP_FORMAT_TOP_DOWN & (rSrcBuffer.mnFormat ^ rDstBuffer.mnFormat) )
370 : {
371 0 : pRawDst += (rSrcBuffer.mnHeight - 1) * nDstLinestep;
372 0 : nDstLinestep = -rDstBuffer.mnScanlineSize;
373 : }
374 0 : else if( nSrcLinestep == nDstLinestep )
375 : {
376 0 : memcpy( pRawDst, pRawSrc, rSrcBuffer.mnHeight * nDstLinestep );
377 0 : return true;
378 : }
379 :
380 0 : int nByteWidth = nSrcLinestep;
381 0 : if( nByteWidth > rDstBuffer.mnScanlineSize )
382 0 : nByteWidth = rDstBuffer.mnScanlineSize;
383 :
384 0 : for( int y = rSrcBuffer.mnHeight; --y >= 0; )
385 : {
386 0 : memcpy( pRawDst, pRawSrc, nByteWidth );
387 0 : pRawSrc += nSrcLinestep;
388 0 : pRawDst += nDstLinestep;
389 : }
390 :
391 0 : return true;
392 : }
393 :
394 : // -----------------------------------------------------------------------
395 :
396 : template <sal_uLong DSTFMT,sal_uLong SRCFMT>
397 0 : bool ImplConvertToBitmap( TrueColorPixelPtr<SRCFMT>& rSrcLine,
398 : BitmapBuffer& rDstBuffer, const BitmapBuffer& rSrcBuffer )
399 : {
400 : // help the compiler to avoid instantiations of unneeded conversions
401 : DBG_ASSERT( SRCFMT != DSTFMT, "ImplConvertToBitmap into same format");
402 : if( SRCFMT == DSTFMT )
403 0 : return false;
404 :
405 0 : const int nSrcLinestep = rSrcBuffer.mnScanlineSize;
406 0 : int nDstLinestep = rDstBuffer.mnScanlineSize;
407 :
408 0 : TrueColorPixelPtr<DSTFMT> aDstLine; aDstLine.SetRawPtr( rDstBuffer.mpBits );
409 :
410 : // source and destination don't match upside down
411 0 : if( BMP_FORMAT_TOP_DOWN & (rSrcBuffer.mnFormat ^ rDstBuffer.mnFormat) )
412 : {
413 0 : aDstLine.AddByteOffset( (rSrcBuffer.mnHeight - 1) * nDstLinestep );
414 0 : nDstLinestep = -nDstLinestep;
415 : }
416 :
417 0 : for( int y = rSrcBuffer.mnHeight; --y >= 0; )
418 : {
419 0 : ImplConvertLine( aDstLine, rSrcLine, rSrcBuffer.mnWidth );
420 0 : rSrcLine.AddByteOffset( nSrcLinestep );
421 0 : aDstLine.AddByteOffset( nDstLinestep );
422 : }
423 :
424 0 : return true;
425 : }
426 :
427 : // -----------------------------------------------------------------------
428 :
429 : template <sal_uLong SRCFMT>
430 0 : inline bool ImplConvertFromBitmap( BitmapBuffer& rDst, const BitmapBuffer& rSrc )
431 : {
432 0 : TrueColorPixelPtr<SRCFMT> aSrcType; aSrcType.SetRawPtr( rSrc.mpBits );
433 :
434 : // select the matching instantiation for the destination's bitmap format
435 0 : switch( rDst.mnFormat & ~BMP_FORMAT_TOP_DOWN )
436 : {
437 : case BMP_FORMAT_1BIT_MSB_PAL:
438 : case BMP_FORMAT_1BIT_LSB_PAL:
439 : case BMP_FORMAT_4BIT_MSN_PAL:
440 : case BMP_FORMAT_4BIT_LSN_PAL:
441 : case BMP_FORMAT_8BIT_PAL:
442 0 : break;
443 :
444 : case BMP_FORMAT_8BIT_TC_MASK:
445 : // return ImplConvertToBitmap<BMP_FORMAT_8BIT_TC_MASK>( aSrcType, rDst, rSrc );
446 : case BMP_FORMAT_24BIT_TC_MASK:
447 : // return ImplConvertToBitmap<BMP_FORMAT_24BIT_TC_MASK>( aSrcType, rDst, rSrc );
448 : case BMP_FORMAT_32BIT_TC_MASK:
449 : // return ImplConvertToBitmap<BMP_FORMAT_32BIT_TC_MASK>( aSrcType, rDst, rSrc );
450 0 : break;
451 :
452 : case BMP_FORMAT_16BIT_TC_MSB_MASK:
453 0 : return ImplConvertToBitmap<BMP_FORMAT_16BIT_TC_MSB_MASK>( aSrcType, rDst, rSrc );
454 : case BMP_FORMAT_16BIT_TC_LSB_MASK:
455 0 : return ImplConvertToBitmap<BMP_FORMAT_16BIT_TC_LSB_MASK>( aSrcType, rDst, rSrc );
456 :
457 : case BMP_FORMAT_24BIT_TC_BGR:
458 0 : return ImplConvertToBitmap<BMP_FORMAT_24BIT_TC_BGR>( aSrcType, rDst, rSrc );
459 : case BMP_FORMAT_24BIT_TC_RGB:
460 0 : return ImplConvertToBitmap<BMP_FORMAT_24BIT_TC_RGB>( aSrcType, rDst, rSrc );
461 :
462 : case BMP_FORMAT_32BIT_TC_ABGR:
463 0 : return ImplConvertToBitmap<BMP_FORMAT_32BIT_TC_ABGR>( aSrcType, rDst, rSrc );
464 : #ifdef FAST_ARGB_BGRA
465 : case BMP_FORMAT_32BIT_TC_ARGB:
466 0 : return ImplConvertToBitmap<BMP_FORMAT_32BIT_TC_ARGB>( aSrcType, rDst, rSrc );
467 : case BMP_FORMAT_32BIT_TC_BGRA:
468 0 : return ImplConvertToBitmap<BMP_FORMAT_32BIT_TC_BGRA>( aSrcType, rDst, rSrc );
469 : #endif
470 : case BMP_FORMAT_32BIT_TC_RGBA:
471 0 : return ImplConvertToBitmap<BMP_FORMAT_32BIT_TC_RGBA>( aSrcType, rDst, rSrc );
472 : }
473 :
474 : #ifdef DEBUG
475 : static int nNotAccelerated = 0;
476 : if( rSrc.mnWidth * rSrc.mnHeight >= 4000 )
477 : if( ++nNotAccelerated == 100 )
478 : {
479 : int foo = 0; (void)foo; // so no warning is created when building on pro with debug
480 : DBG_WARNING2( "ImplConvertFromBitmap for not accelerated case (0x%04X->0x%04X)",
481 : rSrc.mnFormat, rDst.mnFormat );
482 : }
483 : #endif
484 :
485 0 : return false;
486 : }
487 :
488 : // =======================================================================
489 :
490 : // an universal stretching conversion is overkill in most common situations
491 : // => performance benefits for speeding up the non-stretching cases
492 0 : bool ImplFastBitmapConversion( BitmapBuffer& rDst, const BitmapBuffer& rSrc,
493 : const SalTwoRect& rTR )
494 : {
495 : // horizontal mirroring not implemented yet
496 0 : if( rTR.mnDestWidth < 0 )
497 0 : return false;
498 : // vertical mirroring
499 0 : if( rTR.mnDestHeight < 0 )
500 : // TODO: rDst.mnFormat ^= BMP_FORMAT_TOP_DOWN;
501 0 : return false;
502 :
503 : // offseted conversion is not implemented yet
504 0 : if( rTR.mnSrcX || rTR.mnSrcY )
505 0 : return false;
506 0 : if( rTR.mnDestX || rTR.mnDestY )
507 0 : return false;
508 :
509 : // stretched conversion is not implemented yet
510 0 : if( rTR.mnDestWidth != rTR.mnSrcWidth )
511 0 : return false;
512 0 : if( rTR.mnDestHeight!= rTR.mnSrcHeight )
513 0 : return false;
514 :
515 : // check source image size
516 0 : if( rSrc.mnWidth < rTR.mnSrcX + rTR.mnSrcWidth )
517 0 : return false;
518 0 : if( rSrc.mnHeight < rTR.mnSrcY + rTR.mnSrcHeight )
519 0 : return false;
520 :
521 : // check dest image size
522 0 : if( rDst.mnWidth < rTR.mnDestX + rTR.mnDestWidth )
523 0 : return false;
524 0 : if( rDst.mnHeight < rTR.mnDestY + rTR.mnDestHeight )
525 0 : return false;
526 :
527 0 : const sal_uLong nSrcFormat = rSrc.mnFormat & ~BMP_FORMAT_TOP_DOWN;
528 0 : const sal_uLong nDstFormat = rDst.mnFormat & ~BMP_FORMAT_TOP_DOWN;
529 :
530 : // TODO: also implement conversions for 16bit colormasks with non-565 format
531 0 : if( nSrcFormat & (BMP_FORMAT_16BIT_TC_LSB_MASK | BMP_FORMAT_16BIT_TC_MSB_MASK) )
532 0 : if( rSrc.maColorMask.GetRedMask() != 0xF800
533 0 : || rSrc.maColorMask.GetGreenMask()!= 0x07E0
534 0 : || rSrc.maColorMask.GetBlueMask() != 0x001F )
535 0 : return false;
536 0 : if( nDstFormat & (BMP_FORMAT_16BIT_TC_LSB_MASK | BMP_FORMAT_16BIT_TC_MSB_MASK) )
537 0 : if( rDst.maColorMask.GetRedMask() != 0xF800
538 0 : || rDst.maColorMask.GetGreenMask()!= 0x07E0
539 0 : || rDst.maColorMask.GetBlueMask() != 0x001F )
540 0 : return false;
541 :
542 : // special handling of trivial cases
543 0 : if( nSrcFormat == nDstFormat )
544 : {
545 : // accelerated palette conversions not yet implemented
546 0 : if( rSrc.maPalette != rDst.maPalette )
547 0 : return false;
548 0 : return ImplCopyImage( rDst, rSrc );
549 : }
550 :
551 : // select the matching instantiation for the source's bitmap format
552 0 : switch( nSrcFormat )
553 : {
554 : case BMP_FORMAT_1BIT_MSB_PAL:
555 : case BMP_FORMAT_1BIT_LSB_PAL:
556 : case BMP_FORMAT_4BIT_MSN_PAL:
557 : case BMP_FORMAT_4BIT_LSN_PAL:
558 : case BMP_FORMAT_8BIT_PAL:
559 0 : break;
560 :
561 : case BMP_FORMAT_8BIT_TC_MASK:
562 : // return ImplConvertFromBitmap<BMP_FORMAT_8BIT_TC_MASK>( rDst, rSrc );
563 : case BMP_FORMAT_24BIT_TC_MASK:
564 : // return ImplConvertFromBitmap<BMP_FORMAT_24BIT_TC_MASK>( rDst, rSrc );
565 : case BMP_FORMAT_32BIT_TC_MASK:
566 : // return ImplConvertFromBitmap<BMP_FORMAT_32BIT_TC_MASK>( rDst, rSrc );
567 0 : break;
568 :
569 : case BMP_FORMAT_16BIT_TC_MSB_MASK:
570 0 : return ImplConvertFromBitmap<BMP_FORMAT_16BIT_TC_MSB_MASK>( rDst, rSrc );
571 : case BMP_FORMAT_16BIT_TC_LSB_MASK:
572 0 : return ImplConvertFromBitmap<BMP_FORMAT_16BIT_TC_LSB_MASK>( rDst, rSrc );
573 :
574 : case BMP_FORMAT_24BIT_TC_BGR:
575 0 : return ImplConvertFromBitmap<BMP_FORMAT_24BIT_TC_BGR>( rDst, rSrc );
576 : case BMP_FORMAT_24BIT_TC_RGB:
577 0 : return ImplConvertFromBitmap<BMP_FORMAT_24BIT_TC_RGB>( rDst, rSrc );
578 :
579 : case BMP_FORMAT_32BIT_TC_ABGR:
580 0 : return ImplConvertFromBitmap<BMP_FORMAT_32BIT_TC_ABGR>( rDst, rSrc );
581 : #ifdef FAST_ARGB_BGRA
582 : case BMP_FORMAT_32BIT_TC_ARGB:
583 0 : return ImplConvertFromBitmap<BMP_FORMAT_32BIT_TC_ARGB>( rDst, rSrc );
584 : case BMP_FORMAT_32BIT_TC_BGRA:
585 0 : return ImplConvertFromBitmap<BMP_FORMAT_32BIT_TC_BGRA>( rDst, rSrc );
586 : #endif
587 : case BMP_FORMAT_32BIT_TC_RGBA:
588 0 : return ImplConvertFromBitmap<BMP_FORMAT_32BIT_TC_RGBA>( rDst, rSrc );
589 : }
590 :
591 : #ifdef DEBUG
592 : static int nNotAccelerated = 0;
593 : if( rSrc.mnWidth * rSrc.mnHeight >= 4000 )
594 : {
595 : if( ++nNotAccelerated == 100 )
596 : {
597 : int foo = 0; (void)foo; // so no warning is created when building on pro with debug
598 : DBG_WARNING2( "ImplFastBitmapConversion for not accelerated case (0x%04X->0x%04X)", rSrc.mnFormat, rDst.mnFormat );
599 : }
600 : }
601 : #endif
602 :
603 0 : return false;
604 : }
605 :
606 : // =======================================================================
607 :
608 : template <sal_uLong DSTFMT,sal_uLong SRCFMT> //,sal_uLong MSKFMT>
609 0 : bool ImplBlendToBitmap( TrueColorPixelPtr<SRCFMT>& rSrcLine,
610 : BitmapBuffer& rDstBuffer, const BitmapBuffer& rSrcBuffer,
611 : const BitmapBuffer& rMskBuffer )
612 : {
613 : //DBG_ASSERT( rMskBuffer.mnFormat == MSKFMT, "FastBmp BlendImage: wrong MSKFMT" );
614 : DBG_ASSERT( rMskBuffer.mnFormat == BMP_FORMAT_8BIT_PAL, "FastBmp BlendImage: unusual MSKFMT" );
615 :
616 0 : const int nSrcLinestep = rSrcBuffer.mnScanlineSize;
617 0 : int nMskLinestep = rMskBuffer.mnScanlineSize;
618 0 : int nDstLinestep = rDstBuffer.mnScanlineSize;
619 :
620 0 : TrueColorPixelPtr<BMP_FORMAT_8BIT_PAL> aMskLine; aMskLine.SetRawPtr( rMskBuffer.mpBits );
621 0 : TrueColorPixelPtr<DSTFMT> aDstLine; aDstLine.SetRawPtr( rDstBuffer.mpBits );
622 :
623 : // special case for single line masks
624 0 : if( rMskBuffer.mnHeight == 1 )
625 0 : nMskLinestep = 0;
626 :
627 : // source and mask don't match: upside down
628 0 : if( (rSrcBuffer.mnFormat ^ rMskBuffer.mnFormat) & BMP_FORMAT_TOP_DOWN )
629 : {
630 0 : aMskLine.AddByteOffset( (rSrcBuffer.mnHeight - 1) * nMskLinestep );
631 0 : nMskLinestep = -nMskLinestep;
632 : }
633 :
634 : // source and destination don't match: upside down
635 0 : if( (rSrcBuffer.mnFormat ^ rDstBuffer.mnFormat) & BMP_FORMAT_TOP_DOWN )
636 : {
637 0 : aDstLine.AddByteOffset( (rSrcBuffer.mnHeight - 1) * nDstLinestep );
638 0 : nDstLinestep = -nDstLinestep;
639 : }
640 :
641 0 : for( int y = rSrcBuffer.mnHeight; --y >= 0; )
642 : {
643 0 : ImplBlendLines<8>( aDstLine, rSrcLine, aMskLine, rDstBuffer.mnWidth );
644 0 : aDstLine.AddByteOffset( nDstLinestep );
645 0 : rSrcLine.AddByteOffset( nSrcLinestep );
646 0 : aMskLine.AddByteOffset( nMskLinestep );
647 : }
648 :
649 0 : return true;
650 : }
651 :
652 : // some specializations to reduce the code size
653 : template <>
654 0 : inline bool ImplBlendToBitmap<BMP_FORMAT_24BIT_TC_BGR,BMP_FORMAT_24BIT_TC_BGR>(
655 : TrueColorPixelPtr<BMP_FORMAT_24BIT_TC_BGR>&,
656 : BitmapBuffer& rDstBuffer, const BitmapBuffer& rSrcBuffer,
657 : const BitmapBuffer& rMskBuffer )
658 : {
659 0 : TrueColorPixelPtr<BMP_FORMAT_24BIT_TC_RGB> aSrcType; aSrcType.SetRawPtr( rSrcBuffer.mpBits );
660 0 : return ImplBlendToBitmap<BMP_FORMAT_24BIT_TC_RGB>( aSrcType, rDstBuffer, rSrcBuffer, rMskBuffer );
661 : }
662 :
663 : template <>
664 0 : inline bool ImplBlendToBitmap<BMP_FORMAT_32BIT_TC_ABGR,BMP_FORMAT_32BIT_TC_ABGR>(
665 : TrueColorPixelPtr<BMP_FORMAT_32BIT_TC_ABGR>&,
666 : BitmapBuffer& rDstBuffer, const BitmapBuffer& rSrcBuffer,
667 : const BitmapBuffer& rMskBuffer )
668 : {
669 0 : TrueColorPixelPtr<BMP_FORMAT_32BIT_TC_ARGB> aSrcType; aSrcType.SetRawPtr( rSrcBuffer.mpBits );
670 0 : return ImplBlendToBitmap<BMP_FORMAT_32BIT_TC_ARGB>( aSrcType, rDstBuffer, rSrcBuffer, rMskBuffer );
671 : }
672 :
673 : template <>
674 0 : inline bool ImplBlendToBitmap<BMP_FORMAT_32BIT_TC_BGRA,BMP_FORMAT_32BIT_TC_BGRA>(
675 : TrueColorPixelPtr<BMP_FORMAT_32BIT_TC_BGRA>&,
676 : BitmapBuffer& rDstBuffer, const BitmapBuffer& rSrcBuffer,
677 : const BitmapBuffer& rMskBuffer )
678 : {
679 0 : TrueColorPixelPtr<BMP_FORMAT_32BIT_TC_RGBA> aSrcType; aSrcType.SetRawPtr( rSrcBuffer.mpBits );
680 0 : return ImplBlendToBitmap<BMP_FORMAT_32BIT_TC_RGBA>( aSrcType, rDstBuffer, rSrcBuffer, rMskBuffer );
681 : }
682 :
683 : // -----------------------------------------------------------------------
684 :
685 : template <sal_uLong SRCFMT>
686 0 : bool ImplBlendFromBitmap( BitmapBuffer& rDst, const BitmapBuffer& rSrc, const BitmapBuffer& rMsk )
687 : {
688 0 : TrueColorPixelPtr<SRCFMT> aSrcType; aSrcType.SetRawPtr( rSrc.mpBits );
689 :
690 : // select the matching instantiation for the destination's bitmap format
691 0 : switch( rDst.mnFormat & ~BMP_FORMAT_TOP_DOWN )
692 : {
693 : case BMP_FORMAT_1BIT_MSB_PAL:
694 : case BMP_FORMAT_1BIT_LSB_PAL:
695 : case BMP_FORMAT_4BIT_MSN_PAL:
696 : case BMP_FORMAT_4BIT_LSN_PAL:
697 : case BMP_FORMAT_8BIT_PAL:
698 0 : break;
699 :
700 : case BMP_FORMAT_8BIT_TC_MASK:
701 : // return ImplBlendToBitmap<BMP_FORMAT_8BIT_TC_MASK>( aSrcType, rDst, rSrc, rMsk );
702 : case BMP_FORMAT_24BIT_TC_MASK:
703 : // return ImplBlendToBitmap<BMP_FORMAT_24BIT_TC_MASK>( aSrcType, rDst, rSrc, rMsk );
704 : case BMP_FORMAT_32BIT_TC_MASK:
705 : // return ImplBlendToBitmap<BMP_FORMAT_32BIT_TC_MASK>( aSrcType, rDst, rSrc, rMsk );
706 0 : break;
707 :
708 : case BMP_FORMAT_16BIT_TC_MSB_MASK:
709 0 : return ImplBlendToBitmap<BMP_FORMAT_16BIT_TC_MSB_MASK>( aSrcType, rDst, rSrc, rMsk );
710 : case BMP_FORMAT_16BIT_TC_LSB_MASK:
711 0 : return ImplBlendToBitmap<BMP_FORMAT_16BIT_TC_LSB_MASK>( aSrcType, rDst, rSrc, rMsk );
712 :
713 : case BMP_FORMAT_24BIT_TC_BGR:
714 0 : return ImplBlendToBitmap<BMP_FORMAT_24BIT_TC_BGR>( aSrcType, rDst, rSrc, rMsk );
715 : case BMP_FORMAT_24BIT_TC_RGB:
716 0 : return ImplBlendToBitmap<BMP_FORMAT_24BIT_TC_RGB>( aSrcType, rDst, rSrc, rMsk );
717 :
718 : case BMP_FORMAT_32BIT_TC_ABGR:
719 0 : return ImplBlendToBitmap<BMP_FORMAT_32BIT_TC_ABGR>( aSrcType, rDst, rSrc, rMsk );
720 : #ifdef FAST_ARGB_BGRA
721 : case BMP_FORMAT_32BIT_TC_ARGB:
722 0 : return ImplBlendToBitmap<BMP_FORMAT_32BIT_TC_ARGB>( aSrcType, rDst, rSrc, rMsk );
723 : case BMP_FORMAT_32BIT_TC_BGRA:
724 0 : return ImplBlendToBitmap<BMP_FORMAT_32BIT_TC_BGRA>( aSrcType, rDst, rSrc, rMsk );
725 : #endif
726 : case BMP_FORMAT_32BIT_TC_RGBA:
727 0 : return ImplBlendToBitmap<BMP_FORMAT_32BIT_TC_RGBA>( aSrcType, rDst, rSrc, rMsk );
728 : }
729 :
730 : #ifdef DEBUG
731 : static int nNotAccelerated = 0;
732 : if( rSrc.mnWidth * rSrc.mnHeight >= 4000 )
733 : if( ++nNotAccelerated == 100 )
734 : {
735 : int foo = 0; (void)foo; // so no warning is created when building on pro with debug
736 : DBG_WARNING3( "ImplBlendFromBitmap for not accelerated case (0x%04X*0x%04X->0x%04X)",
737 : rSrc.mnFormat, rMsk.mnFormat, rDst.mnFormat );
738 : }
739 : #endif
740 :
741 0 : return false;
742 : }
743 :
744 : // -----------------------------------------------------------------------
745 :
746 2 : bool ImplFastBitmapBlending( BitmapWriteAccess& rDstWA,
747 : const BitmapReadAccess& rSrcRA, const BitmapReadAccess& rMskRA,
748 : const SalTwoRect& rTR )
749 : {
750 : // accelerated blending of paletted bitmaps not implemented yet
751 2 : if( rSrcRA.HasPalette() )
752 2 : return false;
753 0 : if( rDstWA.HasPalette() )
754 0 : return false;
755 : // TODO: either get rid of mask's use of 8BIT_PAL or check the palette
756 :
757 : // horizontal mirroring not implemented yet
758 0 : if( rTR.mnDestWidth < 0 )
759 0 : return false;
760 : // vertical mirroring
761 0 : if( rTR.mnDestHeight < 0 )
762 : // TODO: rDst.mnFormat ^= BMP_FORMAT_TOP_DOWN;
763 0 : return false;
764 :
765 : // offseted blending is not implemented yet
766 0 : if( rTR.mnSrcX || rTR.mnSrcY )
767 0 : return false;
768 0 : if( rTR.mnDestX || rTR.mnDestY )
769 0 : return false;
770 :
771 : // stretched blending is not implemented yet
772 0 : if( rTR.mnDestWidth != rTR.mnSrcWidth )
773 0 : return false;
774 0 : if( rTR.mnDestHeight!= rTR.mnSrcHeight )
775 0 : return false;
776 :
777 : // check source image size
778 0 : if( rSrcRA.Width() < rTR.mnSrcX + rTR.mnSrcWidth )
779 0 : return false;
780 0 : if( rSrcRA.Height() < rTR.mnSrcY + rTR.mnSrcHeight )
781 0 : return false;
782 :
783 : // check mask image size
784 0 : if( rMskRA.Width() < rTR.mnSrcX + rTR.mnSrcWidth )
785 0 : return false;
786 0 : if( rMskRA.Height() < rTR.mnSrcY + rTR.mnSrcHeight )
787 0 : if( rMskRA.Height() != 1 )
788 0 : return false;
789 :
790 : // check dest image size
791 0 : if( rDstWA.Width() < rTR.mnDestX + rTR.mnDestWidth )
792 0 : return false;
793 0 : if( rDstWA.Height() < rTR.mnDestY + rTR.mnDestHeight )
794 0 : return false;
795 :
796 0 : BitmapBuffer& rDst = *rDstWA.ImplGetBitmapBuffer();
797 0 : const BitmapBuffer& rSrc = *rSrcRA.ImplGetBitmapBuffer();
798 0 : const BitmapBuffer& rMsk = *rMskRA.ImplGetBitmapBuffer();
799 :
800 0 : const sal_uLong nSrcFormat = rSrc.mnFormat & ~BMP_FORMAT_TOP_DOWN;
801 0 : const sal_uLong nDstFormat = rDst.mnFormat & ~BMP_FORMAT_TOP_DOWN;
802 :
803 : // accelerated conversions for 16bit colormasks with non-565 format are not yet implemented
804 0 : if( nSrcFormat & (BMP_FORMAT_16BIT_TC_LSB_MASK | BMP_FORMAT_16BIT_TC_MSB_MASK) )
805 0 : if( rSrc.maColorMask.GetRedMask() != 0xF800
806 0 : || rSrc.maColorMask.GetGreenMask()!= 0x07E0
807 0 : || rSrc.maColorMask.GetBlueMask() != 0x001F)
808 0 : return false;
809 0 : if( nDstFormat & (BMP_FORMAT_16BIT_TC_LSB_MASK | BMP_FORMAT_16BIT_TC_MSB_MASK) )
810 0 : if( rDst.maColorMask.GetRedMask() != 0xF800
811 0 : || rDst.maColorMask.GetGreenMask()!= 0x07E0
812 0 : || rDst.maColorMask.GetBlueMask() != 0x001F)
813 0 : return false;
814 :
815 : // select the matching instantiation for the source's bitmap format
816 0 : switch( nSrcFormat )
817 : {
818 : case BMP_FORMAT_1BIT_MSB_PAL:
819 : case BMP_FORMAT_1BIT_LSB_PAL:
820 : case BMP_FORMAT_4BIT_MSN_PAL:
821 : case BMP_FORMAT_4BIT_LSN_PAL:
822 : case BMP_FORMAT_8BIT_PAL:
823 0 : break;
824 :
825 : case BMP_FORMAT_8BIT_TC_MASK:
826 : // return ImplBlendFromBitmap<BMP_FORMAT_8BIT_TC_MASK>( rDst, rSrc );
827 : case BMP_FORMAT_24BIT_TC_MASK:
828 : // return ImplBlendFromBitmap<BMP_FORMAT_24BIT_TC_MASK>( rDst, rSrc );
829 : case BMP_FORMAT_32BIT_TC_MASK:
830 : // return ImplBlendFromBitmap<BMP_FORMAT_32BIT_TC_MASK>( rDst, rSrc );
831 0 : break;
832 :
833 : case BMP_FORMAT_16BIT_TC_MSB_MASK:
834 0 : return ImplBlendFromBitmap<BMP_FORMAT_16BIT_TC_MSB_MASK>( rDst, rSrc, rMsk );
835 : case BMP_FORMAT_16BIT_TC_LSB_MASK:
836 0 : return ImplBlendFromBitmap<BMP_FORMAT_16BIT_TC_LSB_MASK>( rDst, rSrc, rMsk );
837 :
838 : case BMP_FORMAT_24BIT_TC_BGR:
839 0 : return ImplBlendFromBitmap<BMP_FORMAT_24BIT_TC_BGR>( rDst, rSrc, rMsk );
840 : case BMP_FORMAT_24BIT_TC_RGB:
841 0 : return ImplBlendFromBitmap<BMP_FORMAT_24BIT_TC_RGB>( rDst, rSrc, rMsk );
842 :
843 : case BMP_FORMAT_32BIT_TC_ABGR:
844 0 : return ImplBlendFromBitmap<BMP_FORMAT_32BIT_TC_ABGR>( rDst, rSrc, rMsk );
845 : #ifdef FAST_ARGB_BGRA
846 : case BMP_FORMAT_32BIT_TC_ARGB:
847 0 : return ImplBlendFromBitmap<BMP_FORMAT_32BIT_TC_ARGB>( rDst, rSrc, rMsk );
848 : case BMP_FORMAT_32BIT_TC_BGRA:
849 0 : return ImplBlendFromBitmap<BMP_FORMAT_32BIT_TC_BGRA>( rDst, rSrc, rMsk );
850 : #endif
851 : case BMP_FORMAT_32BIT_TC_RGBA:
852 0 : return ImplBlendFromBitmap<BMP_FORMAT_32BIT_TC_RGBA>( rDst, rSrc, rMsk );
853 : }
854 :
855 : #ifdef DEBUG
856 : static int nNotAccelerated = 0;
857 : if( rSrc.mnWidth * rSrc.mnHeight >= 4000 )
858 : if( ++nNotAccelerated == 100 )
859 : {
860 : int foo = 0; (void)foo; // so no warning is created when building on pro with debug
861 : DBG_WARNING3( "ImplFastBlend for not accelerated case (0x%04X*0x%04X->0x%04X)",
862 : rSrc.mnFormat, rMsk.mnFormat, rDst.mnFormat );
863 : }
864 : #endif
865 :
866 0 : return false;
867 : }
868 :
869 8 : bool ImplFastEraseBitmap( BitmapBuffer& rDst, const BitmapColor& rColor )
870 : {
871 8 : const sal_uLong nDstFormat = rDst.mnFormat & ~BMP_FORMAT_TOP_DOWN;
872 :
873 : // erasing a bitmap is often just a byte-wise memory fill
874 8 : bool bByteFill = true;
875 : sal_uInt8 nFillByte;
876 :
877 8 : switch( nDstFormat )
878 : {
879 : case BMP_FORMAT_1BIT_MSB_PAL:
880 : case BMP_FORMAT_1BIT_LSB_PAL:
881 3 : nFillByte = rColor.GetIndex();
882 3 : nFillByte = static_cast<sal_uInt8>( -(nFillByte & 1) ); // 0x00 or 0xFF
883 3 : break;
884 : case BMP_FORMAT_4BIT_MSN_PAL:
885 : case BMP_FORMAT_4BIT_LSN_PAL:
886 0 : nFillByte = rColor.GetIndex();
887 0 : nFillByte &= 0x0F;
888 0 : nFillByte |= (nFillByte << 4);
889 0 : break;
890 : case BMP_FORMAT_8BIT_PAL:
891 : case BMP_FORMAT_8BIT_TC_MASK:
892 1 : nFillByte = rColor.GetIndex();
893 1 : break;
894 :
895 : case BMP_FORMAT_24BIT_TC_MASK:
896 : case BMP_FORMAT_24BIT_TC_BGR:
897 : case BMP_FORMAT_24BIT_TC_RGB:
898 4 : nFillByte = rColor.GetRed();
899 8 : if( (nFillByte != rColor.GetGreen())
900 4 : || (nFillByte != rColor.GetBlue()) )
901 0 : bByteFill = false;
902 4 : break;
903 :
904 : default:
905 0 : bByteFill = false;
906 0 : nFillByte = 0x00;
907 0 : break;
908 : }
909 :
910 8 : if( bByteFill )
911 : {
912 8 : long nByteCount = rDst.mnHeight * rDst.mnScanlineSize;
913 8 : memset( rDst.mpBits, nFillByte, nByteCount );
914 8 : return true;
915 : }
916 :
917 : // TODO: handle other bitmap formats
918 0 : switch( nDstFormat )
919 : {
920 : case BMP_FORMAT_32BIT_TC_MASK:
921 : case BMP_FORMAT_16BIT_TC_MSB_MASK:
922 : case BMP_FORMAT_16BIT_TC_LSB_MASK:
923 :
924 : case BMP_FORMAT_24BIT_TC_BGR:
925 : case BMP_FORMAT_24BIT_TC_RGB:
926 :
927 : case BMP_FORMAT_32BIT_TC_ABGR:
928 : #ifdef FAST_ARGB_BGRA
929 : case BMP_FORMAT_32BIT_TC_ARGB:
930 : case BMP_FORMAT_32BIT_TC_BGRA:
931 : #endif
932 : case BMP_FORMAT_32BIT_TC_RGBA:
933 0 : break;
934 :
935 : default:
936 0 : break;
937 : }
938 :
939 0 : return false;
940 : }
941 :
942 : // =======================================================================
943 :
944 : #else // NO_OPTIMIZED_BITMAP_ACCESS
945 :
946 : bool ImplFastBitmapConversion( BitmapBuffer&, const BitmapBuffer& )
947 : {
948 : return false;
949 : }
950 :
951 : bool ImplFastBitmapBlending( BitmapWriteAccess&,
952 : const BitmapReadAccess&, const BitmapReadAccess&,
953 : const Size&, const Point& )
954 : {
955 : return false;
956 : }
957 :
958 : bool ImplFastEraseBitmap( BitmapBuffer&, const BitmapColor& )
959 : {
960 : return false;
961 : }
962 :
963 : #endif
964 :
965 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|