OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "app/resource_bundle.h" | 5 #include "app/resource_bundle.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
| 9 #include "app/l10n_util.h" |
9 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
10 #include "base/data_pack.h" | 11 #include "base/data_pack.h" |
11 #include "base/file_path.h" | 12 #include "base/file_path.h" |
12 #include "base/file_util.h" | 13 #include "base/file_util.h" |
13 #include "base/gfx/gtk_util.h" | 14 #include "base/gfx/gtk_util.h" |
14 #include "base/logging.h" | 15 #include "base/logging.h" |
15 #include "base/path_service.h" | 16 #include "base/path_service.h" |
16 #include "base/string_piece.h" | 17 #include "base/string_piece.h" |
17 #include "base/string_util.h" | 18 #include "base/string_util.h" |
18 #include "chrome/common/chrome_paths.h" | 19 #include "chrome/common/chrome_paths.h" |
19 #include "chrome/common/gfx/chrome_font.h" | 20 #include "chrome/common/gfx/chrome_font.h" |
20 #include "chrome/common/gtk_util.h" | 21 #include "chrome/common/gtk_util.h" |
21 #include "chrome/common/l10n_util.h" | |
22 #include "SkBitmap.h" | 22 #include "SkBitmap.h" |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 // Convert the raw image data into a GdkPixbuf. The GdkPixbuf that is returned | 26 // Convert the raw image data into a GdkPixbuf. The GdkPixbuf that is returned |
27 // has a ref count of 1 so the caller must call g_object_unref to free the | 27 // has a ref count of 1 so the caller must call g_object_unref to free the |
28 // memory. | 28 // memory. |
29 GdkPixbuf* LoadPixbuf(std::vector<unsigned char>& data) { | 29 GdkPixbuf* LoadPixbuf(std::vector<unsigned char>& data) { |
30 ScopedGObject<GdkPixbufLoader>::Type loader(gdk_pixbuf_loader_new()); | 30 ScopedGObject<GdkPixbufLoader>::Type loader(gdk_pixbuf_loader_new()); |
31 bool ok = gdk_pixbuf_loader_write(loader.get(), | 31 bool ok = gdk_pixbuf_loader_write(loader.get(), |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // This bitmap will be leaked, but this code should never be hit. | 200 // This bitmap will be leaked, but this code should never be hit. |
201 scoped_ptr<SkBitmap> skia_bitmap(new SkBitmap()); | 201 scoped_ptr<SkBitmap> skia_bitmap(new SkBitmap()); |
202 skia_bitmap->setConfig(SkBitmap::kARGB_8888_Config, 32, 32); | 202 skia_bitmap->setConfig(SkBitmap::kARGB_8888_Config, 32, 32); |
203 skia_bitmap->allocPixels(); | 203 skia_bitmap->allocPixels(); |
204 skia_bitmap->eraseARGB(255, 255, 0, 0); | 204 skia_bitmap->eraseARGB(255, 255, 0, 0); |
205 empty_bitmap = gfx::GdkPixbufFromSkBitmap(skia_bitmap.get()); | 205 empty_bitmap = gfx::GdkPixbufFromSkBitmap(skia_bitmap.get()); |
206 } | 206 } |
207 return empty_bitmap; | 207 return empty_bitmap; |
208 } | 208 } |
209 } | 209 } |
OLD | NEW |