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

Side by Side Diff: utility/bmpblk_utility.cc

Issue 6246150: Add test framework for bmpblk_utility. (Closed) Base URL: http://git.chromium.org/git/vboot_reference.git@master
Patch Set: Done. PTAL. 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
« tests/bitmaps/TestBmpBlock.py ('K') | « tests/bitmaps/case_nobmp.yaml ('k') | 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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 for (StrImageConfigMap::iterator it = config_.images_map.begin(); 331 for (StrImageConfigMap::iterator it = config_.images_map.begin();
332 it != config_.images_map.end(); 332 it != config_.images_map.end();
333 ++it) { 333 ++it) {
334 it->second.data.format = (uint32_t)get_image_format(it->second.raw_content); 334 it->second.data.format = (uint32_t)get_image_format(it->second.raw_content);
335 switch (it->second.data.format) { 335 switch (it->second.data.format) {
336 case FORMAT_BMP: 336 case FORMAT_BMP:
337 it->second.data.width = get_bmp_image_width(it->second.raw_content); 337 it->second.data.width = get_bmp_image_width(it->second.raw_content);
338 it->second.data.height = get_bmp_image_height(it->second.raw_content); 338 it->second.data.height = get_bmp_image_height(it->second.raw_content);
339 break; 339 break;
340 default: 340 default:
341 error("Unsupported image format."); 341 error("Unsupported image format.\n");
342 } 342 }
343 } 343 }
344 } 344 }
345 345
346 void BmpBlockUtil::compress_all_images(const Compression compress) { 346 void BmpBlockUtil::compress_all_images(const Compression compress) {
347 switch (compress) { 347 switch (compress) {
348 case COMPRESS_NONE: 348 case COMPRESS_NONE:
349 for (StrImageConfigMap::iterator it = config_.images_map.begin(); 349 for (StrImageConfigMap::iterator it = config_.images_map.begin();
350 it != config_.images_map.end(); 350 it != config_.images_map.end();
351 ++it) { 351 ++it) {
352 it->second.data.compression = compress; 352 it->second.data.compression = compress;
353 it->second.compressed_content = it->second.raw_content; 353 it->second.compressed_content = it->second.raw_content;
354 it->second.data.compressed_size = it->second.compressed_content.size(); 354 it->second.data.compressed_size = it->second.compressed_content.size();
355 } 355 }
356 break; 356 break;
357 default: 357 default:
358 error("Unsupported data compression."); 358 error("Unsupported data compression.\n");
359 } 359 }
360 } 360 }
361 361
362 void BmpBlockUtil::fill_bmpblock_header() { 362 void BmpBlockUtil::fill_bmpblock_header() {
363 memset(&config_.header, '\0', sizeof(config_.header)); 363 memset(&config_.header, '\0', sizeof(config_.header));
364 memcpy(&config_.header.signature, BMPBLOCK_SIGNATURE, 364 memcpy(&config_.header.signature, BMPBLOCK_SIGNATURE,
365 BMPBLOCK_SIGNATURE_SIZE); 365 BMPBLOCK_SIGNATURE_SIZE);
366 config_.header.number_of_localizations = config_.localizations.size(); 366 config_.header.number_of_localizations = config_.localizations.size();
367 config_.header.number_of_screenlayouts = config_.localizations[0].size(); 367 config_.header.number_of_screenlayouts = config_.localizations[0].size();
368 for (unsigned int i = 1; i < config_.localizations.size(); ++i) { 368 for (unsigned int i = 1; i < config_.localizations.size(); ++i) {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 542
543 if (options.extract_mode) { 543 if (options.extract_mode) {
544 /* TODO(waihong): Implement the extract mode. */ 544 /* TODO(waihong): Implement the extract mode. */
545 error("Extract mode hasn't been implemented yet.\n"); 545 error("Extract mode hasn't been implemented yet.\n");
546 } 546 }
547 547
548 return 0; 548 return 0;
549 } 549 }
550 550
551 #endif // WITH_UTIL_MAIN 551 #endif // WITH_UTIL_MAIN
OLDNEW
« tests/bitmaps/TestBmpBlock.py ('K') | « tests/bitmaps/case_nobmp.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698