OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |