comparison src/video/win32/SDL_gdirender.c @ 3055:cd863dd2082b

indent
author Sam Lantinga <slouken@libsdl.org>
date Sat, 07 Feb 2009 18:03:46 +0000
parents 8d93bfecb9dc
children a434fe6360df
comparison
equal deleted inserted replaced
3054:8d93bfecb9dc 3055:cd863dd2082b
476 case SDL_BLENDMODE_MASK: 476 case SDL_BLENDMODE_MASK:
477 case SDL_BLENDMODE_BLEND: 477 case SDL_BLENDMODE_BLEND:
478 if (!data->premultiplied && data->pixels) { 478 if (!data->premultiplied && data->pixels) {
479 switch (texture->format) { 479 switch (texture->format) {
480 case SDL_PIXELFORMAT_ARGB8888: 480 case SDL_PIXELFORMAT_ARGB8888:
481 SDL_PreMultiplyAlphaARGB8888(texture->w, texture->h, (Uint32 *)data->pixels, data->pitch); 481 SDL_PreMultiplyAlphaARGB8888(texture->w, texture->h,
482 (Uint32 *) data->pixels,
483 data->pitch);
482 data->premultiplied = SDL_TRUE; 484 data->premultiplied = SDL_TRUE;
483 break; 485 break;
484 case SDL_PIXELFORMAT_RGBA8888: 486 case SDL_PIXELFORMAT_RGBA8888:
485 SDL_PreMultiplyAlphaRGBA8888(texture->w, texture->h, (Uint32 *)data->pixels, data->pitch); 487 SDL_PreMultiplyAlphaRGBA8888(texture->w, texture->h,
488 (Uint32 *) data->pixels,
489 data->pitch);
486 data->premultiplied = SDL_TRUE; 490 data->premultiplied = SDL_TRUE;
487 break; 491 break;
488 case SDL_PIXELFORMAT_ABGR8888: 492 case SDL_PIXELFORMAT_ABGR8888:
489 SDL_PreMultiplyAlphaABGR8888(texture->w, texture->h, (Uint32 *)data->pixels, data->pitch); 493 SDL_PreMultiplyAlphaABGR8888(texture->w, texture->h,
494 (Uint32 *) data->pixels,
495 data->pitch);
490 data->premultiplied = SDL_TRUE; 496 data->premultiplied = SDL_TRUE;
491 break; 497 break;
492 case SDL_PIXELFORMAT_BGRA8888: 498 case SDL_PIXELFORMAT_BGRA8888:
493 SDL_PreMultiplyAlphaBGRA8888(texture->w, texture->h, (Uint32 *)data->pixels, data->pitch); 499 SDL_PreMultiplyAlphaBGRA8888(texture->w, texture->h,
500 (Uint32 *) data->pixels,
501 data->pitch);
494 data->premultiplied = SDL_TRUE; 502 data->premultiplied = SDL_TRUE;
495 break; 503 break;
496 } 504 }
497 } 505 }
498 return 0; 506 return 0;
552 SDL_memcpy(dst, src, length); 560 SDL_memcpy(dst, src, length);
553 src += pitch; 561 src += pitch;
554 dst += data->pitch; 562 dst += data->pitch;
555 } 563 }
556 if (data->premultiplied) { 564 if (data->premultiplied) {
557 Uint32 *pixels = (Uint32 *) data->pixels + rect->y * (data->pitch / 4) + rect->x; 565 Uint32 *pixels =
566 (Uint32 *) data->pixels + rect->y * (data->pitch / 4) +
567 rect->x;
558 switch (texture->format) { 568 switch (texture->format) {
559 case SDL_PIXELFORMAT_ARGB8888: 569 case SDL_PIXELFORMAT_ARGB8888:
560 SDL_PreMultiplyAlphaARGB8888(rect->w, rect->h, pixels, data->pitch); 570 SDL_PreMultiplyAlphaARGB8888(rect->w, rect->h, pixels,
571 data->pitch);
561 break; 572 break;
562 case SDL_PIXELFORMAT_RGBA8888: 573 case SDL_PIXELFORMAT_RGBA8888:
563 SDL_PreMultiplyAlphaRGBA8888(rect->w, rect->h, pixels, data->pitch); 574 SDL_PreMultiplyAlphaRGBA8888(rect->w, rect->h, pixels,
575 data->pitch);
564 break; 576 break;
565 case SDL_PIXELFORMAT_ABGR8888: 577 case SDL_PIXELFORMAT_ABGR8888:
566 SDL_PreMultiplyAlphaABGR8888(rect->w, rect->h, pixels, data->pitch); 578 SDL_PreMultiplyAlphaABGR8888(rect->w, rect->h, pixels,
579 data->pitch);
567 break; 580 break;
568 case SDL_PIXELFORMAT_BGRA8888: 581 case SDL_PIXELFORMAT_BGRA8888:
569 SDL_PreMultiplyAlphaBGRA8888(rect->w, rect->h, pixels, data->pitch); 582 SDL_PreMultiplyAlphaBGRA8888(rect->w, rect->h, pixels,
583 data->pitch);
570 break; 584 break;
571 } 585 }
572 } 586 }
573 } else if (rect->w == texture->w && pitch == data->pitch) { 587 } else if (rect->w == texture->w && pitch == data->pitch) {
574 if (!SetDIBits 588 if (!SetDIBits
743 SelectObject(data->memory_hdc, texturedata->hbm); 757 SelectObject(data->memory_hdc, texturedata->hbm);
744 if (texturedata->hpal) { 758 if (texturedata->hpal) {
745 SelectPalette(data->memory_hdc, texturedata->hpal, TRUE); 759 SelectPalette(data->memory_hdc, texturedata->hpal, TRUE);
746 RealizePalette(data->memory_hdc); 760 RealizePalette(data->memory_hdc);
747 } 761 }
748 if (texture->blendMode & (SDL_BLENDMODE_MASK|SDL_BLENDMODE_BLEND)) { 762 if (texture->blendMode & (SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND)) {
749 BLENDFUNCTION blendFunc = { 763 BLENDFUNCTION blendFunc = {
750 AC_SRC_OVER, 764 AC_SRC_OVER,
751 0, 765 0,
752 texture->a, 766 texture->a,
753 AC_SRC_ALPHA 767 AC_SRC_ALPHA