Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: chrome/browser/ui/app_list/fast_show_pickler.cc

Issue 382623002: SkBitmap::Config is no more, use SkColorType (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: missed some for chromeos and win Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 *out = kARGB_4444_SkColorType; 43 *out = kARGB_4444_SkColorType;
44 break; 44 break;
45 case ARGB_8888: 45 case ARGB_8888:
46 *out = kN32_SkColorType; 46 *out = kN32_SkColorType;
47 break; 47 break;
48 default: return false; 48 default: return false;
49 } 49 }
50 return true; 50 return true;
51 } 51 }
52 52
53 bool ConfigToFormat(SkBitmap::Config config, ImageFormat* out) { 53 bool ColorTypeToFormat(SkColorType colorType, ImageFormat* out) {
54 switch (config) { 54 switch (colorType) {
55 case SkBitmap::kNo_Config: 55 case kUnknown_SkColorType:
56 *out = NONE; 56 *out = NONE;
57 break; 57 break;
58 case SkBitmap::kA8_Config: 58 case kAlpha_8_SkColorType:
59 *out = A8; 59 *out = A8;
60 break; 60 break;
61 case SkBitmap::kIndex8_Config: 61 case kIndex_8_SkColorType:
62 *out = INDEX_8; 62 *out = INDEX_8;
63 break; 63 break;
64 case SkBitmap::kRGB_565_Config: 64 case kRGB_565_SkColorType:
65 *out = RGB_565; 65 *out = RGB_565;
66 break; 66 break;
67 case SkBitmap::kARGB_4444_Config: 67 case kARGB_4444_SkColorType:
68 *out = ARGB_4444; 68 *out = ARGB_4444;
69 break; 69 break;
70 case SkBitmap::kARGB_8888_Config: 70 case kN32_SkColorType:
71 *out = ARGB_8888; 71 *out = ARGB_8888;
72 break; 72 break;
73 default: return false; 73 default: return false;
74 } 74 }
75 return true; 75 return true;
76 } 76 }
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().config(), &format)) 87 if (!ColorTypeToFormat(it->sk_bitmap().colorType(), &format))
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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 for (int i = 0; i < app_count; ++i) { 236 for (int i = 0; i < app_count; ++i) {
237 scoped_ptr<AppListItem> item(UnpickleAppListItem(&it).Pass()); 237 scoped_ptr<AppListItem> item(UnpickleAppListItem(&it).Pass());
238 if (!item) 238 if (!item)
239 return scoped_ptr<AppListModel>(); 239 return scoped_ptr<AppListModel>();
240 std::string folder_id = item->folder_id(); 240 std::string folder_id = item->folder_id();
241 model->AddItemToFolder(item.Pass(), folder_id); 241 model->AddItemToFolder(item.Pass(), folder_id);
242 } 242 }
243 243
244 return model.Pass(); 244 return model.Pass();
245 } 245 }
OLDNEW
« no previous file with comments | « chrome/browser/thumbnails/content_analysis_unittest.cc ('k') | chrome/browser/web_applications/web_app_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698