OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium 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 #include "chrome/common/gfx/icon_util.h" | 5 #include "chrome/common/gfx/icon_util.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/gfx/size.h" | 7 #include "base/gfx/size.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chrome/common/win_util.h" | 9 #include "chrome/common/win_util.h" |
10 #include "skia/ext/image_operations.h" | 10 #include "skia/ext/image_operations.h" |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 inserted_original_bitmap = true; | 396 inserted_original_bitmap = true; |
397 continue; | 397 continue; |
398 } | 398 } |
399 | 399 |
400 if ((bitmap_to_resize.width() < icon_dimensions_[i]) && | 400 if ((bitmap_to_resize.width() < icon_dimensions_[i]) && |
401 (bitmap_to_resize.height() < icon_dimensions_[i])) { | 401 (bitmap_to_resize.height() < icon_dimensions_[i])) { |
402 bitmaps->push_back(bitmap_to_resize); | 402 bitmaps->push_back(bitmap_to_resize); |
403 inserted_original_bitmap = true; | 403 inserted_original_bitmap = true; |
404 } | 404 } |
405 } | 405 } |
406 bitmaps->push_back(gfx::ImageOperations::Resize( | 406 bitmaps->push_back(skia::ImageOperations::Resize( |
407 bitmap_to_resize, gfx::ImageOperations::RESIZE_LANCZOS3, | 407 bitmap_to_resize, skia::ImageOperations::RESIZE_LANCZOS3, |
408 gfx::Size(icon_dimensions_[i], icon_dimensions_[i]))); | 408 icon_dimensions_[i], icon_dimensions_[i])); |
409 } | 409 } |
410 | 410 |
411 if (!inserted_original_bitmap) { | 411 if (!inserted_original_bitmap) { |
412 bitmaps->push_back(bitmap_to_resize); | 412 bitmaps->push_back(bitmap_to_resize); |
413 } | 413 } |
414 } | 414 } |
415 | 415 |
416 int IconUtil::ComputeIconFileBufferSize(const std::vector<SkBitmap>& set) { | 416 int IconUtil::ComputeIconFileBufferSize(const std::vector<SkBitmap>& set) { |
417 // We start by counting the bytes for the structures that don't depend on the | 417 // We start by counting the bytes for the structures that don't depend on the |
418 // number of icon images. Note that sizeof(ICONDIR) already accounts for a | 418 // number of icon images. Note that sizeof(ICONDIR) already accounts for a |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 // number by the image height in order to get the total number of bytes for | 468 // number by the image height in order to get the total number of bytes for |
469 // the AND mask. Thus, for a 15X15 image, we need 15 * 4 which is 60 bytes | 469 // the AND mask. Thus, for a 15X15 image, we need 15 * 4 which is 60 bytes |
470 // for the monochrome bitmap representing the AND mask. | 470 // for the monochrome bitmap representing the AND mask. |
471 int and_line_length = (bitmap.width() + 7) >> 3; | 471 int and_line_length = (bitmap.width() + 7) >> 3; |
472 and_line_length = (and_line_length + 3) & ~3; | 472 and_line_length = (and_line_length + 3) & ~3; |
473 *and_mask_size = and_line_length * bitmap.height(); | 473 *and_mask_size = and_line_length * bitmap.height(); |
474 int masks_size = *xor_mask_size + *and_mask_size; | 474 int masks_size = *xor_mask_size + *and_mask_size; |
475 *bytes_in_resource = masks_size + sizeof(BITMAPINFOHEADER); | 475 *bytes_in_resource = masks_size + sizeof(BITMAPINFOHEADER); |
476 } | 476 } |
477 | 477 |
OLD | NEW |