fb: Fix 1bpp Xservers on "whitePixel=0, blackPixel=1" VRAMs
Closes: #1057
This commit is contained in:
		
							parent
							
								
									15624bb5bc
								
							
						
					
					
						commit
						f2b019d2b3
					
				
							
								
								
									
										3
									
								
								fb/fb.h
								
								
								
								
							
							
						
						
									
										3
									
								
								fb/fb.h
								
								
								
								
							|  | @ -734,6 +734,9 @@ fbResolveColor(unsigned short *pred, | |||
| extern _X_EXPORT Bool | ||||
|  fbInitializeColormap(ColormapPtr pmap); | ||||
| 
 | ||||
| extern _X_EXPORT Bool | ||||
|  mfbCreateColormap(ColormapPtr pmap); | ||||
| 
 | ||||
| extern _X_EXPORT int | ||||
| 
 | ||||
| fbExpandDirectColors(ColormapPtr pmap, | ||||
|  |  | |||
|  | @ -66,6 +66,41 @@ fbInitializeColormap(ColormapPtr pmap) | |||
|     return miInitializeColormap(pmap); | ||||
| } | ||||
| 
 | ||||
| Bool | ||||
| mfbCreateColormap(ColormapPtr pmap) | ||||
| { | ||||
|     ScreenPtr	pScreen; | ||||
|     unsigned short  red0, green0, blue0; | ||||
|     unsigned short  red1, green1, blue1; | ||||
|     Pixel pix; | ||||
| 
 | ||||
|     pScreen = pmap->pScreen; | ||||
|     if (pScreen->whitePixel == 0) | ||||
|     { | ||||
| 	red0 = green0 = blue0 = ~0; | ||||
| 	red1 = green1 = blue1 = 0; | ||||
|     } | ||||
|     else | ||||
|     { | ||||
| 	red0 = green0 = blue0 = 0; | ||||
| 	red1 = green1 = blue1 = ~0; | ||||
|     } | ||||
| 
 | ||||
|     /* this is a monochrome colormap, it only has two entries, just fill
 | ||||
|      * them in by hand.  If it were a more complex static map, it would be | ||||
|      * worth writing a for loop or three to initialize it */ | ||||
| 
 | ||||
|     /* this will be pixel 0 */ | ||||
|     pix = 0; | ||||
|     if (AllocColor(pmap, &red0, &green0, &blue0, &pix, 0) != Success) | ||||
| 	return FALSE; | ||||
| 
 | ||||
|     /* this will be pixel 1 */ | ||||
|     if (AllocColor(pmap, &red1, &green1, &blue1, &pix, 0) != Success) | ||||
| 	return FALSE; | ||||
|     return TRUE; | ||||
| } | ||||
| 
 | ||||
| int | ||||
| fbExpandDirectColors(ColormapPtr pmap, | ||||
|                      int ndef, xColorItem * indefs, xColorItem * outdefs) | ||||
|  |  | |||
|  | @ -100,8 +100,10 @@ fbSetupScreen(ScreenPtr pScreen, void *pbits, /* pointer to screen bitmap */ | |||
|     if (!fbAllocatePrivates(pScreen)) | ||||
|         return FALSE; | ||||
|     pScreen->defColormap = FakeClientID(0); | ||||
|     /* let CreateDefColormap do whatever it wants for pixels */ | ||||
|     pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0; | ||||
|     if (bpp > 1) { | ||||
| 	/* let CreateDefColormap do whatever it wants for pixels */ | ||||
| 	pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0; | ||||
|     } | ||||
|     pScreen->QueryBestSize = fbQueryBestSize; | ||||
|     /* SaveScreen */ | ||||
|     pScreen->GetImage = fbGetImage; | ||||
|  | @ -118,7 +120,11 @@ fbSetupScreen(ScreenPtr pScreen, void *pbits, /* pointer to screen bitmap */ | |||
|     pScreen->RealizeFont = fbRealizeFont; | ||||
|     pScreen->UnrealizeFont = fbUnrealizeFont; | ||||
|     pScreen->CreateGC = fbCreateGC; | ||||
|     pScreen->CreateColormap = fbInitializeColormap; | ||||
|     if (bpp == 1) { | ||||
| 	pScreen->CreateColormap = mfbCreateColormap; | ||||
|     } else { | ||||
| 	pScreen->CreateColormap = fbInitializeColormap; | ||||
|     } | ||||
|     pScreen->DestroyColormap = (void (*)(ColormapPtr)) NoopDDA; | ||||
|     pScreen->InstallColormap = fbInstallColormap; | ||||
|     pScreen->UninstallColormap = fbUninstallColormap; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue