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/image_operations.h" | |
8 #include "base/gfx/size.h" | 7 #include "base/gfx/size.h" |
9 #include "base/logging.h" | 8 #include "base/logging.h" |
10 #include "chrome/common/win_util.h" | 9 #include "chrome/common/win_util.h" |
| 10 #include "skia/ext/image_operations.h" |
11 #include "skia/include/SkBitmap.h" | 11 #include "skia/include/SkBitmap.h" |
12 | 12 |
13 // Defining the dimensions for the icon images. We store only one value because | 13 // Defining the dimensions for the icon images. We store only one value because |
14 // we always resize to a square image; that is, the value 48 means that we are | 14 // we always resize to a square image; that is, the value 48 means that we are |
15 // going to resize the given bitmap to a 48 by 48 pixels bitmap. | 15 // going to resize the given bitmap to a 48 by 48 pixels bitmap. |
16 // | 16 // |
17 // The icon images appear in the icon file in same order in which their | 17 // The icon images appear in the icon file in same order in which their |
18 // corresponding dimensions appear in the |icon_dimensions_| array, so it is | 18 // corresponding dimensions appear in the |icon_dimensions_| array, so it is |
19 // important to keep this array sorted. Also note that the maximum icon image | 19 // important to keep this array sorted. Also note that the maximum icon image |
20 // size we can handle is 255 by 255. | 20 // size we can handle is 255 by 255. |
(...skipping 447 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 |