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

Side by Side Diff: ui/gfx/ipc/skia/gfx_skia_param_traits.cc

Issue 2823003002: SkBitmap and SkPixelRef no longer need lock/unlock (Closed)
Patch Set: win fix after rebase Created 3 years, 8 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
« no previous file with comments | « ui/gfx/ipc/skia/OWNERS ('k') | ui/gfx/skbitmap_operations.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ui/gfx/ipc/skia/gfx_skia_param_traits.h" 5 #include "ui/gfx/ipc/skia/gfx_skia_param_traits.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/pickle.h" 9 #include "base/pickle.h"
10 #include "third_party/skia/include/core/SkBitmap.h" 10 #include "third_party/skia/include/core/SkBitmap.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 s->AddData(static_cast<int>(p.getSize())); 57 s->AddData(static_cast<int>(p.getSize()));
58 } 58 }
59 59
60 void ParamTraits<SkBitmap>::Write(base::Pickle* m, const SkBitmap& p) { 60 void ParamTraits<SkBitmap>::Write(base::Pickle* m, const SkBitmap& p) {
61 size_t fixed_size = sizeof(SkBitmap_Data); 61 size_t fixed_size = sizeof(SkBitmap_Data);
62 SkBitmap_Data bmp_data; 62 SkBitmap_Data bmp_data;
63 bmp_data.InitSkBitmapDataForTransfer(p); 63 bmp_data.InitSkBitmapDataForTransfer(p);
64 m->WriteData(reinterpret_cast<const char*>(&bmp_data), 64 m->WriteData(reinterpret_cast<const char*>(&bmp_data),
65 static_cast<int>(fixed_size)); 65 static_cast<int>(fixed_size));
66 size_t pixel_size = p.getSize(); 66 size_t pixel_size = p.getSize();
67 SkAutoLockPixels p_lock(p);
68 m->WriteData(reinterpret_cast<const char*>(p.getPixels()), 67 m->WriteData(reinterpret_cast<const char*>(p.getPixels()),
69 static_cast<int>(pixel_size)); 68 static_cast<int>(pixel_size));
70 } 69 }
71 70
72 bool ParamTraits<SkBitmap>::Read(const base::Pickle* m, 71 bool ParamTraits<SkBitmap>::Read(const base::Pickle* m,
73 base::PickleIterator* iter, 72 base::PickleIterator* iter,
74 SkBitmap* r) { 73 SkBitmap* r) {
75 const char* fixed_data; 74 const char* fixed_data;
76 int fixed_data_size = 0; 75 int fixed_data_size = 0;
77 if (!iter->ReadData(&fixed_data, &fixed_data_size) || 76 if (!iter->ReadData(&fixed_data, &fixed_data_size) ||
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 l->append("("); 135 l->append("(");
137 for (int i = 0; i < 16; ++i) { 136 for (int i = 0; i < 16; ++i) {
138 if (i > 0) 137 if (i > 0)
139 l->append(", "); 138 l->append(", ");
140 LogParam(row_major_data[i], l); 139 LogParam(row_major_data[i], l);
141 } 140 }
142 l->append(") "); 141 l->append(") ");
143 } 142 }
144 143
145 } // namespace IPC 144 } // namespace IPC
OLDNEW
« no previous file with comments | « ui/gfx/ipc/skia/OWNERS ('k') | ui/gfx/skbitmap_operations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698