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

Side by Side Diff: ui/native_theme/native_theme_mac.mm

Issue 828633002: replace COMPILE_ASSERT with static_assert in ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix for rebase Created 5 years, 11 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 | « ui/native_theme/native_theme_aura.cc ('k') | ui/platform_window/x11/x11_window.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/native_theme/native_theme_mac.h" 5 #include "ui/native_theme/native_theme_mac.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // system colors are just opaque objects that can paint themselves and otherwise 49 // system colors are just opaque objects that can paint themselves and otherwise
50 // tell you nothing. In 10.8, some of the system color classes have incomplete 50 // tell you nothing. In 10.8, some of the system color classes have incomplete
51 // implementations and throw exceptions even attempting to convert using 51 // implementations and throw exceptions even attempting to convert using
52 // -[NSColor colorUsingColorSpace:], so don't bother there either. 52 // -[NSColor colorUsingColorSpace:], so don't bother there either.
53 // This function paints a single pixel to a 1x1 swatch and reads it back. 53 // This function paints a single pixel to a 1x1 swatch and reads it back.
54 SkColor GetSystemColorUsingSwatch(NSColor* color) { 54 SkColor GetSystemColorUsingSwatch(NSColor* color) {
55 SkColor swatch; 55 SkColor swatch;
56 base::ScopedCFTypeRef<CGColorSpaceRef> color_space( 56 base::ScopedCFTypeRef<CGColorSpaceRef> color_space(
57 CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB)); 57 CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB));
58 const size_t bytes_per_row = 4; 58 const size_t bytes_per_row = 4;
59 COMPILE_ASSERT(sizeof(swatch) == bytes_per_row, skcolor_not_4_bytes); 59 static_assert(sizeof(swatch) == bytes_per_row, "skcolor should be 4 bytes");
60 CGBitmapInfo bitmap_info = 60 CGBitmapInfo bitmap_info =
61 kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host; 61 kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host;
62 base::ScopedCFTypeRef<CGContextRef> context(CGBitmapContextCreate( 62 base::ScopedCFTypeRef<CGContextRef> context(CGBitmapContextCreate(
63 &swatch, 1, 1, 8, bytes_per_row, color_space, bitmap_info)); 63 &swatch, 1, 1, 8, bytes_per_row, color_space, bitmap_info));
64 64
65 NSGraphicsContext* drawing_context = 65 NSGraphicsContext* drawing_context =
66 [NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:NO]; 66 [NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:NO];
67 [NSGraphicsContext saveGraphicsState]; 67 [NSGraphicsContext saveGraphicsState];
68 [NSGraphicsContext setCurrentContext:drawing_context]; 68 [NSGraphicsContext setCurrentContext:drawing_context];
69 [color drawSwatchInRect:NSMakeRect(0, 0, 1, 1)]; 69 [color drawSwatchInRect:NSMakeRect(0, 0, 1, 1)];
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 set_scrollbar_button_length(0); 363 set_scrollbar_button_length(0);
364 SetScrollbarColors(kScrollerThumbColor, 364 SetScrollbarColors(kScrollerThumbColor,
365 kScrollerThumbHoverColor, 365 kScrollerThumbHoverColor,
366 kScrollerTrackGradientColors[0]); 366 kScrollerTrackGradientColors[0]);
367 } 367 }
368 368
369 NativeThemeMac::~NativeThemeMac() { 369 NativeThemeMac::~NativeThemeMac() {
370 } 370 }
371 371
372 } // namespace ui 372 } // namespace ui
OLDNEW
« no previous file with comments | « ui/native_theme/native_theme_aura.cc ('k') | ui/platform_window/x11/x11_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698