0

Disable legacy SkImage factories

Follow-up to https://skia-review.googlesource.com/c/skia/+/661059
and https://chromium-review.googlesource.com/c/chromium/src/+/4348201

Chromium and all deps should be migrated to the new APIs at this
point, so we can set SK_DISABLE_LEGACY_IMAGE_FACTORIES to
prevent unintentional use.

Bug: skia:13983
Change-Id: Ibf7a7f900c142f6b6ab803758364aa98f84ef01b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4388783
Commit-Queue: Kevin Lubick <kjlubick@chromium.org>
Reviewed-by: ccameron chromium <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1124742}
This commit is contained in:
Kevin Lubick
2023-03-31 15:31:43 +00:00
committed by Chromium LUCI CQ
parent 95de6f1455
commit aedee7ddca
2 changed files with 4 additions and 3 deletions

@ -416,7 +416,7 @@ sk_sp<SkImage> ReadImage(
if (plane_config == SkYUVAInfo::PlaneConfig::kUnknown) { if (plane_config == SkYUVAInfo::PlaneConfig::kUnknown) {
// Point `image_` directly to the data in the transfer cache. // Point `image_` directly to the data in the transfer cache.
auto image = SkImage::MakeFromRaster(pixmaps[0], nullptr, nullptr); auto image = SkImages::RasterFromPixmap(pixmaps[0], nullptr, nullptr);
if (!image) { if (!image) {
DLOG(ERROR) << "Failed to create image from pixmap"; DLOG(ERROR) << "Failed to create image from pixmap";
return nullptr; return nullptr;
@ -450,7 +450,7 @@ sk_sp<SkImage> ReadImage(
std::vector<sk_sp<SkImage>> plane_images; std::vector<sk_sp<SkImage>> plane_images;
for (int i = 0; i < num_pixmaps; i++) { for (int i = 0; i < num_pixmaps; i++) {
sk_sp<SkImage> plane = sk_sp<SkImage> plane =
SkImage::MakeFromRaster(pixmaps[i], nullptr, nullptr); SkImages::RasterFromPixmap(pixmaps[i], nullptr, nullptr);
if (!plane) { if (!plane) {
DLOG(ERROR) << "Failed to create image from plane pixmap"; DLOG(ERROR) << "Failed to create image from plane pixmap";
return nullptr; return nullptr;
@ -723,7 +723,7 @@ bool ServiceImageTransferCacheEntry::Deserialize(
if (!image_->peekPixels(&pixmap)) { if (!image_->peekPixels(&pixmap)) {
NOTREACHED() << "Image should be referencing transfer buffer SkPixmap"; NOTREACHED() << "Image should be referencing transfer buffer SkPixmap";
} }
image_ = SkImage::MakeRasterCopy(pixmap); image_ = SkImages::RasterFromPixmapCopy(pixmap);
if (!image_) { if (!image_) {
DLOG(ERROR) << "Failed to create raster copy"; DLOG(ERROR) << "Failed to create raster copy";
return false; return false;

@ -44,6 +44,7 @@ config("skia_config") {
"SK_UNTIL_CRBUG_1187654_IS_FIXED", "SK_UNTIL_CRBUG_1187654_IS_FIXED",
"SK_USER_CONFIG_HEADER=\"../../skia/config/SkUserConfig.h\"", "SK_USER_CONFIG_HEADER=\"../../skia/config/SkUserConfig.h\"",
"SK_WIN_FONTMGR_NO_SIMULATIONS", "SK_WIN_FONTMGR_NO_SIMULATIONS",
"SK_DISABLE_LEGACY_IMAGE_FACTORIES",
] ]
include_dirs = [ "//third_party/skia" ] include_dirs = [ "//third_party/skia" ]