Skip to content

Commit

Permalink
Use proper namespace in skia/ext
Browse files Browse the repository at this point in the history
The code was cut and pasted and kept its old namespace.

Remove SkPointToCGPoint and CGPointToSkPoint, which were not used anywhere.

BUG=561010

Review URL: https://codereview.chromium.org/1508893003

Cr-Commit-Position: refs/heads/master@{#364427}
  • Loading branch information
LeonScroggins authored and Commit bot committed Dec 10, 2015
1 parent 3e7b541 commit 66142ae
Show file tree
Hide file tree
Showing 60 changed files with 171 additions and 181 deletions.
2 changes: 1 addition & 1 deletion chrome/browser/themes/theme_service_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void HSLToHSB(const color_utils::HSL& hsl, CGFloat* h, CGFloat* s, CGFloat* b) {
return nscolor_iter->second;

SkColor sk_color = GetColor(id);
NSColor* color = gfx::SkColorToCalibratedNSColor(sk_color);
NSColor* color = skia::SkColorToCalibratedNSColor(sk_color);

// We loaded successfully. Cache the color.
if (color)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ void TestControls(AppWindow* app_window) {

// Convert a color constant to an NSColor that can be compared with |bitmap|.
NSColor* ColorInBitmapColorSpace(SkColor color, NSBitmapImageRep* bitmap) {
return [gfx::SkColorToSRGBNSColor(color)
return [skia::SkColorToSRGBNSColor(color)
colorUsingColorSpace:[bitmap colorSpace]];
}

Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ui/cocoa/apps/titlebar_background_view.mm
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ + (TitlebarBackgroundView*)addToNSWindow:(NSWindow*)window
positioned:NSWindowBelow
relativeTo:nil];

[titlebar_background_view setColor:gfx::SkColorToSRGBNSColor(activeColor)
inactiveColor:gfx::SkColorToSRGBNSColor(inactiveColor)];
[titlebar_background_view setColor:skia::SkColorToSRGBNSColor(activeColor)
inactiveColor:skia::SkColorToSRGBNSColor(inactiveColor)];
return titlebar_background_view.autorelease();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ - (id)initWithNotification:(const autofill::DialogNotification*)notification
base::scoped_nsobject<AutofillNotificationView> view(
[[AutofillNotificationView alloc] initWithFrame:NSZeroRect]);
[view setBackgroundColor:
gfx::SkColorToCalibratedNSColor(notification->GetBackgroundColor())];
skia::SkColorToCalibratedNSColor(notification->GetBackgroundColor())];
[view setBorderColor:
gfx::SkColorToCalibratedNSColor(notification->GetBorderColor())];
skia::SkColorToCalibratedNSColor(notification->GetBorderColor())];
[self setView:view];

textview_.reset([[HyperlinkTextView alloc] initWithFrame:NSZeroRect]);
NSColor* textColor =
gfx::SkColorToCalibratedNSColor(notification->GetTextColor());
skia::SkColorToCalibratedNSColor(notification->GetTextColor());
[textview_ setMessage:base::SysUTF16ToNSString(notification->display_text())
withFont:[NSFont labelFontOfSize:[[textview_ font] pointSize]]
messageColor:textColor];
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/ui/cocoa/autofill/autofill_section_view.mm
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ - (void)drawRect:(NSRect)dirtyRect {

- (NSColor*)hoverColor {
// Shading color is specified as a alpha component color, so premultiply.
NSColor* shadingColor = gfx::SkColorToCalibratedNSColor(kShadingColor);
NSColor* shadingColor = skia::SkColorToCalibratedNSColor(kShadingColor);
NSColor* blendedColor = [[[self window] backgroundColor]
blendedColorWithFraction:[shadingColor alphaComponent]
ofColor:shadingColor];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,15 +304,15 @@ - (void)setPermanentErrorMessage:(const base::string16&)text {
if (!text.empty()) {
if (!permanentErrorBox_) {
permanentErrorBox_ = [CardUnmaskPromptViewCocoa createPlainBox];
[permanentErrorBox_ setFillColor:gfx::SkColorToCalibratedNSColor(
[permanentErrorBox_ setFillColor:skia::SkColorToCalibratedNSColor(
autofill::kWarningColor)];
[permanentErrorBox_
setContentViewMargins:NSMakeSize(kPermanentErrorHorizontalPadding,
kPermanentErrorVerticalPadding)];

permanentErrorLabel_.reset([constrained_window::CreateLabel() retain]);
[permanentErrorLabel_ setAutoresizingMask:NSViewWidthSizable];
[permanentErrorLabel_ setTextColor:gfx::SkColorToCalibratedNSColor(
[permanentErrorLabel_ setTextColor:skia::SkColorToCalibratedNSColor(
kPermanentErrorTextColor)];

[permanentErrorBox_ addSubview:permanentErrorLabel_];
Expand Down Expand Up @@ -482,7 +482,7 @@ - (void)createStorageViewWithController:

base::scoped_nsobject<NSBox> box = [CardUnmaskPromptViewCocoa createPlainBox];
[box setAutoresizingMask:NSViewWidthSizable];
[box setFillColor:gfx::SkColorToCalibratedNSColor(kShadingColor)];
[box setFillColor:skia::SkColorToCalibratedNSColor(kShadingColor)];
[box setContentViewMargins:NSMakeSize(chrome_style::kHorizontalPadding,
chrome_style::kClientBottomPadding)];
[storageView_ addSubview:box];
Expand Down Expand Up @@ -516,7 +516,7 @@ - (void)createStorageViewWithController:
base::scoped_nsobject<NSBox> separator =
[CardUnmaskPromptViewCocoa createPlainBox];
[separator setAutoresizingMask:NSViewWidthSizable];
[separator setFillColor:gfx::SkColorToCalibratedNSColor(kSubtleBorderColor)];
[separator setFillColor:skia::SkColorToCalibratedNSColor(kSubtleBorderColor)];
[storageView_ addSubview:separator];

[box sizeToFit];
Expand Down Expand Up @@ -659,7 +659,7 @@ - (void)loadView {
[mainView addSubview:progressOverlayView_];

progressOverlayLabel_.reset([constrained_window::CreateLabel() retain]);
NSColor* throbberBlueColor = gfx::SkColorToCalibratedNSColor(
NSColor* throbberBlueColor = skia::SkColorToCalibratedNSColor(
ui::NativeThemeMac::instance()->GetSystemColor(
ui::NativeTheme::kColorId_ThrobberSpinningColor));
[progressOverlayLabel_ setTextColor:throbberBlueColor];
Expand Down Expand Up @@ -713,7 +713,7 @@ - (void)loadView {
// Add error message label.
errorLabel_.reset([constrained_window::CreateLabel() retain]);
[errorLabel_
setTextColor:gfx::SkColorToCalibratedNSColor(autofill::kWarningColor)];
setTextColor:skia::SkColorToCalibratedNSColor(autofill::kWarningColor)];
[mainView addSubview:errorLabel_];

// Add cancel button.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ - (id)initWithParentWindow:(NSWindow*)parentWindow

ui::NativeTheme* nativeTheme = ui::NativeThemeMac::instance();
[[self bubble] setBackgroundColor:
gfx::SkColorToCalibratedNSColor(nativeTheme->GetSystemColor(
skia::SkColorToCalibratedNSColor(nativeTheme->GetSystemColor(
ui::NativeTheme::kColorId_DialogBackground))];
[self performLayout];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,22 @@
const CGFloat kPasswordSectionVerticalSeparation = 5;

NSColor* DividerColor() {
return gfx::SkColorToCalibratedNSColor(
return skia::SkColorToCalibratedNSColor(
PasswordGenerationPopupView::kDividerColor);
}

NSColor* HelpTextBackgroundColor() {
return gfx::SkColorToCalibratedNSColor(
return skia::SkColorToCalibratedNSColor(
PasswordGenerationPopupView::kExplanatoryTextBackgroundColor);
}

NSColor* HelpTextColor() {
return gfx::SkColorToCalibratedNSColor(
return skia::SkColorToCalibratedNSColor(
PasswordGenerationPopupView::kExplanatoryTextColor);
}

NSColor* HelpLinkColor() {
return gfx::SkColorToCalibratedNSColor(chrome_style::GetLinkColor());
return skia::SkColorToCalibratedNSColor(chrome_style::GetLinkColor());
}

} // namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ - (void)drawAsDetachedBubble:(NSRect)dirtyRect {
NSRectFill(dirtyRect);

// Overlay with a lighter background color.
NSColor* toolbarColor = gfx::SkColorToCalibratedNSColor(
NSColor* toolbarColor = skia::SkColorToCalibratedNSColor(
chrome::GetDetachedBookmarkBarBackgroundColor(themeService));
CGFloat alpha = morph * [toolbarColor alphaComponent];
[[toolbarColor colorWithAlphaComponent:alpha] set];
Expand All @@ -75,7 +75,7 @@ - (void)drawAsDetachedBubble:(NSRect)dirtyRect {
NSRect strokeRect = [self bounds];
strokeRect.size.height = [self cr_lineWidth];
if (NSIntersectsRect(strokeRect, dirtyRect)) {
NSColor* strokeColor = gfx::SkColorToCalibratedNSColor(
NSColor* strokeColor = skia::SkColorToCalibratedNSColor(
chrome::GetDetachedBookmarkBarSeparatorColor(themeService));
strokeColor = [[self strokeColor] blendedColorWithFraction:morph
ofColor:strokeColor];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ - (CGFloat)preferredHeightForWidth:(CGFloat)width {
- (void)loadView {
NSBox* promoView = [[[NSBox alloc] init] autorelease];
[promoView setBoxType:NSBoxCustom];
[promoView setFillColor:gfx::SkColorToDeviceNSColor(kBackgroundColor)];
[promoView setFillColor:skia::SkColorToDeviceNSColor(kBackgroundColor)];
[promoView setContentViewMargins:NSMakeSize(chrome_style::kHorizontalPadding,
kVerticalPadding)];
[promoView setBorderType:NSLineBorder];
[promoView setBorderWidth:kBorderWidth];
[promoView setBorderColor:gfx::SkColorToDeviceNSColor(kBorderColor)];
[promoView setBorderColor:skia::SkColorToDeviceNSColor(kBorderColor)];

// Add the sync promo text.
size_t offset;
Expand All @@ -85,13 +85,13 @@ - (void)loadView {
NSString* nsPromoText = SysUTF16ToNSString(promoText);
NSString* nsLinkText = SysUTF16ToNSString(linkText);
NSFont* font = [NSFont labelFontOfSize:kFontSize];
NSColor* linkColor = gfx::SkColorToCalibratedNSColor(
NSColor* linkColor = skia::SkColorToCalibratedNSColor(
chrome_style::GetLinkColor());

textView_.reset([[HyperlinkTextView alloc] init]);
[textView_ setMessage:nsPromoText
withFont:font
messageColor:gfx::SkColorToDeviceNSColor(kTextColor)];
messageColor:skia::SkColorToDeviceNSColor(kTextColor)];
[textView_ addLinkRange:NSMakeRange(offset, [nsLinkText length])
withURL:@"about:blank" // using a link here is bad ui
linkColor:linkColor];
Expand Down
8 changes: 4 additions & 4 deletions chrome/browser/ui/cocoa/browser/zoom_bubble_controller.mm
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ - (id)initWithParentWindow:(NSWindow*)parentWindow
[[self bubble] setAlignment:info_bubble::kAlignRightEdgeToAnchorEdge];
[[self bubble] setArrowLocation:info_bubble::kNoArrow];
[[self bubble] setBackgroundColor:
gfx::SkColorToCalibratedNSColor(nativeTheme->GetSystemColor(
skia::SkColorToCalibratedNSColor(nativeTheme->GetSystemColor(
ui::NativeTheme::kColorId_DialogBackground))];

[self performLayout];
Expand Down Expand Up @@ -233,7 +233,7 @@ - (void)performLayout {
[separatorView setBoxType:NSBoxCustom];
ui::NativeTheme* nativeTheme = ui::NativeThemeMac::instance();
[separatorView setBorderColor:
gfx::SkColorToCalibratedNSColor(nativeTheme->GetSystemColor(
skia::SkColorToCalibratedNSColor(nativeTheme->GetSystemColor(
ui::NativeTheme::kColorId_MenuSeparatorColor))];
[[[self window] contentView] addSubview:separatorView];

Expand Down Expand Up @@ -336,15 +336,15 @@ - (void)drawRect:(NSRect)rect {
NSAttributedString* title = [self attributedTitle];
if ([self hoverState] != kHoverStateNone) {
ui::NativeTheme* nativeTheme = ui::NativeThemeMac::instance();
[gfx::SkColorToCalibratedNSColor(nativeTheme->GetSystemColor(
[skia::SkColorToCalibratedNSColor(nativeTheme->GetSystemColor(
ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor)) set];
NSRectFillUsingOperation(bounds, NSCompositeSourceOver);

// Change the title color.
base::scoped_nsobject<NSMutableAttributedString> selectedTitle(
[[NSMutableAttributedString alloc] initWithAttributedString:title]);
NSColor* selectedTitleColor =
gfx::SkColorToCalibratedNSColor(nativeTheme->GetSystemColor(
skia::SkColorToCalibratedNSColor(nativeTheme->GetSystemColor(
ui::NativeTheme::kColorId_SelectedMenuItemForegroundColor));
[selectedTitle addAttribute:NSForegroundColorAttributeName
value:selectedTitleColor
Expand Down
6 changes: 3 additions & 3 deletions chrome/browser/ui/cocoa/color_chooser_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ - (void)setColor:(NSColor*)color;
SkColor initial_color)
: web_contents_(web_contents) {
panel_.reset([[ColorPanelCocoa alloc] initWithChooser:this]);
[panel_ setColor:gfx::SkColorToDeviceNSColor(initial_color)];
[panel_ setColor:skia::SkColorToDeviceNSColor(initial_color)];
[[NSColorPanel sharedColorPanel] makeKeyAndOrderFront:nil];
}

Expand All @@ -101,7 +101,7 @@ - (void)setColor:(NSColor*)color;
}

void ColorChooserMac::SetSelectedColor(SkColor color) {
[panel_ setColor:gfx::SkColorToDeviceNSColor(color)];
[panel_ setColor:skia::SkColorToDeviceNSColor(color)];
}

@implementation ColorPanelCocoa
Expand Down Expand Up @@ -139,7 +139,7 @@ - (void)didChooseColor:(NSColorPanel*)panel {
nonUserChange_ = NO;
return;
}
chooser_->DidChooseColorInColorPanel(gfx::NSDeviceColorToSkColor(
chooser_->DidChooseColorInColorPanel(skia::NSDeviceColorToSkColor(
[[panel color] colorUsingColorSpaceName:NSDeviceRGBColorSpace]));
nonUserChange_ = NO;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ ButtonState cellButtonState(id<ConstrainedWindowButtonDrawableCell> cell) {
const SkColor start[] = {0xFFF0F0F0, 0xFFF4F4F4, 0xFFEBEBEB, 0xFFEDEDED};
const SkColor end[] = {0xFFE0E0E0, 0xFFE4E4E4, 0xFFDBDBDB, 0xFFDEDEDE};

NSColor* start_color = gfx::SkColorToCalibratedNSColor(start[button_state]);
NSColor* end_color = gfx::SkColorToCalibratedNSColor(end[button_state]);
NSColor* start_color = skia::SkColorToCalibratedNSColor(start[button_state]);
NSColor* end_color = skia::SkColorToCalibratedNSColor(end[button_state]);
return [[[NSGradient alloc] initWithColorsAndLocations:
start_color, 0.0,
start_color, 0.38,
Expand All @@ -59,7 +59,7 @@ ButtonState cellButtonState(id<ConstrainedWindowButtonDrawableCell> cell) {
const SkColor color[] = {0xBFFFFFFF, 0xF2FFFFFF, 0x24000000, 0x00000000};

NSShadow* shadow = [[[NSShadow alloc] init] autorelease];
[shadow setShadowColor:gfx::SkColorToCalibratedNSColor(color[button_state])];
[shadow setShadowColor:skia::SkColorToCalibratedNSColor(color[button_state])];
[shadow setShadowOffset:NSMakeSize(0, -1)];
[shadow setShadowBlurRadius:2];
return shadow;
Expand All @@ -69,7 +69,7 @@ ButtonState cellButtonState(id<ConstrainedWindowButtonDrawableCell> cell) {
const SkColor color[] = {0x14000000, 0x1F000000, 0x00000000, 0x00000000};

NSShadow* shadow = [[[NSShadow alloc] init] autorelease];
[shadow setShadowColor:gfx::SkColorToCalibratedNSColor(color[button_state])];
[shadow setShadowColor:skia::SkColorToCalibratedNSColor(color[button_state])];
[shadow setShadowOffset:NSMakeSize(0, -1)];
[shadow setShadowBlurRadius:0];
return shadow;
Expand All @@ -78,7 +78,7 @@ ButtonState cellButtonState(id<ConstrainedWindowButtonDrawableCell> cell) {
NSColor* GetButtonBorderColor(ButtonState button_state) {
const SkColor color[] = {0x40000000, 0x4D000000, 0x4D000000, 0x1F000000};

return gfx::SkColorToCalibratedNSColor(color[button_state]);
return skia::SkColorToCalibratedNSColor(color[button_state]);
}

NSAttributedString* GetButtonAttributedString(
Expand All @@ -93,7 +93,7 @@ ButtonState cellButtonState(id<ConstrainedWindowButtonDrawableCell> cell) {

base::scoped_nsobject<NSShadow> shadow([[NSShadow alloc] init]);
[shadow setShadowColor:
gfx::SkColorToCalibratedNSColor(shadow_color[cellButtonState(cell)])];
skia::SkColorToCalibratedNSColor(shadow_color[cellButtonState(cell)])];
[shadow setShadowOffset:NSMakeSize(0, -1)];
[shadow setShadowBlurRadius:0];

Expand All @@ -109,7 +109,7 @@ ButtonState cellButtonState(id<ConstrainedWindowButtonDrawableCell> cell) {

NSDictionary* attributes = [NSDictionary dictionaryWithObjectsAndKeys:
font, NSFontAttributeName,
gfx::SkColorToCalibratedNSColor(text_color[cellButtonState(cell)]),
skia::SkColorToCalibratedNSColor(text_color[cellButtonState(cell)]),
NSForegroundColorAttributeName,
shadow.get(), NSShadowAttributeName,
paragraphStyle.get(), NSParagraphStyleAttributeName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ - (id)initWithContentRect:(NSRect)contentRect
backing:bufferingType
defer:NO])) {
[self setHasShadow:YES];
[self setBackgroundColor:gfx::SkColorToCalibratedNSColor(
[self setBackgroundColor:skia::SkColorToCalibratedNSColor(
chrome_style::GetBackgroundColor())];
[self setOpaque:NO];
[self setReleasedWhenClosed:NO];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ - (void)awakeFromNib {
prompt_->GetUserCount())];
[[storeLinkButton_ cell] setUnderlineOnHover:YES];
[[storeLinkButton_ cell] setTextColor:
gfx::SkColorToCalibratedNSColor(chrome_style::GetLinkColor())];
skia::SkColorToCalibratedNSColor(chrome_style::GetLinkColor())];
}

[iconView_ setImage:prompt_->icon().ToNSImage()];
Expand Down Expand Up @@ -566,7 +566,7 @@ - (NSCell*)outlineView:(NSOutlineView*)outlineView
[cell setAlignment:NSLeftTextAlignment];
[cell setUnderlineOnHover:YES];
[cell setTextColor:
gfx::SkColorToCalibratedNSColor(chrome_style::GetLinkColor())];
skia::SkColorToCalibratedNSColor(chrome_style::GetLinkColor())];

size_t detailsIndex =
[[item objectForKey:kPermissionsDetailIndex] unsignedIntegerValue];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ - (id)initWithParentWindow:(NSWindow*)parentWindow
const extensions::Extension* extension = extensionBubble->extension();
browser_ = extensionBubble->browser();
DCHECK(browser_);
icon_.reset([gfx::SkBitmapToNSImage(extensionBubble->icon()) retain]);
icon_.reset([skia::SkBitmapToNSImage(extensionBubble->icon()) retain]);
pageActionPreviewShowing_ = NO;

if (extension->is_app()) {
Expand Down Expand Up @@ -155,7 +155,7 @@ - (id)initWithParentWindow:(NSWindow*)parentWindow
bundle_ = bundle;
DCHECK(browser);
browser_ = browser;
icon_.reset([gfx::SkBitmapToNSImage(SkBitmap()) retain]);
icon_.reset([skia::SkBitmapToNSImage(SkBitmap()) retain]);
pageActionPreviewShowing_ = NO;
type_ = extension_installed_bubble::kBundle;
[self showWindow:self];
Expand Down Expand Up @@ -407,7 +407,7 @@ - (int)calculateWindowHeight {
[view setMessage:message withFont:font messageColor:[NSColor blackColor]];
[view addLinkRange:NSMakeRange(0, [link length])
withURL:@"about:blank" // using a link here is bad ui
linkColor:gfx::SkColorToCalibratedNSColor(
linkColor:skia::SkColorToCalibratedNSColor(
chrome_style::GetLinkColor())];

// HACK! The TextView does not report correct height even after you stuff
Expand Down Expand Up @@ -489,7 +489,7 @@ - (int)calculateWindowHeight {
[[manageShortcutLink_ cell]
setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
[[manageShortcutLink_ cell]
setTextColor:gfx::SkColorToCalibratedNSColor(
setTextColor:skia::SkColorToCalibratedNSColor(
chrome_style::GetLinkColor())];
[GTMUILocalizerAndLayoutTweaker sizeToFitView:manageShortcutLink_];
newWindowHeight += extension_installed_bubble::kInnerVerticalMargin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ - (id)initWithParentWindow:(NSWindow*)parentWindow
[[self bubble] setAlignment:info_bubble::kAlignArrowToAnchor];
[[self bubble] setArrowLocation:info_bubble::kTopRight];
[[self bubble] setBackgroundColor:
gfx::SkColorToCalibratedNSColor(nativeTheme->GetSystemColor(
skia::SkColorToCalibratedNSColor(nativeTheme->GetSystemColor(
ui::NativeTheme::kColorId_DialogBackground))];

if (!g_animations_enabled)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ - (void)addAdditionalControls {
[view setMessage:message withFont:font messageColor:[NSColor blackColor]];
if (linkLength != 0) {
NSColor* linkColor =
gfx::SkColorToCalibratedNSColor(chrome_style::GetLinkColor());
skia::SkColorToCalibratedNSColor(chrome_style::GetLinkColor());
[view addLinkRange:NSMakeRange(linkOffset, linkLength)
withURL:base::SysUTF8ToNSString(delegate->GetLinkURL().spec())
linkColor:linkColor];
Expand Down
Loading

0 comments on commit 66142ae

Please sign in to comment.