SkBitmap and SkPixelRef no longer need lock/unlock
https://codereview.chromium.org/2823003002
This commit is contained in:
parent
ea4a36039a
commit
ea8e113b19
5 changed files with 0 additions and 12 deletions
|
@ -89,7 +89,6 @@ void FrameSubscriber::OnFrameDelivered(const FrameCaptureCallback& callback,
|
||||||
auto local_buffer = buffer.ToLocalChecked();
|
auto local_buffer = buffer.ToLocalChecked();
|
||||||
|
|
||||||
{
|
{
|
||||||
SkAutoLockPixels lock(bitmap);
|
|
||||||
auto source = static_cast<const unsigned char*>(bitmap.getPixels());
|
auto source = static_cast<const unsigned char*>(bitmap.getPixels());
|
||||||
auto target = node::Buffer::Data(local_buffer);
|
auto target = node::Buffer::Data(local_buffer);
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,6 @@ void OffScreenOutputDevice::OnPaint(const gfx::Rect& damage_rect) {
|
||||||
if (rect.IsEmpty())
|
if (rect.IsEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SkAutoLockPixels bitmap_pixels_lock(*bitmap_);
|
|
||||||
callback_.Run(rect, *bitmap_);
|
callback_.Run(rect, *bitmap_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -943,9 +943,6 @@ void CopyBitmapTo(
|
||||||
const SkBitmap& destination,
|
const SkBitmap& destination,
|
||||||
const SkBitmap& source,
|
const SkBitmap& source,
|
||||||
const gfx::Rect& pos) {
|
const gfx::Rect& pos) {
|
||||||
SkAutoLockPixels source_pixels_lock(source);
|
|
||||||
SkAutoLockPixels destination_pixels_lock(destination);
|
|
||||||
|
|
||||||
char* src = static_cast<char*>(source.getPixels());
|
char* src = static_cast<char*>(source.getPixels());
|
||||||
char* dest = static_cast<char*>(destination.getPixels());
|
char* dest = static_cast<char*>(destination.getPixels());
|
||||||
int pixelsize = source.bytesPerPixel();
|
int pixelsize = source.bytesPerPixel();
|
||||||
|
|
|
@ -18,8 +18,6 @@ void Win32Notification::Show(const NotificationOptions& options) {
|
||||||
|
|
||||||
if (!options.icon.drawsNothing()) {
|
if (!options.icon.drawsNothing()) {
|
||||||
if (options.icon.colorType() == kBGRA_8888_SkColorType) {
|
if (options.icon.colorType() == kBGRA_8888_SkColorType) {
|
||||||
options.icon.lockPixels();
|
|
||||||
|
|
||||||
BITMAPINFOHEADER bmi = { sizeof(BITMAPINFOHEADER) };
|
BITMAPINFOHEADER bmi = { sizeof(BITMAPINFOHEADER) };
|
||||||
bmi.biWidth = options.icon.width();
|
bmi.biWidth = options.icon.width();
|
||||||
bmi.biHeight = -options.icon.height();
|
bmi.biHeight = -options.icon.height();
|
||||||
|
@ -33,8 +31,6 @@ void Win32Notification::Show(const NotificationOptions& options) {
|
||||||
reinterpret_cast<BITMAPINFO*>(&bmi),
|
reinterpret_cast<BITMAPINFO*>(&bmi),
|
||||||
DIB_RGB_COLORS);
|
DIB_RGB_COLORS);
|
||||||
ReleaseDC(NULL, hdcScreen);
|
ReleaseDC(NULL, hdcScreen);
|
||||||
|
|
||||||
options.icon.unlockPixels();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,6 @@ gfx::ImageSkia ScaleDesktopFrame(std::unique_ptr<webrtc::DesktopFrame> frame,
|
||||||
|
|
||||||
SkBitmap result;
|
SkBitmap result;
|
||||||
result.allocN32Pixels(scaled_rect.width(), scaled_rect.height(), true);
|
result.allocN32Pixels(scaled_rect.width(), scaled_rect.height(), true);
|
||||||
result.lockPixels();
|
|
||||||
|
|
||||||
uint8* pixels_data = reinterpret_cast<uint8*>(result.getPixels());
|
uint8* pixels_data = reinterpret_cast<uint8*>(result.getPixels());
|
||||||
libyuv::ARGBScale(frame->data(), frame->stride(),
|
libyuv::ARGBScale(frame->data(), frame->stride(),
|
||||||
|
@ -69,8 +68,6 @@ gfx::ImageSkia ScaleDesktopFrame(std::unique_ptr<webrtc::DesktopFrame> frame,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result.unlockPixels();
|
|
||||||
|
|
||||||
return gfx::ImageSkia::CreateFrom1xBitmap(result);
|
return gfx::ImageSkia::CreateFrom1xBitmap(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue