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

Side by Side Diff: ui/base/clipboard/clipboard_android.cc

Issue 361643002: setConfig is deprecated, use setInfo or allocPixels instead (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: don't call allocPixels+rowbytes yet (skia bug) 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
« no previous file with comments | « ui/base/clipboard/clipboard.cc ('k') | ui/base/cursor/cursor_loader_x11_unittest.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/base/clipboard/clipboard.h" 5 #include "ui/base/clipboard/clipboard.h"
6 6
7 #include "base/android/jni_string.h" 7 #include "base/android/jni_string.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 SkBitmap Clipboard::ReadImage(ClipboardType type) const { 299 SkBitmap Clipboard::ReadImage(ClipboardType type) const {
300 DCHECK(CalledOnValidThread()); 300 DCHECK(CalledOnValidThread());
301 DCHECK_EQ(type, CLIPBOARD_TYPE_COPY_PASTE); 301 DCHECK_EQ(type, CLIPBOARD_TYPE_COPY_PASTE);
302 std::string input = g_map.Get().Get(kBitmapFormat); 302 std::string input = g_map.Get().Get(kBitmapFormat);
303 303
304 SkBitmap bmp; 304 SkBitmap bmp;
305 if (!input.empty()) { 305 if (!input.empty()) {
306 DCHECK_LE(sizeof(gfx::Size), input.size()); 306 DCHECK_LE(sizeof(gfx::Size), input.size());
307 const gfx::Size* size = reinterpret_cast<const gfx::Size*>(input.data()); 307 const gfx::Size* size = reinterpret_cast<const gfx::Size*>(input.data());
308 308
309 bmp.setConfig(SkBitmap::kARGB_8888_Config, size->width(), size->height()); 309 bmp.allocN32Pixels(size->width(), size->height());
310 bmp.allocPixels();
311 310
312 DCHECK_EQ(sizeof(gfx::Size) + bmp.getSize(), input.size()); 311 DCHECK_EQ(sizeof(gfx::Size) + bmp.getSize(), input.size());
313 312
314 memcpy(bmp.getPixels(), input.data() + sizeof(gfx::Size), bmp.getSize()); 313 memcpy(bmp.getPixels(), input.data() + sizeof(gfx::Size), bmp.getSize());
315 } 314 }
316 return bmp; 315 return bmp;
317 } 316 }
318 317
319 void Clipboard::ReadCustomData(ClipboardType clipboard_type, 318 void Clipboard::ReadCustomData(ClipboardType clipboard_type,
320 const base::string16& type, 319 const base::string16& type,
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 const char* data_data, size_t data_len) { 433 const char* data_data, size_t data_len) {
435 g_map.Get().Set(format.data(), std::string(data_data, data_len)); 434 g_map.Get().Set(format.data(), std::string(data_data, data_len));
436 } 435 }
437 436
438 // See clipboard_android_initialization.h for more information. 437 // See clipboard_android_initialization.h for more information.
439 bool RegisterClipboardAndroid(JNIEnv* env) { 438 bool RegisterClipboardAndroid(JNIEnv* env) {
440 return RegisterNativesImpl(env); 439 return RegisterNativesImpl(env);
441 } 440 }
442 441
443 } // namespace ui 442 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/clipboard/clipboard.cc ('k') | ui/base/cursor/cursor_loader_x11_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698