mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Update Skia revision to pull in GL native interface construction fixes on iOS. (#3265)
* Update Skia revision to pull in GL native interface construction fixes on iOS. Fixed in https://skia-review.googlesource.com/c/5212/ * Use the new image encoder API from Skia.
This commit is contained in:
parent
f627e734c0
commit
cd9caf6de6
2
DEPS
2
DEPS
@ -23,7 +23,7 @@ vars = {
|
||||
'skia_git': 'https://skia.googlesource.com',
|
||||
'github_git': 'https://github.com',
|
||||
'base_revision': 'b2412302ed4e45bfb47d7b5c0c3418077009e1ce',
|
||||
'skia_revision': '06a65e2799eaead18f778792801406aff4aec0d9',
|
||||
'skia_revision': '130a118cc68f8f9973e9572356011de378463fea',
|
||||
|
||||
# Note: When updating the Dart revision, ensure that all entries that are
|
||||
# dependencies of dart are also updated
|
||||
|
||||
@ -17,14 +17,12 @@ bool PngPixelSerializer::onUseEncodedData(const void*, size_t) {
|
||||
}
|
||||
|
||||
SkData* PngPixelSerializer::onEncode(const SkPixmap& pixmap) {
|
||||
SkBitmap bitmap;
|
||||
SkDynamicMemoryWStream stream;
|
||||
|
||||
if (!bitmap.installPixels(pixmap)) {
|
||||
return nullptr;
|
||||
}
|
||||
bool encode_result = SkEncodeImage(
|
||||
&stream, pixmap, SkEncodedImageFormat::kPNG, 80 /* quality */);
|
||||
|
||||
return SkImageEncoder::EncodeData(bitmap, SkImageEncoder::Type::kPNG_Type,
|
||||
SkImageEncoder::kDefaultQuality);
|
||||
return encode_result ? stream.detachAsData().release() : nullptr;
|
||||
}
|
||||
|
||||
void SerializePicture(const std::string& path, SkPicture* picture) {
|
||||
|
||||
@ -11,10 +11,10 @@
|
||||
|
||||
#include "base/base64.h"
|
||||
#include "flutter/common/threads.h"
|
||||
#include "flutter/shell/common/picture_serializer.h"
|
||||
#include "flutter/shell/common/rasterizer.h"
|
||||
#include "flutter/shell/common/shell.h"
|
||||
#include "lib/ftl/memory/weak_ptr.h"
|
||||
#include "third_party/skia/include/core/SkImageEncoder.h"
|
||||
#include "third_party/skia/include/core/SkSurface.h"
|
||||
|
||||
namespace shell {
|
||||
@ -235,6 +235,22 @@ bool PlatformViewServiceProtocol::ListViews(const char* method,
|
||||
const char* PlatformViewServiceProtocol::kScreenshotExtensionName =
|
||||
"_flutter.screenshot";
|
||||
|
||||
static sk_sp<SkData> EncodeBitmapAsPNG(const SkBitmap& bitmap) {
|
||||
if (bitmap.empty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SkPixmap pixmap;
|
||||
if (!bitmap.peekPixels(&pixmap)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PngPixelSerializer serializer;
|
||||
sk_sp<SkData> data(serializer.encode(pixmap));
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
bool PlatformViewServiceProtocol::Screenshot(const char* method,
|
||||
const char** param_keys,
|
||||
const char** param_values,
|
||||
@ -250,12 +266,7 @@ bool PlatformViewServiceProtocol::Screenshot(const char* method,
|
||||
|
||||
latch.Wait();
|
||||
|
||||
if (bitmap.empty())
|
||||
return ErrorServer(json_object, "no screenshot available");
|
||||
|
||||
sk_sp<SkData> png(
|
||||
SkImageEncoder::EncodeData(bitmap, SkImageEncoder::Type::kPNG_Type,
|
||||
SkImageEncoder::kDefaultQuality));
|
||||
sk_sp<SkData> png(EncodeBitmapAsPNG(bitmap));
|
||||
|
||||
if (!png)
|
||||
return ErrorServer(json_object, "can not encode screenshot");
|
||||
|
||||
@ -85,6 +85,7 @@ bool GPUSurfaceGL::Setup() {
|
||||
flow::GLConnection connection;
|
||||
FTL_LOG(INFO) << "Failed to setup GL context. Aborting.";
|
||||
FTL_LOG(INFO) << connection.Description();
|
||||
return false;
|
||||
}
|
||||
|
||||
context_->setResourceCacheLimits(kMaxGaneshResourceCacheCount,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user