From b997c2ffc1d987e9cbe0c54029af1e7ec1c3329f Mon Sep 17 00:00:00 2001 From: Aleksei Kuzmin Date: Tue, 20 Jun 2017 20:10:21 +0300 Subject: [PATCH] Don't call deprecated copyPixelsTo don't call deprecated copyPixelsTo https://codereview.chromium.org/2812853002 stop using copyPixelsTo -- deprecated https://codereview.chromium.org/2798413002 remove unused SkBitmap::copyPixelsTo https://skia-review.googlesource.com/c/13171/ --- atom/browser/api/frame_subscriber.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/atom/browser/api/frame_subscriber.cc b/atom/browser/api/frame_subscriber.cc index e532cb4312..ce9f8cb338 100644 --- a/atom/browser/api/frame_subscriber.cc +++ b/atom/browser/api/frame_subscriber.cc @@ -14,6 +14,18 @@ namespace atom { +namespace { + +void CopyPixelsToBuffer(const SkBitmap& bitmap, + const v8::Local& buffer) { + size_t rgb_arr_size = bitmap.width() * bitmap.height() * + bitmap.bytesPerPixel(); + + memcpy(node::Buffer::Data(buffer), bitmap.getPixels(), rgb_arr_size); +} + +} // namespace + namespace api { FrameSubscriber::FrameSubscriber(v8::Isolate* isolate, @@ -84,9 +96,7 @@ void FrameSubscriber::OnFrameDelivered(const FrameCaptureCallback& callback, if (buffer.IsEmpty()) return; - bitmap.copyPixelsTo( - reinterpret_cast(node::Buffer::Data(buffer.ToLocalChecked())), - rgb_arr_size); + CopyPixelsToBuffer(bitmap, buffer.ToLocalChecked()); v8::Local damage = mate::Converter::ToV8(isolate_, damage_rect);