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

Side by Side Diff: components/arc/bitmap/bitmap_struct_traits.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 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 "components/arc/bitmap/bitmap_struct_traits.h" 5 #include "components/arc/bitmap/bitmap_struct_traits.h"
6 6
7 namespace mojo { 7 namespace mojo {
8 8
9 bool StructTraits<arc::mojom::ArcBitmapDataView, SkBitmap>:: 9 bool StructTraits<arc::mojom::ArcBitmapDataView, SkBitmap>::
10 Read(arc::mojom::ArcBitmapDataView data, SkBitmap* out) { 10 Read(arc::mojom::ArcBitmapDataView data, SkBitmap* out) {
(...skipping 12 matching lines...) Expand all
23 // doesn't copy and |data| and |bitmap| share the buffer. 23 // doesn't copy and |data| and |bitmap| share the buffer.
24 SkBitmap bitmap; 24 SkBitmap bitmap;
25 if (!bitmap.installPixels(info, 25 if (!bitmap.installPixels(info,
26 const_cast<uint8_t*>(pixel_data.data()), 26 const_cast<uint8_t*>(pixel_data.data()),
27 info.minRowBytes())) { 27 info.minRowBytes())) {
28 // Error in installing pixels. 28 // Error in installing pixels.
29 return false; 29 return false;
30 } 30 }
31 31
32 // Copy the pixels with converting color type. 32 // Copy the pixels with converting color type.
33 return bitmap.copyTo(out, kN32_SkColorType); 33 SkImageInfo image_info = info.makeColorType(kN32_SkColorType);
34 return out->tryAllocPixels(image_info) &&
35 bitmap.readPixels(image_info, out->getPixels(), out->rowBytes(), 0, 0);
34 } 36 }
35 37
36 } // namespace mojo 38 } // namespace mojo
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_render_frame_observer.cc ('k') | content/renderer/pepper/pepper_plugin_instance_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698