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

Side by Side Diff: content/renderer/pepper/pepper_plugin_instance_impl.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
« no previous file with comments | « components/arc/bitmap/bitmap_struct_traits.cc ('k') | content/shell/test_runner/pixel_dump.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 "content/renderer/pepper/pepper_plugin_instance_impl.h" 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bit_cast.h" 10 #include "base/bit_cast.h"
(...skipping 2790 matching lines...) Expand 10 before | Expand all | Expand 10 after
2801 return PP_FALSE; 2801 return PP_FALSE;
2802 2802
2803 std::unique_ptr<WebCursorInfo> custom_cursor( 2803 std::unique_ptr<WebCursorInfo> custom_cursor(
2804 new WebCursorInfo(WebCursorInfo::kTypeCustom)); 2804 new WebCursorInfo(WebCursorInfo::kTypeCustom));
2805 custom_cursor->hot_spot.x = hot_spot->x; 2805 custom_cursor->hot_spot.x = hot_spot->x;
2806 custom_cursor->hot_spot.y = hot_spot->y; 2806 custom_cursor->hot_spot.y = hot_spot->y;
2807 2807
2808 SkBitmap bitmap(image_data->GetMappedBitmap()); 2808 SkBitmap bitmap(image_data->GetMappedBitmap());
2809 // Make a deep copy, so that the cursor remains valid even after the original 2809 // Make a deep copy, so that the cursor remains valid even after the original
2810 // image data gets freed. 2810 // image data gets freed.
2811 if (!bitmap.copyTo(&custom_cursor->custom_image.GetSkBitmap())) { 2811 SkBitmap& dst = custom_cursor->custom_image.GetSkBitmap();
2812 if (!dst.tryAllocPixels(bitmap.info()) ||
2813 !bitmap.readPixels(dst.info(), dst.getPixels(), dst.rowBytes(), 0, 0)) {
2812 return PP_FALSE; 2814 return PP_FALSE;
2813 } 2815 }
2814 2816
2815 DoSetCursor(custom_cursor.release()); 2817 DoSetCursor(custom_cursor.release());
2816 return PP_TRUE; 2818 return PP_TRUE;
2817 } 2819 }
2818 2820
2819 int32_t PepperPluginInstanceImpl::LockMouse( 2821 int32_t PepperPluginInstanceImpl::LockMouse(
2820 PP_Instance instance, 2822 PP_Instance instance,
2821 scoped_refptr<TrackedCallback> callback) { 2823 scoped_refptr<TrackedCallback> callback) {
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
3453 const cc::TextureMailbox& mailbox) const { 3455 const cc::TextureMailbox& mailbox) const {
3454 auto it = 3456 auto it =
3455 std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(), 3457 std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(),
3456 [&mailbox](const TextureMailboxRefCount& ref_count) { 3458 [&mailbox](const TextureMailboxRefCount& ref_count) {
3457 return ref_count.first.mailbox() == mailbox.mailbox(); 3459 return ref_count.first.mailbox() == mailbox.mailbox();
3458 }); 3460 });
3459 return it != texture_ref_counts_.end(); 3461 return it != texture_ref_counts_.end();
3460 } 3462 }
3461 3463
3462 } // namespace content 3464 } // namespace content
OLDNEW
« no previous file with comments | « components/arc/bitmap/bitmap_struct_traits.cc ('k') | content/shell/test_runner/pixel_dump.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698