OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/browser/ui/app_list/fast_show_pickler.h" | 5 #include "chrome/browser/ui/app_list/fast_show_pickler.h" |
6 | 6 |
7 #include "third_party/skia/include/core/SkBitmap.h" | 7 #include "third_party/skia/include/core/SkBitmap.h" |
8 #include "ui/app_list/app_list_item.h" | 8 #include "ui/app_list/app_list_item.h" |
9 #include "ui/gfx/image/image_skia_rep.h" | 9 #include "ui/gfx/image/image_skia_rep.h" |
10 | 10 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 | 77 |
78 bool PickleImage(Pickle* pickle, const gfx::ImageSkia& image) { | 78 bool PickleImage(Pickle* pickle, const gfx::ImageSkia& image) { |
79 std::vector<gfx::ImageSkiaRep> reps(image.image_reps()); | 79 std::vector<gfx::ImageSkiaRep> reps(image.image_reps()); |
80 pickle->WriteInt(static_cast<int>(reps.size())); | 80 pickle->WriteInt(static_cast<int>(reps.size())); |
81 for (std::vector<gfx::ImageSkiaRep>::const_iterator it = reps.begin(); | 81 for (std::vector<gfx::ImageSkiaRep>::const_iterator it = reps.begin(); |
82 it != reps.end(); ++it) { | 82 it != reps.end(); ++it) { |
83 pickle->WriteFloat(it->scale()); | 83 pickle->WriteFloat(it->scale()); |
84 pickle->WriteInt(it->pixel_width()); | 84 pickle->WriteInt(it->pixel_width()); |
85 pickle->WriteInt(it->pixel_height()); | 85 pickle->WriteInt(it->pixel_height()); |
86 ImageFormat format = NONE; | 86 ImageFormat format = NONE; |
87 if (!ConfigToFormat(it->sk_bitmap().getConfig(), &format)) | 87 if (!ConfigToFormat(it->sk_bitmap().config(), &format)) |
reed1
2014/05/07 18:06:22
nit: can we change this more, to pass in colortype
| |
88 return false; | 88 return false; |
89 pickle->WriteInt(static_cast<int>(format)); | 89 pickle->WriteInt(static_cast<int>(format)); |
90 int size = static_cast<int>(it->sk_bitmap().getSafeSize()); | 90 int size = static_cast<int>(it->sk_bitmap().getSafeSize()); |
91 pickle->WriteInt(size); | 91 pickle->WriteInt(size); |
92 SkBitmap bitmap = it->sk_bitmap(); | 92 SkBitmap bitmap = it->sk_bitmap(); |
93 SkAutoLockPixels lock(bitmap); | 93 SkAutoLockPixels lock(bitmap); |
94 pickle->WriteBytes(bitmap.getPixels(), size); | 94 pickle->WriteBytes(bitmap.getPixels(), size); |
95 } | 95 } |
96 return true; | 96 return true; |
97 } | 97 } |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
238 for (int i = 0; i < app_count; ++i) { | 238 for (int i = 0; i < app_count; ++i) { |
239 scoped_ptr<AppListItem> item(UnpickleAppListItem(&it).Pass()); | 239 scoped_ptr<AppListItem> item(UnpickleAppListItem(&it).Pass()); |
240 if (!item) | 240 if (!item) |
241 return scoped_ptr<AppListModel>(); | 241 return scoped_ptr<AppListModel>(); |
242 std::string folder_id = item->folder_id(); | 242 std::string folder_id = item->folder_id(); |
243 model->AddItemToFolder(item.Pass(), folder_id); | 243 model->AddItemToFolder(item.Pass(), folder_id); |
244 } | 244 } |
245 | 245 |
246 return model.Pass(); | 246 return model.Pass(); |
247 } | 247 } |
OLD | NEW |