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

Side by Side Diff: headless/lib/browser/headless_clipboard.cc

Issue 2855503003: Replace uses of legacy SkBitmap::copyTo() API (Closed)
Patch Set: Remove braces Created 3 years, 7 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "headless/lib/browser/headless_clipboard.h" 5 #include "headless/lib/browser/headless_clipboard.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/numerics/safe_conversions.h" 8 #include "base/numerics/safe_conversions.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 10
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 159 }
160 160
161 void HeadlessClipboard::WriteWebSmartPaste() { 161 void HeadlessClipboard::WriteWebSmartPaste() {
162 // Create a dummy entry. 162 // Create a dummy entry.
163 GetDefaultStore().data[GetWebKitSmartPasteFormatType()]; 163 GetDefaultStore().data[GetWebKitSmartPasteFormatType()];
164 } 164 }
165 165
166 void HeadlessClipboard::WriteBitmap(const SkBitmap& bitmap) { 166 void HeadlessClipboard::WriteBitmap(const SkBitmap& bitmap) {
167 // Create a dummy entry. 167 // Create a dummy entry.
168 GetDefaultStore().data[GetBitmapFormatType()]; 168 GetDefaultStore().data[GetBitmapFormatType()];
169 bitmap.copyTo(&GetDefaultStore().image); 169 SkBitmap& dst = GetDefaultStore().image;
170 if (dst.tryAllocPixels(bitmap.info())) {
171 bitmap.readPixels(dst.info(), dst.getPixels(), dst.rowBytes(), 0, 0);
172 }
170 } 173 }
171 174
172 void HeadlessClipboard::WriteData(const FormatType& format, 175 void HeadlessClipboard::WriteData(const FormatType& format,
173 const char* data_data, 176 const char* data_data,
174 size_t data_len) { 177 size_t data_len) {
175 GetDefaultStore().data[format] = std::string(data_data, data_len); 178 GetDefaultStore().data[format] = std::string(data_data, data_len);
176 } 179 }
177 180
178 HeadlessClipboard::DataStore::DataStore() : sequence_number(0) {} 181 HeadlessClipboard::DataStore::DataStore() : sequence_number(0) {}
179 182
(...skipping 24 matching lines...) Expand all
204 207
205 const HeadlessClipboard::DataStore& HeadlessClipboard::GetDefaultStore() const { 208 const HeadlessClipboard::DataStore& HeadlessClipboard::GetDefaultStore() const {
206 return GetStore(default_store_type_); 209 return GetStore(default_store_type_);
207 } 210 }
208 211
209 HeadlessClipboard::DataStore& HeadlessClipboard::GetDefaultStore() { 212 HeadlessClipboard::DataStore& HeadlessClipboard::GetDefaultStore() {
210 return GetStore(default_store_type_); 213 return GetStore(default_store_type_);
211 } 214 }
212 215
213 } // namespace headless 216 } // namespace headless
OLDNEW
« no previous file with comments | « content/shell/test_runner/pixel_dump.cc ('k') | ios/chrome/browser/google/google_logo_service.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698