[viz] Remove SinglePlaneFormat::FromBufferFormat
Remove duplicate FromBufferFormat method to instead use
GetSharedImageFormat method.
Bug: 348414996
Change-Id: Ia599003d3a0cf75848b92dc20830c54f081a88b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5676450
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1323341}
diff --git a/components/viz/common/resources/shared_image_format.cc b/components/viz/common/resources/shared_image_format.cc
index 6100603..13fdcdb 100644
--- a/components/viz/common/resources/shared_image_format.cc
+++ b/components/viz/common/resources/shared_image_format.cc
@@ -524,44 +524,4 @@
std::tie(o.plane_config, o.subsampling, o.channel_format);
}
-// static
-SharedImageFormat SinglePlaneFormat::FromBufferFormat(
- gfx::BufferFormat format) {
- switch (format) {
- case gfx::BufferFormat::R_8:
- return SinglePlaneFormat::kR_8;
- case gfx::BufferFormat::R_16:
- return SinglePlaneFormat::kR_16;
- case gfx::BufferFormat::RG_88:
- return SinglePlaneFormat::kRG_88;
- case gfx::BufferFormat::RG_1616:
- return SinglePlaneFormat::kRG_1616;
- case gfx::BufferFormat::BGR_565:
- return SinglePlaneFormat::kBGR_565;
- case gfx::BufferFormat::RGBA_4444:
- return SinglePlaneFormat::kRGBA_4444;
- case gfx::BufferFormat::RGBX_8888:
- return SinglePlaneFormat::kRGBX_8888;
- case gfx::BufferFormat::RGBA_8888:
- return SinglePlaneFormat::kRGBA_8888;
- case gfx::BufferFormat::BGRX_8888:
- return SinglePlaneFormat::kBGRX_8888;
- case gfx::BufferFormat::BGRA_1010102:
- return SinglePlaneFormat::kBGRA_1010102;
- case gfx::BufferFormat::RGBA_1010102:
- return SinglePlaneFormat::kRGBA_1010102;
- case gfx::BufferFormat::BGRA_8888:
- return SinglePlaneFormat::kBGRA_8888;
- case gfx::BufferFormat::RGBA_F16:
- return SinglePlaneFormat::kRGBA_F16;
- case gfx::BufferFormat::YVU_420:
- case gfx::BufferFormat::YUV_420_BIPLANAR:
- case gfx::BufferFormat::YUVA_420_TRIPLANAR:
- case gfx::BufferFormat::P010:
- // Don't support multiplane formats.
- break;
- }
- NOTREACHED();
-}
-
} // namespace viz
diff --git a/components/viz/common/resources/shared_image_format.h b/components/viz/common/resources/shared_image_format.h
index 48748ed..db05c171f 100644
--- a/components/viz/common/resources/shared_image_format.h
+++ b/components/viz/common/resources/shared_image_format.h
@@ -17,7 +17,6 @@
#include "mojo/public/cpp/bindings/struct_traits.h"
#include "mojo/public/cpp/bindings/union_traits.h"
#include "services/viz/public/mojom/compositing/internal/singleplanar_format.mojom.h"
-#include "ui/gfx/buffer_types.h"
#include "ui/gfx/geometry/size.h"
namespace viz {
@@ -316,9 +315,6 @@
kRGB_565, kBGR_565, kETC1, kR_8, kRG_88,
kLUMINANCE_F16, kRGBA_F16, kR_16, kRG_1616, kRGBX_8888,
kBGRX_8888, kRGBA_1010102, kBGRA_1010102, kR_F16};
-
- static COMPONENT_EXPORT(VIZ_SHARED_IMAGE_FORMAT) SharedImageFormat
- FromBufferFormat(gfx::BufferFormat format);
};
// Constants for legacy single-plane representations of multiplanar formats.
diff --git a/components/viz/service/surfaces/surface_saved_frame.cc b/components/viz/service/surfaces/surface_saved_frame.cc
index 81f1403..428262c 100644
--- a/components/viz/service/surfaces/surface_saved_frame.cc
+++ b/components/viz/service/surfaces/surface_saved_frame.cc
@@ -22,7 +22,7 @@
#include "components/viz/common/quads/compositor_render_pass.h"
#include "components/viz/common/quads/compositor_render_pass_draw_quad.h"
#include "components/viz/common/quads/draw_quad.h"
-#include "components/viz/common/resources/shared_image_format.h"
+#include "components/viz/common/resources/shared_image_format_utils.h"
#include "components/viz/common/transition_utils.h"
#include "components/viz/service/surfaces/surface.h"
#include "gpu/command_buffer/client/client_shared_image.h"
@@ -197,9 +197,9 @@
const auto& display_color_spaces = directive_.display_color_spaces();
bool has_transparent_background = render_pass.has_transparent_background;
- auto image_format = SinglePlaneFormat::FromBufferFormat(
- display_color_spaces.GetOutputBufferFormat(content_color_usage,
- has_transparent_background));
+ auto image_format =
+ GetSharedImageFormat(display_color_spaces.GetOutputBufferFormat(
+ content_color_usage, has_transparent_background));
auto color_space = ColorSpaceUtils::CompositingColorSpace(
display_color_spaces, content_color_usage, has_transparent_background);