chore: bump chromium to 131.0.6776.0 (main) (#44137)
* chore: bump chromium in DEPS to 131.0.6763.0 * chore: bump chromium in DEPS to 131.0.6764.0 * update patches * chore: bump chromium in DEPS to 131.0.6766.0 * chore: update patches * Use PathInfo in FileSystemAccess code Refs5872329
* Modernize image utilities. Refs5905226
* [DevTools] move feature flags to the devtools directory Refs5913878
* chore: bump chromium in DEPS to 131.0.6768.0 * chore: update patches * Remove experimental credshelper flags Refs4017a6c8b4
* Change gfx::[PNG|JPEG]Codec::Decode to return a SkBitmap Refs5917286
Refs5905621
* chore: script/gen-libc++-filenames.js * chore: bump chromium in DEPS to 131.0.6770.0 * chore: update patches * chore: bump chromium in DEPS to 131.0.6772.0 * chore: update patches * [UI] Add alias for mojo version of `MenuSourceType` Refs5803393
* Update Background Color for Task Manager Refresh Refs5875259
* chore: bump chromium in DEPS to 131.0.6774.0 * chore: bump chromium in DEPS to 131.0.6776.0 * chore: update patches * chore: update filenames.libcxx.gni * esm: remove --no-import-harmony-assertions https://github.com/nodejs/node/pull/54890 * 5507047: [import-attributes] Remove support for import assertions |5507047
* fixup: Change gfx::[PNG|JPEG]Codec::Decode to return a SkBitmap * chore: bump chromium in DEPS to 131.0.6778.0 * Revert "chore: bump chromium in DEPS to 131.0.6778.0" This reverts commit fb9092fc51700651aa4a245931f71ec1ca55a274. --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Jeremy Rose <nornagon@electronjs.org> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
This commit is contained in:
parent
72802c374b
commit
36b7cf341e
59 changed files with 395 additions and 325 deletions
|
@ -238,10 +238,12 @@ v8::Local<v8::Value> NativeImage::ToPNG(gin::Arguments* args) {
|
|||
|
||||
const SkBitmap bitmap =
|
||||
image_.AsImageSkia().GetRepresentation(scale_factor).GetBitmap();
|
||||
std::vector<unsigned char> encoded;
|
||||
gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &encoded);
|
||||
const char* data = reinterpret_cast<char*>(encoded.data());
|
||||
size_t size = encoded.size();
|
||||
std::optional<std::vector<uint8_t>> encoded =
|
||||
gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false);
|
||||
if (!encoded.has_value())
|
||||
return node::Buffer::New(args->isolate(), 0).ToLocalChecked();
|
||||
const char* data = reinterpret_cast<char*>(encoded->data());
|
||||
size_t size = encoded->size();
|
||||
return node::Buffer::Copy(args->isolate(), data, size).ToLocalChecked();
|
||||
}
|
||||
|
||||
|
@ -265,13 +267,13 @@ v8::Local<v8::Value> NativeImage::ToBitmap(gin::Arguments* args) {
|
|||
}
|
||||
|
||||
v8::Local<v8::Value> NativeImage::ToJPEG(v8::Isolate* isolate, int quality) {
|
||||
std::vector<unsigned char> output;
|
||||
gfx::JPEG1xEncodedDataFromImage(image_, quality, &output);
|
||||
if (output.empty())
|
||||
std::optional<std::vector<uint8_t>> encoded_image =
|
||||
gfx::JPEG1xEncodedDataFromImage(image_, quality);
|
||||
if (!encoded_image.has_value())
|
||||
return node::Buffer::New(isolate, 0).ToLocalChecked();
|
||||
return node::Buffer::Copy(isolate,
|
||||
reinterpret_cast<const char*>(&output.front()),
|
||||
output.size())
|
||||
return node::Buffer::Copy(
|
||||
isolate, reinterpret_cast<const char*>(&encoded_image->front()),
|
||||
encoded_image->size())
|
||||
.ToLocalChecked();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue