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

Unified Diff: ui/gfx/icon_util.cc

Issue 1543183002: Switch to standard integer types in ui/gfx/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/icon_util.h ('k') | ui/gfx/icon_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/icon_util.cc
diff --git a/ui/gfx/icon_util.cc b/ui/gfx/icon_util.cc
index 1497a2908391b73e700fd485032e18d19c48cdd9..092ab68c14530dc820d9fdc62d01e5ec845600bd 100644
--- a/ui/gfx/icon_util.cc
+++ b/ui/gfx/icon_util.cc
@@ -7,6 +7,7 @@
#include "base/files/file_util.h"
#include "base/files/important_file_writer.h"
#include "base/logging.h"
+#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/trace_event/trace_event.h"
#include "base/win/resource_util.h"
@@ -199,17 +200,17 @@ base::win::ScopedHICON IconUtil::CreateHICONFromSkBitmap(
// bitmap has an alpha channel, Windows might not agree when all alpha values
// are zero. So the monochrome bitmap is created with all pixels transparent
// for this case. Otherwise, it is created with all pixels opaque.
- bool bitmap_has_alpha_channel = PixelsHaveAlpha(
- static_cast<const uint32*>(bitmap.getPixels()),
- bitmap.width() * bitmap.height());
+ bool bitmap_has_alpha_channel =
+ PixelsHaveAlpha(static_cast<const uint32_t*>(bitmap.getPixels()),
+ bitmap.width() * bitmap.height());
- scoped_ptr<uint8[]> mask_bits;
+ scoped_ptr<uint8_t[]> mask_bits;
if (!bitmap_has_alpha_channel) {
// Bytes per line with paddings to make it word alignment.
size_t bytes_per_line = (bitmap.width() + 0xF) / 16 * 2;
size_t mask_bits_size = bytes_per_line * bitmap.height();
- mask_bits.reset(new uint8[mask_bits_size]);
+ mask_bits.reset(new uint8_t[mask_bits_size]);
DCHECK(mask_bits.get());
// Make all pixels transparent.
@@ -380,7 +381,7 @@ SkBitmap IconUtil::CreateSkBitmapFromHICONHelper(HICON icon,
BITMAPV5HEADER h;
InitializeBitmapHeader(&h, s.width(), s.height());
HDC hdc = ::GetDC(NULL);
- uint32* bits;
+ uint32_t* bits;
HBITMAP dib = ::CreateDIBSection(hdc, reinterpret_cast<BITMAPINFO*>(&h),
DIB_RGB_COLORS, reinterpret_cast<void**>(&bits), NULL, 0);
DCHECK(dib);
@@ -422,12 +423,12 @@ SkBitmap IconUtil::CreateSkBitmapFromHICONHelper(HICON icon,
// Finding out whether the bitmap has an alpha channel.
bool bitmap_has_alpha_channel = PixelsHaveAlpha(
- static_cast<const uint32*>(bitmap.getPixels()), num_pixels);
+ static_cast<const uint32_t*>(bitmap.getPixels()), num_pixels);
// If the bitmap does not have an alpha channel, we need to build it using
// the previously captured AND mask. Otherwise, we are done.
if (!bitmap_has_alpha_channel) {
- uint32* p = static_cast<uint32*>(bitmap.getPixels());
+ uint32_t* p = static_cast<uint32_t*>(bitmap.getPixels());
for (size_t i = 0; i < num_pixels; ++p, ++i) {
DCHECK_EQ((*p & 0xff000000), 0u);
if (opaque[i])
@@ -479,7 +480,7 @@ bool IconUtil::CreateIconFileFromImageFamily(
// First, we set the information which doesn't require iterating through the
// bitmap set and then we set the bitmap specific structures. In the latter
// step we also copy the actual bits.
- std::vector<uint8> buffer(buffer_size);
+ std::vector<uint8_t> buffer(buffer_size);
ICONDIR* icon_dir = reinterpret_cast<ICONDIR*>(&buffer[0]);
icon_dir->idType = kResourceTypeIcon;
icon_dir->idCount = static_cast<WORD>(image_count);
@@ -527,8 +528,8 @@ bool IconUtil::CreateIconFileFromImageFamily(
}
}
-bool IconUtil::PixelsHaveAlpha(const uint32* pixels, size_t num_pixels) {
- for (const uint32* end = pixels + num_pixels; pixels != end; ++pixels) {
+bool IconUtil::PixelsHaveAlpha(const uint32_t* pixels, size_t num_pixels) {
+ for (const uint32_t* end = pixels + num_pixels; pixels != end; ++pixels) {
if ((*pixels & 0xff000000) != 0)
return true;
}
« no previous file with comments | « ui/gfx/icon_util.h ('k') | ui/gfx/icon_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698