MCPcopy Create free account
hub / github.com/buggins/coolreader / OnLineDecoded

Method OnLineDecoded

crengine/src/lvdrawbuf.cpp:424–600  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

422 {
423 }
424 virtual bool OnLineDecoded( LVImageSource *, int y, lUInt32 * data )
425 {
426 //fprintf( stderr, "l_%d ", y );
427 int yy = y;
428 int yy2 = y+1;
429 if ( ymap )
430 {
431 int yy0 = (y - 1) * dst_dy / src_dy;
432 yy = y * dst_dy / src_dy;
433 yy2 = (y+1) * dst_dy / src_dy;
434 if ( yy == yy0 )
435 {
436 //fprintf( stderr, "skip_dup " );
437 //return true; // skip duplicate drawing
438 }
439 if ( yy2 > dst_dy )
440 yy2 = dst_dy;
441 }
442 lvRect clip;
443 dst->GetClipRect( &clip );
444 for ( ;yy<yy2; yy++ )
445 {
446 if ( yy+dst_y<clip.top || yy+dst_y>=clip.bottom )
447 continue;
448 int bpp = dst->GetBitsPerPixel();
449 if ( bpp >= 24 )
450 {
451 lUInt32 * row = (lUInt32 *)dst->GetScanLine( yy + dst_y );
452 row += dst_x;
453 for (int x=0; x<dst_dx; x++)
454 {
455 lUInt32 cl = data[xmap ? xmap[x] : x];
456 int xx = x + dst_x;
457 lUInt32 alpha = (cl >> 24)&0xFF;
458 if ( xx<clip.left || xx>=clip.right || alpha==0xFF )
459 continue;
460 if ( !alpha )
461 row[ x ] = cl;
462 else
463 ApplyAlphaRGB( row[x], cl, alpha );
464 }
465 }
466 else if ( bpp == 16 )
467 {
468 lUInt16 * row = (lUInt16 *)dst->GetScanLine( yy + dst_y );
469 row += dst_x;
470 for (int x=0; x<dst_dx; x++)
471 {
472 lUInt32 cl = data[xmap ? xmap[x] : x];
473 int xx = x + dst_x;
474 lUInt32 alpha = (cl >> 24)&0xFF;
475 if ( xx<clip.left || xx>=clip.right || alpha==0xFF )
476 continue;
477 if ( alpha<16 ) {
478 row[ x ] = rgb888to565( cl );
479 } else if (alpha<0xF0) {
480 lUInt32 v = rgb565to888(row[x]);
481 ApplyAlphaRGB( v, cl, alpha );

Callers

nothing calls this directly

Calls 11

ApplyAlphaRGBFunction · 0.85
rgb888to565Function · 0.85
rgb565to888Function · 0.85
DitherNBitColorFunction · 0.85
rgbToGrayFunction · 0.85
Dither2BitColorFunction · 0.85
rgbToGrayMaskFunction · 0.85
Dither1BitColorFunction · 0.85
GetClipRectMethod · 0.80
GetBitsPerPixelMethod · 0.80
GetScanLineMethod · 0.80

Tested by

no test coverage detected