Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ui / base / cocoa / appkit_utils.mm
blob824a6ac92564f4e0f79d11b0790de1bba0f8a7e7
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #import "ui/base/cocoa/appkit_utils.h"
7 #include "ui/base/resource/resource_bundle.h"
9 namespace {
11 // Gets an NSImage given an image id.
12 NSImage* GetImage(int image_id) {
13   return ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(image_id)
14       .ToNSImage();
17 }  // namespace
19 namespace ui {
21 void DrawNinePartImage(NSRect frame,
22                        const NinePartImageIds& image_ids,
23                        NSCompositingOperation operation,
24                        CGFloat alpha,
25                        BOOL flipped) {
26   NSDrawNinePartImage(frame,
27                       GetImage(image_ids.top_left),
28                       GetImage(image_ids.top),
29                       GetImage(image_ids.top_right),
30                       GetImage(image_ids.left),
31                       GetImage(image_ids.center),
32                       GetImage(image_ids.right),
33                       GetImage(image_ids.bottom_left),
34                       GetImage(image_ids.bottom),
35                       GetImage(image_ids.bottom_right),
36                       operation,
37                       alpha,
38                       flipped);
41 }  // namespace ui