]> code.delx.au - refind/blob - libeg/image.c
Version 0.6.5 release.
[refind] / libeg / image.c
1 /*
2 * libeg/image.c
3 * Image handling functions
4 *
5 * Copyright (c) 2006 Christoph Pfisterer
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the
18 * distribution.
19 *
20 * * Neither the name of Christoph Pfisterer nor the names of the
21 * contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 */
36
37 #include "libegint.h"
38 #include "../refind/global.h"
39 #include "../refind/lib.h"
40 #include "../refind/screen.h"
41 #include "../include/refit_call_wrapper.h"
42 #include "lodepng.h"
43
44 #define MAX_FILE_SIZE (1024*1024*1024)
45
46 #ifndef __MAKEWITH_GNUEFI
47 #define LibLocateHandle gBS->LocateHandleBuffer
48 #define LibOpenRoot EfiLibOpenRoot
49 #endif
50
51 //
52 // Basic image handling
53 //
54
55 EG_IMAGE * egCreateImage(IN UINTN Width, IN UINTN Height, IN BOOLEAN HasAlpha)
56 {
57 EG_IMAGE *NewImage;
58
59 NewImage = (EG_IMAGE *) AllocatePool(sizeof(EG_IMAGE));
60 if (NewImage == NULL)
61 return NULL;
62 NewImage->PixelData = (EG_PIXEL *) AllocatePool(Width * Height * sizeof(EG_PIXEL));
63 if (NewImage->PixelData == NULL) {
64 FreePool(NewImage);
65 return NULL;
66 }
67
68 NewImage->Width = Width;
69 NewImage->Height = Height;
70 NewImage->HasAlpha = HasAlpha;
71 return NewImage;
72 }
73
74 EG_IMAGE * egCreateFilledImage(IN UINTN Width, IN UINTN Height, IN BOOLEAN HasAlpha, IN EG_PIXEL *Color)
75 {
76 EG_IMAGE *NewImage;
77
78 NewImage = egCreateImage(Width, Height, HasAlpha);
79 if (NewImage == NULL)
80 return NULL;
81
82 egFillImage(NewImage, Color);
83 return NewImage;
84 }
85
86 EG_IMAGE * egCopyImage(IN EG_IMAGE *Image)
87 {
88 EG_IMAGE *NewImage;
89
90 NewImage = egCreateImage(Image->Width, Image->Height, Image->HasAlpha);
91 if (NewImage == NULL)
92 return NULL;
93
94 CopyMem(NewImage->PixelData, Image->PixelData, Image->Width * Image->Height * sizeof(EG_PIXEL));
95 return NewImage;
96 }
97
98 // Returns a smaller image composed of the specified crop area from the larger area.
99 // If the specified area is larger than is in the original, returns NULL.
100 EG_IMAGE * egCropImage(IN EG_IMAGE *Image, IN UINTN StartX, IN UINTN StartY, IN UINTN Width, IN UINTN Height) {
101 EG_IMAGE *NewImage = NULL;
102 UINTN x, y;
103
104 if (((StartX + Width) > Image->Width) || ((StartY + Height) > Image->Height))
105 return NULL;
106
107 NewImage = egCreateImage(Width, Height, Image->HasAlpha);
108 if (NewImage == NULL)
109 return NULL;
110
111 for (y = 0; y < Height; y++) {
112 for (x = 0; x < Width; x++) {
113 NewImage->PixelData[y * NewImage->Width + x] = Image->PixelData[(y + StartY) * Image->Width + x + StartX];
114 }
115 }
116 return NewImage;
117 } // EG_IMAGE * egCropImage()
118
119 VOID egFreeImage(IN EG_IMAGE *Image)
120 {
121 if (Image != NULL) {
122 if (Image->PixelData != NULL)
123 FreePool(Image->PixelData);
124 FreePool(Image);
125 }
126 }
127
128 //
129 // Basic file operations
130 //
131
132 EFI_STATUS egLoadFile(IN EFI_FILE* BaseDir, IN CHAR16 *FileName,
133 OUT UINT8 **FileData, OUT UINTN *FileDataLength)
134 {
135 EFI_STATUS Status;
136 EFI_FILE_HANDLE FileHandle;
137 EFI_FILE_INFO *FileInfo;
138 UINT64 ReadSize;
139 UINTN BufferSize;
140 UINT8 *Buffer;
141
142 Status = refit_call5_wrapper(BaseDir->Open, BaseDir, &FileHandle, FileName, EFI_FILE_MODE_READ, 0);
143 if (EFI_ERROR(Status)) {
144 return Status;
145 }
146
147 FileInfo = LibFileInfo(FileHandle);
148 if (FileInfo == NULL) {
149 refit_call1_wrapper(FileHandle->Close, FileHandle);
150 return EFI_NOT_FOUND;
151 }
152 ReadSize = FileInfo->FileSize;
153 if (ReadSize > MAX_FILE_SIZE)
154 ReadSize = MAX_FILE_SIZE;
155 FreePool(FileInfo);
156
157 BufferSize = (UINTN)ReadSize; // was limited to 1 GB above, so this is safe
158 Buffer = (UINT8 *) AllocatePool(BufferSize);
159 if (Buffer == NULL) {
160 refit_call1_wrapper(FileHandle->Close, FileHandle);
161 return EFI_OUT_OF_RESOURCES;
162 }
163
164 Status = refit_call3_wrapper(FileHandle->Read, FileHandle, &BufferSize, Buffer);
165 refit_call1_wrapper(FileHandle->Close, FileHandle);
166 if (EFI_ERROR(Status)) {
167 FreePool(Buffer);
168 return Status;
169 }
170
171 *FileData = Buffer;
172 *FileDataLength = BufferSize;
173 return EFI_SUCCESS;
174 }
175
176 static EFI_GUID ESPGuid = { 0xc12a7328, 0xf81f, 0x11d2, { 0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b } };
177
178 static EFI_STATUS egFindESP(OUT EFI_FILE_HANDLE *RootDir)
179 {
180 EFI_STATUS Status;
181 UINTN HandleCount = 0;
182 EFI_HANDLE *Handles;
183
184 Status = LibLocateHandle(ByProtocol, &ESPGuid, NULL, &HandleCount, &Handles);
185 if (!EFI_ERROR(Status) && HandleCount > 0) {
186 *RootDir = LibOpenRoot(Handles[0]);
187 if (*RootDir == NULL)
188 Status = EFI_NOT_FOUND;
189 FreePool(Handles);
190 }
191 return Status;
192 }
193
194 EFI_STATUS egSaveFile(IN EFI_FILE* BaseDir OPTIONAL, IN CHAR16 *FileName,
195 IN UINT8 *FileData, IN UINTN FileDataLength)
196 {
197 EFI_STATUS Status;
198 EFI_FILE_HANDLE FileHandle;
199 UINTN BufferSize;
200
201 if (BaseDir == NULL) {
202 Status = egFindESP(&BaseDir);
203 if (EFI_ERROR(Status))
204 return Status;
205 }
206
207 Status = refit_call5_wrapper(BaseDir->Open, BaseDir, &FileHandle, FileName,
208 EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
209 if (EFI_ERROR(Status))
210 return Status;
211
212 BufferSize = FileDataLength;
213 Status = refit_call3_wrapper(FileHandle->Write, FileHandle, &BufferSize, FileData);
214 refit_call1_wrapper(FileHandle->Close, FileHandle);
215
216 return Status;
217 }
218
219 //
220 // Loading images from files and embedded data
221 //
222
223 // static CHAR16 * egFindExtension(IN CHAR16 *FileName)
224 // {
225 // UINTN i;
226 //
227 // for (i = StrLen(FileName); i >= 0; i--) {
228 // if (FileName[i] == '.')
229 // return FileName + i + 1;
230 // if (FileName[i] == '/' || FileName[i] == '\\')
231 // break;
232 // }
233 // return FileName + StrLen(FileName);
234 // }
235
236 // Decode the specified image data. The IconSize parameter is relevant only
237 // for ICNS, for which it selects which ICNS sub-image is decoded.
238 // Returns a pointer to the resulting EG_IMAGE or NULL if decoding failed.
239 static EG_IMAGE * egDecodeAny(IN UINT8 *FileData, IN UINTN FileDataLength, IN UINTN IconSize, IN BOOLEAN WantAlpha)
240 {
241 EG_IMAGE *NewImage = NULL;
242
243 NewImage = egDecodeICNS(FileData, FileDataLength, IconSize, WantAlpha);
244 if (NewImage == NULL)
245 NewImage = egDecodePNG(FileData, FileDataLength, IconSize, WantAlpha);
246 if (NewImage == NULL)
247 NewImage = egDecodeBMP(FileData, FileDataLength, IconSize, WantAlpha);
248
249 return NewImage;
250 }
251
252 EG_IMAGE * egLoadImage(IN EFI_FILE* BaseDir, IN CHAR16 *FileName, IN BOOLEAN WantAlpha)
253 {
254 EFI_STATUS Status;
255 UINT8 *FileData;
256 UINTN FileDataLength;
257 EG_IMAGE *NewImage;
258
259 if (BaseDir == NULL || FileName == NULL)
260 return NULL;
261
262 // load file
263 Status = egLoadFile(BaseDir, FileName, &FileData, &FileDataLength);
264 if (EFI_ERROR(Status))
265 return NULL;
266
267 // decode it
268 NewImage = egDecodeAny(FileData, FileDataLength, 128, WantAlpha);
269 FreePool(FileData);
270
271 return NewImage;
272 }
273
274 // Load an icon from (BaseDir)/Path, extracting the icon of size IconSize x IconSize.
275 // If the initial attempt is unsuccessful, try again, replacing the directory
276 // component of Path with DEFAULT_ICONS_DIR.
277 // Note: The assumption is that BaseDir points to rEFInd's home directory and Path
278 // includes one subdirectory level. If this changes in future revisions, it may be
279 // necessary to alter the code that tries again with DEFAULT_ICONS_DIR.
280 // Returns a pointer to the image data, or NULL if the icon could not be loaded.
281 EG_IMAGE * egLoadIcon(IN EFI_FILE* BaseDir, IN CHAR16 *Path, IN UINTN IconSize)
282 {
283 EFI_STATUS Status;
284 UINT8 *FileData;
285 UINTN FileDataLength;
286 CHAR16 *FileName, FileName2[256];
287 EG_IMAGE *NewImage;
288
289 if (BaseDir == NULL || Path == NULL)
290 return NULL;
291
292 // load file
293 Status = egLoadFile(BaseDir, Path, &FileData, &FileDataLength);
294 if (EFI_ERROR(Status)) {
295 FileName = Basename(Path); // Note: FileName is a pointer within Path; DON'T FREE IT!
296 SPrint(FileName2, 255, L"%s\\%s", DEFAULT_ICONS_DIR, FileName);
297 Status = egLoadFile(BaseDir, FileName2, &FileData, &FileDataLength);
298 if (EFI_ERROR(Status))
299 return NULL;
300 }
301
302 // decode it
303 NewImage = egDecodeAny(FileData, FileDataLength, IconSize, TRUE);
304 FreePool(FileData);
305 if ((NewImage->Width != IconSize) || (NewImage->Height != IconSize)) {
306 Print(L"Warning: Attempt to load icon of the wrong size from '%s'\n", Path);
307 MyFreePool(NewImage);
308 NewImage = NULL;
309 }
310
311 return NewImage;
312 } // EG_IMAGE *egLoadIcon()
313
314 EG_IMAGE * egPrepareEmbeddedImage(IN EG_EMBEDDED_IMAGE *EmbeddedImage, IN BOOLEAN WantAlpha)
315 {
316 EG_IMAGE *NewImage;
317 UINT8 *CompData;
318 UINTN CompLen;
319 UINTN PixelCount;
320
321 // sanity check
322 if (EmbeddedImage->PixelMode > EG_MAX_EIPIXELMODE ||
323 (EmbeddedImage->CompressMode != EG_EICOMPMODE_NONE && EmbeddedImage->CompressMode != EG_EICOMPMODE_RLE))
324 return NULL;
325
326 // allocate image structure and pixel buffer
327 NewImage = egCreateImage(EmbeddedImage->Width, EmbeddedImage->Height, WantAlpha);
328 if (NewImage == NULL)
329 return NULL;
330
331 CompData = (UINT8 *)EmbeddedImage->Data; // drop const
332 CompLen = EmbeddedImage->DataLength;
333 PixelCount = EmbeddedImage->Width * EmbeddedImage->Height;
334
335 // FUTURE: for EG_EICOMPMODE_EFICOMPRESS, decompress whole data block here
336
337 if (EmbeddedImage->PixelMode == EG_EIPIXELMODE_GRAY ||
338 EmbeddedImage->PixelMode == EG_EIPIXELMODE_GRAY_ALPHA) {
339
340 // copy grayscale plane and expand
341 if (EmbeddedImage->CompressMode == EG_EICOMPMODE_RLE) {
342 egDecompressIcnsRLE(&CompData, &CompLen, PLPTR(NewImage, r), PixelCount);
343 } else {
344 egInsertPlane(CompData, PLPTR(NewImage, r), PixelCount);
345 CompData += PixelCount;
346 }
347 egCopyPlane(PLPTR(NewImage, r), PLPTR(NewImage, g), PixelCount);
348 egCopyPlane(PLPTR(NewImage, r), PLPTR(NewImage, b), PixelCount);
349
350 } else if (EmbeddedImage->PixelMode == EG_EIPIXELMODE_COLOR ||
351 EmbeddedImage->PixelMode == EG_EIPIXELMODE_COLOR_ALPHA) {
352
353 // copy color planes
354 if (EmbeddedImage->CompressMode == EG_EICOMPMODE_RLE) {
355 egDecompressIcnsRLE(&CompData, &CompLen, PLPTR(NewImage, r), PixelCount);
356 egDecompressIcnsRLE(&CompData, &CompLen, PLPTR(NewImage, g), PixelCount);
357 egDecompressIcnsRLE(&CompData, &CompLen, PLPTR(NewImage, b), PixelCount);
358 } else {
359 egInsertPlane(CompData, PLPTR(NewImage, r), PixelCount);
360 CompData += PixelCount;
361 egInsertPlane(CompData, PLPTR(NewImage, g), PixelCount);
362 CompData += PixelCount;
363 egInsertPlane(CompData, PLPTR(NewImage, b), PixelCount);
364 CompData += PixelCount;
365 }
366
367 } else {
368
369 // set color planes to black
370 egSetPlane(PLPTR(NewImage, r), 0, PixelCount);
371 egSetPlane(PLPTR(NewImage, g), 0, PixelCount);
372 egSetPlane(PLPTR(NewImage, b), 0, PixelCount);
373
374 }
375
376 if (WantAlpha && (EmbeddedImage->PixelMode == EG_EIPIXELMODE_GRAY_ALPHA ||
377 EmbeddedImage->PixelMode == EG_EIPIXELMODE_COLOR_ALPHA ||
378 EmbeddedImage->PixelMode == EG_EIPIXELMODE_ALPHA)) {
379
380 // copy alpha plane
381 if (EmbeddedImage->CompressMode == EG_EICOMPMODE_RLE) {
382 egDecompressIcnsRLE(&CompData, &CompLen, PLPTR(NewImage, a), PixelCount);
383 } else {
384 egInsertPlane(CompData, PLPTR(NewImage, a), PixelCount);
385 CompData += PixelCount;
386 }
387
388 } else {
389 egSetPlane(PLPTR(NewImage, a), WantAlpha ? 255 : 0, PixelCount);
390 }
391
392 return NewImage;
393 }
394
395 //
396 // Compositing
397 //
398
399 VOID egRestrictImageArea(IN EG_IMAGE *Image,
400 IN UINTN AreaPosX, IN UINTN AreaPosY,
401 IN OUT UINTN *AreaWidth, IN OUT UINTN *AreaHeight)
402 {
403 if (AreaPosX >= Image->Width || AreaPosY >= Image->Height) {
404 // out of bounds, operation has no effect
405 *AreaWidth = 0;
406 *AreaHeight = 0;
407 } else {
408 // calculate affected area
409 if (*AreaWidth > Image->Width - AreaPosX)
410 *AreaWidth = Image->Width - AreaPosX;
411 if (*AreaHeight > Image->Height - AreaPosY)
412 *AreaHeight = Image->Height - AreaPosY;
413 }
414 }
415
416 VOID egFillImage(IN OUT EG_IMAGE *CompImage, IN EG_PIXEL *Color)
417 {
418 UINTN i;
419 EG_PIXEL FillColor;
420 EG_PIXEL *PixelPtr;
421
422 FillColor = *Color;
423 if (!CompImage->HasAlpha)
424 FillColor.a = 0;
425
426 PixelPtr = CompImage->PixelData;
427 for (i = 0; i < CompImage->Width * CompImage->Height; i++, PixelPtr++)
428 *PixelPtr = FillColor;
429 }
430
431 VOID egFillImageArea(IN OUT EG_IMAGE *CompImage,
432 IN UINTN AreaPosX, IN UINTN AreaPosY,
433 IN UINTN AreaWidth, IN UINTN AreaHeight,
434 IN EG_PIXEL *Color)
435 {
436 UINTN x, y;
437 EG_PIXEL FillColor;
438 EG_PIXEL *PixelPtr;
439 EG_PIXEL *PixelBasePtr;
440
441 egRestrictImageArea(CompImage, AreaPosX, AreaPosY, &AreaWidth, &AreaHeight);
442
443 if (AreaWidth > 0) {
444 FillColor = *Color;
445 if (!CompImage->HasAlpha)
446 FillColor.a = 0;
447
448 PixelBasePtr = CompImage->PixelData + AreaPosY * CompImage->Width + AreaPosX;
449 for (y = 0; y < AreaHeight; y++) {
450 PixelPtr = PixelBasePtr;
451 for (x = 0; x < AreaWidth; x++, PixelPtr++)
452 *PixelPtr = FillColor;
453 PixelBasePtr += CompImage->Width;
454 }
455 }
456 }
457
458 VOID egRawCopy(IN OUT EG_PIXEL *CompBasePtr, IN EG_PIXEL *TopBasePtr,
459 IN UINTN Width, IN UINTN Height,
460 IN UINTN CompLineOffset, IN UINTN TopLineOffset)
461 {
462 UINTN x, y;
463 EG_PIXEL *TopPtr, *CompPtr;
464
465 for (y = 0; y < Height; y++) {
466 TopPtr = TopBasePtr;
467 CompPtr = CompBasePtr;
468 for (x = 0; x < Width; x++) {
469 *CompPtr = *TopPtr;
470 TopPtr++, CompPtr++;
471 }
472 TopBasePtr += TopLineOffset;
473 CompBasePtr += CompLineOffset;
474 }
475 }
476
477 VOID egRawCompose(IN OUT EG_PIXEL *CompBasePtr, IN EG_PIXEL *TopBasePtr,
478 IN UINTN Width, IN UINTN Height,
479 IN UINTN CompLineOffset, IN UINTN TopLineOffset)
480 {
481 UINTN x, y;
482 EG_PIXEL *TopPtr, *CompPtr;
483 UINTN Alpha;
484 UINTN RevAlpha;
485 UINTN Temp;
486
487 for (y = 0; y < Height; y++) {
488 TopPtr = TopBasePtr;
489 CompPtr = CompBasePtr;
490 for (x = 0; x < Width; x++) {
491 Alpha = TopPtr->a;
492 RevAlpha = 255 - Alpha;
493 Temp = (UINTN)CompPtr->b * RevAlpha + (UINTN)TopPtr->b * Alpha + 0x80;
494 CompPtr->b = (Temp + (Temp >> 8)) >> 8;
495 Temp = (UINTN)CompPtr->g * RevAlpha + (UINTN)TopPtr->g * Alpha + 0x80;
496 CompPtr->g = (Temp + (Temp >> 8)) >> 8;
497 Temp = (UINTN)CompPtr->r * RevAlpha + (UINTN)TopPtr->r * Alpha + 0x80;
498 CompPtr->r = (Temp + (Temp >> 8)) >> 8;
499 /*
500 CompPtr->b = ((UINTN)CompPtr->b * RevAlpha + (UINTN)TopPtr->b * Alpha) / 255;
501 CompPtr->g = ((UINTN)CompPtr->g * RevAlpha + (UINTN)TopPtr->g * Alpha) / 255;
502 CompPtr->r = ((UINTN)CompPtr->r * RevAlpha + (UINTN)TopPtr->r * Alpha) / 255;
503 */
504 TopPtr++, CompPtr++;
505 }
506 TopBasePtr += TopLineOffset;
507 CompBasePtr += CompLineOffset;
508 }
509 }
510
511 VOID egComposeImage(IN OUT EG_IMAGE *CompImage, IN EG_IMAGE *TopImage, IN UINTN PosX, IN UINTN PosY)
512 {
513 UINTN CompWidth, CompHeight;
514
515 CompWidth = TopImage->Width;
516 CompHeight = TopImage->Height;
517 egRestrictImageArea(CompImage, PosX, PosY, &CompWidth, &CompHeight);
518
519 // compose
520 if (CompWidth > 0) {
521 if (TopImage->HasAlpha) {
522 egRawCompose(CompImage->PixelData + PosY * CompImage->Width + PosX, TopImage->PixelData,
523 CompWidth, CompHeight, CompImage->Width, TopImage->Width);
524 } else {
525 egRawCopy(CompImage->PixelData + PosY * CompImage->Width + PosX, TopImage->PixelData,
526 CompWidth, CompHeight, CompImage->Width, TopImage->Width);
527 }
528 }
529 } /* VOID egComposeImage() */
530
531 EG_IMAGE * egEnsureImageSize(IN EG_IMAGE *Image, IN UINTN Width, IN UINTN Height, IN EG_PIXEL *Color)
532 {
533 EG_IMAGE *NewImage;
534
535 if (Image == NULL)
536 return NULL;
537 if (Image->Width == Width && Image->Height == Height)
538 return Image;
539
540 NewImage = egCreateFilledImage(Width, Height, Image->HasAlpha, Color);
541 if (NewImage == NULL) {
542 egFreeImage(Image);
543 return NULL;
544 }
545 Image->HasAlpha = FALSE;
546 egComposeImage(NewImage, Image, 0, 0);
547 egFreeImage(Image);
548
549 return NewImage;
550 }
551
552 //
553 // misc internal functions
554 //
555
556 VOID egInsertPlane(IN UINT8 *SrcDataPtr, IN UINT8 *DestPlanePtr, IN UINTN PixelCount)
557 {
558 UINTN i;
559
560 for (i = 0; i < PixelCount; i++) {
561 *DestPlanePtr = *SrcDataPtr++;
562 DestPlanePtr += 4;
563 }
564 }
565
566 VOID egSetPlane(IN UINT8 *DestPlanePtr, IN UINT8 Value, IN UINTN PixelCount)
567 {
568 UINTN i;
569
570 for (i = 0; i < PixelCount; i++) {
571 *DestPlanePtr = Value;
572 DestPlanePtr += 4;
573 }
574 }
575
576 VOID egCopyPlane(IN UINT8 *SrcPlanePtr, IN UINT8 *DestPlanePtr, IN UINTN PixelCount)
577 {
578 UINTN i;
579
580 for (i = 0; i < PixelCount; i++) {
581 *DestPlanePtr = *SrcPlanePtr;
582 DestPlanePtr += 4, SrcPlanePtr += 4;
583 }
584 }
585
586 /* EOF */