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

Side by Side Diff: ui/gfx/icon_util.cc

Issue 8785006: Badge Windows profile shortcuts with multi-user avatar. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Merged to TOT. Fixed cpu's nits. Created 9 years 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 | « chrome/installer/util/shell_util_unittest.cc ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ui/gfx/icon_util.h" 5 #include "ui/gfx/icon_util.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/win/scoped_handle.h" 10 #include "base/win/scoped_handle.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 SkAutoLockPixels bitmap_lock(bitmap); 236 SkAutoLockPixels bitmap_lock(bitmap);
237 if ((bitmap.getConfig() != SkBitmap::kARGB_8888_Config) || 237 if ((bitmap.getConfig() != SkBitmap::kARGB_8888_Config) ||
238 (bitmap.height() <= 0) || (bitmap.width() <= 0) || 238 (bitmap.height() <= 0) || (bitmap.width() <= 0) ||
239 (bitmap.getPixels() == NULL)) 239 (bitmap.getPixels() == NULL))
240 return false; 240 return false;
241 241
242 // We start by creating the file. 242 // We start by creating the file.
243 base::win::ScopedHandle icon_file(::CreateFile(icon_path.value().c_str(), 243 base::win::ScopedHandle icon_file(::CreateFile(icon_path.value().c_str(),
244 GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)); 244 GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL));
245 245
246 if (icon_file.Get() == INVALID_HANDLE_VALUE) 246 if (!icon_file.IsValid())
247 return false; 247 return false;
248 248
249 // Creating a set of bitmaps corresponding to the icon images we'll end up 249 // Creating a set of bitmaps corresponding to the icon images we'll end up
250 // storing in the icon file. Each bitmap is created by resizing the given 250 // storing in the icon file. Each bitmap is created by resizing the given
251 // bitmap to the desired size. 251 // bitmap to the desired size.
252 std::vector<SkBitmap> bitmaps; 252 std::vector<SkBitmap> bitmaps;
253 CreateResizedBitmapSet(bitmap, &bitmaps); 253 CreateResizedBitmapSet(bitmap, &bitmaps);
254 DCHECK(!bitmaps.empty()); 254 DCHECK(!bitmaps.empty());
255 size_t bitmap_count = bitmaps.size(); 255 size_t bitmap_count = bitmaps.size();
256 256
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 // Once we compute the size for a singe AND mask scan line, we multiply that 491 // Once we compute the size for a singe AND mask scan line, we multiply that
492 // number by the image height in order to get the total number of bytes for 492 // number by the image height in order to get the total number of bytes for
493 // the AND mask. Thus, for a 15X15 image, we need 15 * 4 which is 60 bytes 493 // the AND mask. Thus, for a 15X15 image, we need 15 * 4 which is 60 bytes
494 // for the monochrome bitmap representing the AND mask. 494 // for the monochrome bitmap representing the AND mask.
495 size_t and_line_length = (bitmap.width() + 7) >> 3; 495 size_t and_line_length = (bitmap.width() + 7) >> 3;
496 and_line_length = (and_line_length + 3) & ~3; 496 and_line_length = (and_line_length + 3) & ~3;
497 size_t and_mask_size = and_line_length * bitmap.height(); 497 size_t and_mask_size = and_line_length * bitmap.height();
498 size_t masks_size = *xor_mask_size + and_mask_size; 498 size_t masks_size = *xor_mask_size + and_mask_size;
499 *bytes_in_resource = masks_size + sizeof(BITMAPINFOHEADER); 499 *bytes_in_resource = masks_size + sizeof(BITMAPINFOHEADER);
500 } 500 }
OLDNEW
« no previous file with comments | « chrome/installer/util/shell_util_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698