Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: utility/bmpblk_utility.cc

Issue 6489026: Whitelist RLE compression for ARM in bmpblk_utility (Closed) Base URL: http://git.chromium.org/git/vboot_reference.git@master
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Utility for manipulating firmware screen block (BMPBLOCK) in GBB. 5 // Utility for manipulating firmware screen block (BMPBLOCK) in GBB.
6 // 6 //
7 7
8 #include "bmpblk_utility.h" 8 #include "bmpblk_utility.h"
9 9
10 #include <assert.h> 10 #include <assert.h>
(...skipping 12 matching lines...) Expand all
23 uint8_t CharB; // must be 'B' 23 uint8_t CharB; // must be 'B'
24 uint8_t CharM; // must be 'M' 24 uint8_t CharM; // must be 'M'
25 uint32_t Size; 25 uint32_t Size;
26 uint16_t Reserved[2]; 26 uint16_t Reserved[2];
27 uint32_t ImageOffset; 27 uint32_t ImageOffset;
28 uint32_t HeaderSize; 28 uint32_t HeaderSize;
29 uint32_t PixelWidth; 29 uint32_t PixelWidth;
30 uint32_t PixelHeight; 30 uint32_t PixelHeight;
31 uint16_t Planes; // Must be 1 for x86 31 uint16_t Planes; // Must be 1 for x86
32 uint16_t BitPerPixel; // 1, 4, 8, or 24 for x86 32 uint16_t BitPerPixel; // 1, 4, 8, or 24 for x86
33 uint32_t CompressionType; // must be 0 for x86 33 uint32_t CompressionType; // 0 (none) for x86, 1 (RLE) for arm
34 uint32_t ImageSize; 34 uint32_t ImageSize;
35 uint32_t XPixelsPerMeter; 35 uint32_t XPixelsPerMeter;
36 uint32_t YPixelsPerMeter; 36 uint32_t YPixelsPerMeter;
37 uint32_t NumberOfColors; 37 uint32_t NumberOfColors;
38 uint32_t ImportantColors; 38 uint32_t ImportantColors;
39 } __attribute__((packed)) BMP_IMAGE_HEADER; 39 } __attribute__((packed)) BMP_IMAGE_HEADER;
40 40
41 41
42 static void error(const char *format, ...) { 42 static void error(const char *format, ...) {
43 va_list ap; 43 va_list ap;
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 return content; 327 return content;
328 } 328 }
329 329
330 ImageFormat BmpBlockUtil::get_image_format(const string content) { 330 ImageFormat BmpBlockUtil::get_image_format(const string content) {
331 if (content.size() < sizeof(BMP_IMAGE_HEADER)) 331 if (content.size() < sizeof(BMP_IMAGE_HEADER))
332 return FORMAT_INVALID; 332 return FORMAT_INVALID;
333 const BMP_IMAGE_HEADER *hdr = (const BMP_IMAGE_HEADER *)content.c_str(); 333 const BMP_IMAGE_HEADER *hdr = (const BMP_IMAGE_HEADER *)content.c_str();
334 334
335 if (hdr->CharB != 'B' || hdr->CharM != 'M' || 335 if (hdr->CharB != 'B' || hdr->CharM != 'M' ||
336 hdr->Planes != 1 || 336 hdr->Planes != 1 ||
337 hdr->CompressionType != 0 || 337 (hdr->CompressionType != 0 && hdr->CompressionType != 1) ||
338 (hdr->BitPerPixel != 1 && hdr->BitPerPixel != 4 && 338 (hdr->BitPerPixel != 1 && hdr->BitPerPixel != 4 &&
339 hdr->BitPerPixel != 8 && hdr->BitPerPixel != 24)) 339 hdr->BitPerPixel != 8 && hdr->BitPerPixel != 24))
340 return FORMAT_INVALID; 340 return FORMAT_INVALID;
341 341
342 return FORMAT_BMP; 342 return FORMAT_BMP;
343 } 343 }
344 344
345 uint32_t BmpBlockUtil::get_bmp_image_width(const string content) { 345 uint32_t BmpBlockUtil::get_bmp_image_width(const string content) {
346 const BMP_IMAGE_HEADER *hdr = (const BMP_IMAGE_HEADER *)content.c_str(); 346 const BMP_IMAGE_HEADER *hdr = (const BMP_IMAGE_HEADER *)content.c_str();
347 return hdr->PixelWidth; 347 return hdr->PixelWidth;
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 return display_bmpblock(bmpblock_fn); 614 return display_bmpblock(bmpblock_fn);
615 printf("display content of %s\n", bmpblock_fn); 615 printf("display content of %s\n", bmpblock_fn);
616 /* TODO(waihong): Implement the list mode. */ 616 /* TODO(waihong): Implement the list mode. */
617 error("List mode hasn't been implemented yet.\n"); 617 error("List mode hasn't been implemented yet.\n");
618 } 618 }
619 619
620 return 0; 620 return 0;
621 } 621 }
622 622
623 #endif // WITH_UTIL_MAIN 623 #endif // WITH_UTIL_MAIN
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698