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

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

Issue 606453002: Remove implicit HANDLE conversions from ui. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | ui/gfx/platform_font_win.cc » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/files/important_file_writer.h" 8 #include "base/files/important_file_writer.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 SetDIBits(0, 341 SetDIBits(0,
342 bitmap_handle, 342 bitmap_handle,
343 0, 343 0,
344 icon_size.height(), 344 icon_size.height(),
345 dib_bits, 345 dib_bits,
346 &icon_bitmap_info, 346 &icon_bitmap_info,
347 DIB_RGB_COLORS); 347 DIB_RGB_COLORS);
348 } 348 }
349 349
350 HBITMAP old_bitmap = reinterpret_cast<HBITMAP>( 350 HBITMAP old_bitmap = reinterpret_cast<HBITMAP>(
351 SelectObject(working_dc, bitmap_handle)); 351 SelectObject(working_dc.Get(), bitmap_handle));
352 SetBkMode(working_dc, TRANSPARENT); 352 SetBkMode(working_dc.Get(), TRANSPARENT);
353 SelectObject(working_dc, old_bitmap); 353 SelectObject(working_dc.Get(), old_bitmap);
354 354
355 base::win::ScopedGDIObject<HBITMAP> mask( 355 base::win::ScopedGDIObject<HBITMAP> mask(
356 CreateBitmap(icon_size.width(), 356 CreateBitmap(icon_size.width(),
357 icon_size.height(), 357 icon_size.height(),
358 1, 358 1,
359 1, 359 1,
360 NULL)); 360 NULL));
361 ICONINFO ii = {0}; 361 ICONINFO ii = {0};
362 ii.fIcon = FALSE; 362 ii.fIcon = FALSE;
363 ii.xHotspot = hotspot.x(); 363 ii.xHotspot = hotspot.x();
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 // Once we compute the size for a singe AND mask scan line, we multiply that 681 // Once we compute the size for a singe AND mask scan line, we multiply that
682 // number by the image height in order to get the total number of bytes for 682 // number by the image height in order to get the total number of bytes for
683 // the AND mask. Thus, for a 15X15 image, we need 15 * 4 which is 60 bytes 683 // the AND mask. Thus, for a 15X15 image, we need 15 * 4 which is 60 bytes
684 // for the monochrome bitmap representing the AND mask. 684 // for the monochrome bitmap representing the AND mask.
685 size_t and_line_length = (bitmap.width() + 7) >> 3; 685 size_t and_line_length = (bitmap.width() + 7) >> 3;
686 and_line_length = (and_line_length + 3) & ~3; 686 and_line_length = (and_line_length + 3) & ~3;
687 size_t and_mask_size = and_line_length * bitmap.height(); 687 size_t and_mask_size = and_line_length * bitmap.height();
688 size_t masks_size = *xor_mask_size + and_mask_size; 688 size_t masks_size = *xor_mask_size + and_mask_size;
689 *bytes_in_resource = masks_size + sizeof(BITMAPINFOHEADER); 689 *bytes_in_resource = masks_size + sizeof(BITMAPINFOHEADER);
690 } 690 }
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/platform_font_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698