1 // Copyright 2014 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 #include "ui/base/nine_image_painter_factory.h"
7 #include "ui/base/resource/resource_bundle.h"
8 #include "ui/gfx/nine_image_painter.h"
14 std::vector
<gfx::ImageSkia
> ImageIdsToImages(const int image_ids
[]) {
15 ui::ResourceBundle
& rb
= ui::ResourceBundle::GetSharedInstance();
16 std::vector
<gfx::ImageSkia
> images(9);
17 for (size_t i
= 0; i
< 9; ++i
) {
18 if (image_ids
[i
] != 0)
19 images
[i
] = *rb
.GetImageSkiaNamed(image_ids
[i
]);
26 scoped_ptr
<gfx::NineImagePainter
> CreateNineImagePainter(
27 const int image_ids
[]) {
28 return make_scoped_ptr(
29 new gfx::NineImagePainter(ImageIdsToImages(image_ids
)));