Migrate uses of SkSurface factories
In http://review.skia.org/687639, many SkSurface static methods were moved and one was deleted (SkSurface::MakeRasterN32Premul). This changes the calls in Chromium to match those moved functions. There should be no functional difference and everything was done pretty mechanically (e.g. find and replace, regexes, git cl format). Bug: skia:13983 Change-Id: Iffbfae6b03bd002fe833ae994089318b051b0d43 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4518554 Commit-Queue: Kevin Lubick <kjlubick@chromium.org> Reviewed-by: Dale Curtis <dalecurtis@chromium.org> Cr-Commit-Position: refs/heads/main@{#1143250}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
72164ee68b
commit
682f84e1ca
android_webview/test/shell/src/draw_fn
cc
layers
paint
raster
tiles
trees
chrome/browser/vr
content/browser/gpu
media/renderers
pdf
skia/ext
testing/libfuzzer/fuzzers
third_party/blink/renderer
bindings
core
v8
serialization
core
clipboard
html
imagebitmap
layout
offscreencanvas
page
paint
modules
webcodecs
platform
ui
base
gfx
ozone
demo
platform
drm
flatland
headless
scenic
wayland
@ -573,7 +573,7 @@ base::android::ScopedJavaLocalRef<jintArray> ContextManagerVulkan::Draw(
|
||||
auto sk_color_type = surface_format == VK_FORMAT_B8G8R8A8_UNORM
|
||||
? kBGRA_8888_SkColorType
|
||||
: kRGBA_8888_SkColorType;
|
||||
sk_surface = SkSurface::MakeFromBackendRenderTarget(
|
||||
sk_surface = SkSurfaces::WrapBackendRenderTarget(
|
||||
gr_context_.get(), render_target, kTopLeft_GrSurfaceOrigin,
|
||||
sk_color_type, gfx::ColorSpace::CreateSRGB().ToSkColorSpace(),
|
||||
&surface_props);
|
||||
|
@ -390,8 +390,9 @@ void HeadsUpDisplayLayerImpl::UpdateHudTexture(
|
||||
staging_surface_->getCanvas()->getBaseLayerSize()) !=
|
||||
pool_resource.size()) {
|
||||
SkSurfaceProps props = skia::LegacyDisplayGlobals::GetSkSurfaceProps();
|
||||
staging_surface_ = SkSurface::MakeRasterN32Premul(
|
||||
pool_resource.size().width(), pool_resource.size().height(),
|
||||
staging_surface_ = SkSurfaces::Raster(
|
||||
SkImageInfo::MakeN32Premul(pool_resource.size().width(),
|
||||
pool_resource.size().height()),
|
||||
&props);
|
||||
}
|
||||
|
||||
@ -420,7 +421,7 @@ void HeadsUpDisplayLayerImpl::UpdateHudTexture(
|
||||
auto* backing =
|
||||
static_cast<HudSoftwareBacking*>(pool_resource.software_backing());
|
||||
SkSurfaceProps props = skia::LegacyDisplayGlobals::GetSkSurfaceProps();
|
||||
sk_sp<SkSurface> surface = SkSurface::MakeRasterDirect(
|
||||
sk_sp<SkSurface> surface = SkSurfaces::WrapPixels(
|
||||
info, backing->shared_mapping.memory(), info.minRowBytes(), &props);
|
||||
|
||||
SkiaPaintCanvas canvas(surface->getCanvas());
|
||||
|
@ -351,7 +351,8 @@ TEST_F(DisplayItemListTest, FilterPairedRange) {
|
||||
unsigned char pixels[4 * 100 * 100] = {0};
|
||||
auto list = base::MakeRefCounted<DisplayItemList>();
|
||||
|
||||
sk_sp<SkSurface> source_surface = SkSurface::MakeRasterN32Premul(50, 50);
|
||||
sk_sp<SkSurface> source_surface =
|
||||
SkSurfaces::Raster(SkImageInfo::MakeN32Premul(50, 50));
|
||||
SkCanvas* source_canvas = source_surface->getCanvas();
|
||||
source_canvas->clear(SkColorSetRGB(128, 128, 128));
|
||||
PaintImage source_image = PaintImageBuilder::WithDefault()
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "third_party/skia/include/core/SkYUVAInfo.h"
|
||||
#include "third_party/skia/include/gpu/GpuTypes.h"
|
||||
#include "third_party/skia/include/gpu/GrDirectContext.h"
|
||||
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
|
||||
#include "ui/gfx/geometry/rect_conversions.h"
|
||||
#include "ui/gfx/geometry/skia_conversions.h"
|
||||
#include "ui/gl/gl_implementation.h"
|
||||
@ -1748,7 +1749,7 @@ class OopTextBlobPixelTest
|
||||
SkSurfaceProps surface_props =
|
||||
UseLcdText() ? skia::LegacyDisplayGlobals::GetSkSurfaceProps(0)
|
||||
: SkSurfaceProps(0, kUnknown_SkPixelGeometry);
|
||||
auto surface = SkSurface::MakeRenderTarget(
|
||||
auto surface = SkSurfaces::RenderTarget(
|
||||
context_state->gr_context(), skgpu::Budgeted::kNo, image_info, 0,
|
||||
kTopLeft_GrSurfaceOrigin, &surface_props);
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "third_party/skia/include/core/SkSurface.h"
|
||||
#include "third_party/skia/include/gpu/GpuTypes.h"
|
||||
#include "third_party/skia/include/gpu/GrDirectContext.h"
|
||||
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
|
||||
|
||||
struct Environment {
|
||||
Environment() {
|
||||
@ -77,7 +78,7 @@ void Raster(scoped_refptr<viz::TestContextProvider> context_provider,
|
||||
SkImageInfo image_info = SkImageInfo::MakeN32(
|
||||
kRasterDimension, kRasterDimension, kOpaque_SkAlphaType);
|
||||
context_provider->BindToCurrentSequence();
|
||||
sk_sp<SkSurface> surface = SkSurface::MakeRenderTarget(
|
||||
sk_sp<SkSurface> surface = SkSurfaces::RenderTarget(
|
||||
context_provider->GrContext(), skgpu::Budgeted::kYes, image_info);
|
||||
SkCanvas* canvas = surface->getCanvas();
|
||||
|
||||
|
@ -119,7 +119,7 @@ TEST(PaintShaderTest, DecodePaintRecord) {
|
||||
|
||||
// The rasterization of the shader is internal to skia, so use a raster canvas
|
||||
// to verify that the decoded paint does not have the encoded image.
|
||||
auto surface = SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(100, 100));
|
||||
auto surface = SkSurfaces::Raster(SkImageInfo::MakeN32Premul(100, 100));
|
||||
surface->getCanvas()->drawPaint(canvas.paint_);
|
||||
|
||||
// Using the shader requests decode for images at the correct scale.
|
||||
|
@ -81,7 +81,7 @@ void RasterBufferProvider::PlaybackToMemory(
|
||||
(format == viz::SinglePlaneFormat::kBGRA_8888) ||
|
||||
(format == viz::SinglePlaneFormat::kRGBA_F16)) {
|
||||
sk_sp<SkSurface> surface =
|
||||
SkSurface::MakeRasterDirect(info, memory, stride, &surface_props);
|
||||
SkSurfaces::WrapPixels(info, memory, stride, &surface_props);
|
||||
// There are some rare crashes where this doesn't succeed and may be
|
||||
// indicative of memory stomps elsewhere. Instead of displaying
|
||||
// invalid content, just crash the renderer and try again.
|
||||
@ -94,7 +94,7 @@ void RasterBufferProvider::PlaybackToMemory(
|
||||
}
|
||||
|
||||
if (format == viz::SinglePlaneFormat::kRGBA_4444) {
|
||||
sk_sp<SkSurface> surface = SkSurface::MakeRaster(info, &surface_props);
|
||||
sk_sp<SkSurface> surface = SkSurfaces::Raster(info, &surface_props);
|
||||
// TODO(reveman): Improve partial raster support by reducing the size of
|
||||
// playback rect passed to PlaybackToCanvas. crbug.com/519070
|
||||
raster_source->PlaybackToCanvas(surface->getCanvas(), content_size,
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "third_party/skia/include/core/SkSurface.h"
|
||||
#include "third_party/skia/include/gpu/GpuTypes.h"
|
||||
#include "third_party/skia/include/gpu/GrDirectContext.h"
|
||||
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
|
||||
|
||||
namespace cc {
|
||||
namespace {
|
||||
@ -141,7 +142,7 @@ INSTANTIATE_TEST_SUITE_P(P,
|
||||
|
||||
TEST_P(GpuImageDecodeCachePerfTestNoSw, DecodeWithMips) {
|
||||
// Surface to render into.
|
||||
auto surface = SkSurface::MakeRenderTarget(
|
||||
auto surface = SkSurfaces::RenderTarget(
|
||||
context_provider_->GrContext(), skgpu::Budgeted::kNo,
|
||||
SkImageInfo::MakeN32Premul(2048, 2048));
|
||||
|
||||
|
@ -2052,8 +2052,8 @@ TEST_F(PixelInspectTileManagerTest, LowResHasNoImage) {
|
||||
SCOPED_TRACE(resolutions[i]);
|
||||
|
||||
// Make a RasterSource that will draw a blue bitmap image.
|
||||
sk_sp<SkSurface> surface =
|
||||
SkSurface::MakeRasterN32Premul(size.width(), size.height());
|
||||
sk_sp<SkSurface> surface = SkSurfaces::Raster(
|
||||
SkImageInfo::MakeN32Premul(size.width(), size.height()));
|
||||
ASSERT_NE(surface, nullptr);
|
||||
surface->getCanvas()->clear(SK_ColorBLUE);
|
||||
sk_sp<SkImage> blue_image = surface->makeImageSnapshot();
|
||||
|
@ -4684,7 +4684,7 @@ void LayerTreeHostImpl::CreateUIResource(UIResourceId uid,
|
||||
SkImageInfo dst_info =
|
||||
SkImageInfo::MakeN32Premul(gfx::SizeToSkISize(upload_size));
|
||||
|
||||
sk_sp<SkSurface> surface = SkSurface::MakeRasterDirect(
|
||||
sk_sp<SkSurface> surface = SkSurfaces::WrapPixels(
|
||||
dst_info, shm.mapping.memory(), dst_info.minRowBytes());
|
||||
surface->getCanvas()->writePixels(
|
||||
src_info, const_cast<uint8_t*>(bitmap.GetPixels()),
|
||||
@ -4715,13 +4715,13 @@ void LayerTreeHostImpl::CreateUIResource(UIResourceId uid,
|
||||
// directly into the shared memory backing.
|
||||
sk_sp<SkSurface> scaled_surface;
|
||||
if (layer_tree_frame_sink_->context_provider()) {
|
||||
scaled_surface = SkSurface::MakeRasterN32Premul(upload_size.width(),
|
||||
upload_size.height());
|
||||
scaled_surface = SkSurfaces::Raster(SkImageInfo::MakeN32Premul(
|
||||
upload_size.width(), upload_size.height()));
|
||||
} else {
|
||||
SkImageInfo dst_info =
|
||||
SkImageInfo::MakeN32Premul(gfx::SizeToSkISize(upload_size));
|
||||
scaled_surface = SkSurface::MakeRasterDirect(
|
||||
dst_info, shm.mapping.memory(), dst_info.minRowBytes());
|
||||
scaled_surface = SkSurfaces::WrapPixels(dst_info, shm.mapping.memory(),
|
||||
dst_info.minRowBytes());
|
||||
}
|
||||
SkCanvas* scaled_canvas = scaled_surface->getCanvas();
|
||||
scaled_canvas->scale(canvas_scale_x, canvas_scale_y);
|
||||
|
@ -102,7 +102,7 @@ class LayerTreeHostBlendingPixelTest
|
||||
const int kLaneWidth = width;
|
||||
const int kLaneHeight = height / kCSSTestColorsCount;
|
||||
sk_sp<SkSurface> backing_store =
|
||||
SkSurface::MakeRasterN32Premul(width, height);
|
||||
SkSurfaces::Raster(SkImageInfo::MakeN32Premul(width, height));
|
||||
SkCanvas* canvas = backing_store->getCanvas();
|
||||
canvas->clear(SK_ColorTRANSPARENT);
|
||||
for (int i = 0; i < kCSSTestColorsCount; ++i) {
|
||||
@ -130,8 +130,8 @@ class LayerTreeHostBlendingPixelTest
|
||||
void SetupMaskLayer(scoped_refptr<Layer> layer) {
|
||||
gfx::Size bounds = layer->bounds();
|
||||
|
||||
sk_sp<SkSurface> surface =
|
||||
SkSurface::MakeRasterN32Premul(bounds.width(), bounds.height());
|
||||
sk_sp<SkSurface> surface = SkSurfaces::Raster(
|
||||
SkImageInfo::MakeN32Premul(bounds.width(), bounds.height()));
|
||||
SkCanvas* canvas = surface->getCanvas();
|
||||
SkPaint paint;
|
||||
paint.setColor(SK_ColorWHITE);
|
||||
|
@ -323,7 +323,8 @@ TEST_P(LayerTreeHostMaskPixelTestWithLayerList, MaskWithEffectDifferentSize) {
|
||||
TEST_P(LayerTreeHostMaskPixelTestWithLayerList, ImageMaskWithEffect) {
|
||||
MaskContentLayerClient mask_client(mask_bounds_);
|
||||
|
||||
sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(50, 50);
|
||||
sk_sp<SkSurface> surface =
|
||||
SkSurfaces::Raster(SkImageInfo::MakeN32Premul(50, 50));
|
||||
SkCanvas* canvas = surface->getCanvas();
|
||||
scoped_refptr<DisplayItemList> mask_display_list =
|
||||
mask_client.PaintContentsToDisplayList();
|
||||
@ -349,7 +350,8 @@ TEST_P(LayerTreeHostMasksPixelTest, ImageMaskOfLayer) {
|
||||
|
||||
gfx::Size mask_bounds(50, 50);
|
||||
|
||||
sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(50, 50);
|
||||
sk_sp<SkSurface> surface =
|
||||
SkSurfaces::Raster(SkImageInfo::MakeN32Premul(50, 50));
|
||||
SkCanvas* canvas = surface->getCanvas();
|
||||
MaskContentLayerClient client(mask_bounds);
|
||||
scoped_refptr<DisplayItemList> mask_display_list =
|
||||
|
@ -34,7 +34,7 @@ CmdBufferSurfaceProvider::CmdBufferSurfaceProvider() {
|
||||
CmdBufferSurfaceProvider::~CmdBufferSurfaceProvider() = default;
|
||||
|
||||
sk_sp<SkSurface> CmdBufferSurfaceProvider::MakeSurface(const gfx::Size& size) {
|
||||
return SkSurface::MakeRenderTarget(
|
||||
return SkSurfaces::RenderTarget(
|
||||
gr_context_.get(), skgpu::Budgeted::kNo,
|
||||
SkImageInfo::MakeN32Premul(size.width(), size.height()), 0,
|
||||
kTopLeft_GrSurfaceOrigin, nullptr);
|
||||
|
@ -37,7 +37,7 @@ NativeGlSurfaceProvider::NativeGlSurfaceProvider() {
|
||||
NativeGlSurfaceProvider::~NativeGlSurfaceProvider() = default;
|
||||
|
||||
sk_sp<SkSurface> NativeGlSurfaceProvider::MakeSurface(const gfx::Size& size) {
|
||||
return SkSurface::MakeRenderTarget(
|
||||
return SkSurfaces::RenderTarget(
|
||||
gr_context_.get(), skgpu::Budgeted::kNo,
|
||||
SkImageInfo::MakeN32Premul(size.width(), size.height()), 0,
|
||||
kTopLeft_GrSurfaceOrigin, nullptr);
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "third_party/skia/include/core/SkSurface.h"
|
||||
#include "third_party/skia/include/gpu/GpuTypes.h"
|
||||
#include "third_party/skia/include/gpu/GrDirectContext.h"
|
||||
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
|
||||
#include "ui/gl/gl_switches.h"
|
||||
|
||||
namespace {
|
||||
@ -233,7 +234,7 @@ IN_PROC_BROWSER_TEST_F(BrowserGpuChannelHostFactoryTest,
|
||||
|
||||
SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100);
|
||||
sk_sp<SkSurface> surface =
|
||||
SkSurface::MakeRenderTarget(gr_context.get(), skgpu::Budgeted::kNo, info);
|
||||
SkSurfaces::RenderTarget(gr_context.get(), skgpu::Budgeted::kNo, info);
|
||||
EXPECT_TRUE(surface);
|
||||
|
||||
// Destroy the GL context after we made a surface.
|
||||
@ -241,7 +242,7 @@ IN_PROC_BROWSER_TEST_F(BrowserGpuChannelHostFactoryTest,
|
||||
|
||||
// New surfaces will fail to create now.
|
||||
sk_sp<SkSurface> surface2 =
|
||||
SkSurface::MakeRenderTarget(gr_context.get(), skgpu::Budgeted::kNo, info);
|
||||
SkSurfaces::RenderTarget(gr_context.get(), skgpu::Budgeted::kNo, info);
|
||||
EXPECT_FALSE(surface2);
|
||||
|
||||
// Drop our reference to the gr_context also.
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "third_party/skia/include/core/SkYUVAPixmaps.h"
|
||||
#include "third_party/skia/include/gpu/GrDirectContext.h"
|
||||
#include "third_party/skia/include/gpu/GrYUVABackendTextures.h"
|
||||
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
|
||||
#include "third_party/skia/include/gpu/gl/GrGLTypes.h"
|
||||
|
||||
namespace media {
|
||||
@ -216,7 +217,7 @@ bool VideoFrameYUVConverter::ConvertFromVideoFrameYUVWithGrContext(
|
||||
auto source_and_dest_color_space = SkColorSpace::MakeSRGB();
|
||||
|
||||
// Use dst texture as SkSurface back resource.
|
||||
auto surface = SkSurface::MakeFromBackendTexture(
|
||||
auto surface = SkSurfaces::WrapBackendTexture(
|
||||
gr_context, result_texture,
|
||||
gr_params.flip_y ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOrigin,
|
||||
1, GetCompatibleSurfaceColorType(result_gl_texture_info.fFormat),
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "third_party/skia/include/core/SkYUVAPixmaps.h"
|
||||
#include "third_party/skia/include/gpu/GrDirectContext.h"
|
||||
#include "third_party/skia/include/gpu/ganesh/SkImageGanesh.h"
|
||||
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
|
||||
#include "third_party/skia/include/gpu/gl/GrGLTypes.h"
|
||||
|
||||
namespace media {
|
||||
@ -239,7 +240,7 @@ bool VideoFrameYUVMailboxesHolder::VideoFrameToPlaneSkSurfaces(
|
||||
if (color_type == kGray_8_SkColorType)
|
||||
color_type = kAlpha_8_SkColorType;
|
||||
|
||||
auto surface = SkSurface::MakeFromBackendTexture(
|
||||
auto surface = SkSurfaces::WrapBackendTexture(
|
||||
gr_context, yuva_backend_textures.texture(plane),
|
||||
kTopLeft_GrSurfaceOrigin, /*sampleCnt=*/1, color_type,
|
||||
SkColorSpace::MakeSRGB(), nullptr);
|
||||
|
@ -213,8 +213,8 @@ void PaintManager::DoPaint() {
|
||||
: gfx::Size();
|
||||
gfx::Size new_size = GetNewContextSize(old_size, pending_size_);
|
||||
if (old_size != new_size || !surface_) {
|
||||
surface_ =
|
||||
SkSurface::MakeRasterN32Premul(new_size.width(), new_size.height());
|
||||
surface_ = SkSurfaces::Raster(
|
||||
SkImageInfo::MakeN32Premul(new_size.width(), new_size.height()));
|
||||
DCHECK(surface_);
|
||||
|
||||
// TODO(crbug.com/1317832): Can we guarantee repainting some other way?
|
||||
|
@ -48,7 +48,8 @@ testing::AssertionResult MatchesPngFile(
|
||||
|
||||
sk_sp<SkSurface> CreateSkiaSurfaceForTesting(const gfx::Size& size,
|
||||
SkColor color) {
|
||||
auto surface = SkSurface::MakeRasterN32Premul(size.width(), size.height());
|
||||
auto surface = SkSurfaces::Raster(
|
||||
SkImageInfo::MakeN32Premul(size.width(), size.height()));
|
||||
surface->getCanvas()->clear(color);
|
||||
return surface;
|
||||
}
|
||||
|
@ -212,10 +212,9 @@ sk_sp<SkSurface> MapPlatformSurface(HDC context) {
|
||||
BITMAP backing;
|
||||
const SkImageInfo size(PrepareAllocation(context, &backing));
|
||||
SkSurfaceProps props = skia::LegacyDisplayGlobals::GetSkSurfaceProps();
|
||||
return size.isEmpty()
|
||||
? nullptr
|
||||
: SkSurface::MakeRasterDirect(size, backing.bmBits,
|
||||
backing.bmWidthBytes, &props);
|
||||
return size.isEmpty() ? nullptr
|
||||
: SkSurfaces::WrapPixels(size, backing.bmBits,
|
||||
backing.bmWidthBytes, &props);
|
||||
}
|
||||
|
||||
SkBitmap MapPlatformBitmap(HDC context) {
|
||||
|
@ -41,7 +41,7 @@ TEST(Skottie, Basic) {
|
||||
EXPECT_EQ(anim->size().height(), 200.0f);
|
||||
EXPECT_EQ(anim->duration(), 5.0f);
|
||||
|
||||
auto surface = SkSurface::MakeRasterN32Premul(400, 200);
|
||||
auto surface = SkSurfaces::Raster(SkImageInfo::MakeN32Premul(400, 200));
|
||||
anim->seek(0);
|
||||
anim->render(surface->getCanvas());
|
||||
|
||||
|
@ -53,7 +53,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
skpathutils::FillPathWithPaint(path, paint_stroke, &dst_path, nullptr);
|
||||
|
||||
// Width and height should never be 0.
|
||||
auto surface(SkSurface::MakeRasterN32Premul(w ? w : 1, h ? h : 1));
|
||||
auto surface(
|
||||
SkSurfaces::Raster(SkImageInfo::MakeN32Premul(w ? w : 1, h ? h : 1)));
|
||||
|
||||
surface->getCanvas()->drawPath(path, paint_fill);
|
||||
surface->getCanvas()->drawPath(path, paint_stroke);
|
||||
|
12
third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer_test.cc
vendored
12
third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer_test.cc
vendored
@ -1050,7 +1050,8 @@ TEST(V8ScriptValueSerializerTest, RoundTripImageBitmap) {
|
||||
V8TestingScope scope;
|
||||
|
||||
// Make a 10x7 red ImageBitmap.
|
||||
sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(10, 7);
|
||||
sk_sp<SkSurface> surface =
|
||||
SkSurfaces::Raster(SkImageInfo::MakeN32Premul(10, 7));
|
||||
surface->getCanvas()->clear(SK_ColorRED);
|
||||
auto* image_bitmap = MakeGarbageCollected<ImageBitmap>(
|
||||
UnacceleratedStaticBitmapImage::Create(surface->makeImageSnapshot()));
|
||||
@ -1085,8 +1086,8 @@ TEST(V8ScriptValueSerializerTest, ImageBitmapEXIFImageOrientation) {
|
||||
for (uint8_t i = static_cast<uint8_t>(ImageOrientationEnum::kOriginTopLeft);
|
||||
i <= static_cast<uint8_t>(ImageOrientationEnum::kMaxValue); i++) {
|
||||
ImageOrientationEnum orientation = static_cast<ImageOrientationEnum>(i);
|
||||
sk_sp<SkSurface> surface =
|
||||
SkSurface::MakeRasterN32Premul(kImageWidth, kImageHeight);
|
||||
sk_sp<SkSurface> surface = SkSurfaces::Raster(
|
||||
SkImageInfo::MakeN32Premul(kImageWidth, kImageHeight));
|
||||
auto static_image =
|
||||
UnacceleratedStaticBitmapImage::Create(surface->makeImageSnapshot());
|
||||
static_image->SetOrientation(orientation);
|
||||
@ -1112,7 +1113,7 @@ TEST(V8ScriptValueSerializerTest, RoundTripImageBitmapWithColorSpaceInfo) {
|
||||
// Make a 10x7 red ImageBitmap in P3 color space.
|
||||
SkImageInfo info =
|
||||
SkImageInfo::Make(10, 7, kRGBA_F16_SkColorType, kPremul_SkAlphaType, p3);
|
||||
sk_sp<SkSurface> surface = SkSurface::MakeRaster(info);
|
||||
sk_sp<SkSurface> surface = SkSurfaces::Raster(info);
|
||||
surface->getCanvas()->clear(SK_ColorRED);
|
||||
auto* image_bitmap = MakeGarbageCollected<ImageBitmap>(
|
||||
UnacceleratedStaticBitmapImage::Create(surface->makeImageSnapshot()));
|
||||
@ -1474,7 +1475,8 @@ TEST(V8ScriptValueSerializerTest, TransferImageBitmap) {
|
||||
// More thorough tests exist in web_tests/.
|
||||
V8TestingScope scope;
|
||||
|
||||
sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(10, 7);
|
||||
sk_sp<SkSurface> surface =
|
||||
SkSurfaces::Raster(SkImageInfo::MakeN32Premul(10, 7));
|
||||
surface->getCanvas()->clear(SK_ColorRED);
|
||||
sk_sp<SkImage> image = surface->makeImageSnapshot();
|
||||
auto* image_bitmap = MakeGarbageCollected<ImageBitmap>(
|
||||
|
@ -414,8 +414,9 @@ std::unique_ptr<DragImage> DataTransfer::CreateDragImageForFrame(
|
||||
// Rasterize upfront, since DragImage::create() is going to do it anyway
|
||||
// (SkImage::asLegacyBitmap).
|
||||
SkSurfaceProps surface_props(0, kUnknown_SkPixelGeometry);
|
||||
sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(
|
||||
device_size.width(), device_size.height(), &surface_props);
|
||||
sk_sp<SkSurface> surface = SkSurfaces::Raster(
|
||||
SkImageInfo::MakeN32Premul(device_size.width(), device_size.height()),
|
||||
&surface_props);
|
||||
if (!surface)
|
||||
return nullptr;
|
||||
|
||||
|
@ -146,7 +146,8 @@ class CanvasAsyncBlobCreatorTest : public PageTestBase {
|
||||
CanvasAsyncBlobCreatorTest::CanvasAsyncBlobCreatorTest() = default;
|
||||
|
||||
scoped_refptr<StaticBitmapImage> CreateTransparentImage(int width, int height) {
|
||||
sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(width, height);
|
||||
sk_sp<SkSurface> surface =
|
||||
SkSurfaces::Raster(SkImageInfo::MakeN32Premul(width, height));
|
||||
if (!surface)
|
||||
return nullptr;
|
||||
return UnacceleratedStaticBitmapImage::Create(surface->makeImageSnapshot());
|
||||
|
@ -60,7 +60,7 @@ CanvasRenderingContextHost::CreateTransparentImage(
|
||||
gfx::SizeToSkISize(size),
|
||||
GetRenderingContextSkColorInfo().makeAlphaType(kPremul_SkAlphaType));
|
||||
sk_sp<SkSurface> surface =
|
||||
SkSurface::MakeRaster(info, info.minRowBytes(), nullptr);
|
||||
SkSurfaces::Raster(info, info.minRowBytes(), nullptr);
|
||||
if (!surface)
|
||||
return nullptr;
|
||||
return UnacceleratedStaticBitmapImage::Create(surface->makeImageSnapshot());
|
||||
|
@ -427,7 +427,7 @@ scoped_refptr<StaticBitmapImage> MakeBlankImage(
|
||||
info =
|
||||
info.makeWH(parsed_options.resize_width, parsed_options.resize_height);
|
||||
}
|
||||
sk_sp<SkSurface> surface = SkSurface::MakeRaster(info);
|
||||
sk_sp<SkSurface> surface = SkSurfaces::Raster(info);
|
||||
if (!surface)
|
||||
return nullptr;
|
||||
return UnacceleratedStaticBitmapImage::Create(surface->makeImageSnapshot());
|
||||
@ -958,7 +958,7 @@ void ImageBitmap::RasterizeImageOnBackgroundThread(
|
||||
SkImageInfo info =
|
||||
SkImageInfo::MakeN32Premul(dst_rect.width(), dst_rect.height());
|
||||
SkSurfaceProps props = skia::LegacyDisplayGlobals::GetSkSurfaceProps();
|
||||
sk_sp<SkSurface> surface = SkSurface::MakeRaster(info, &props);
|
||||
sk_sp<SkSurface> surface = SkSurfaces::Raster(info, &props);
|
||||
sk_sp<SkImage> skia_image;
|
||||
if (surface) {
|
||||
paint_record.Playback(surface->getCanvas());
|
||||
|
@ -69,11 +69,13 @@ class ExceptionState;
|
||||
class ImageBitmapTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp() override {
|
||||
sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(10, 10);
|
||||
sk_sp<SkSurface> surface =
|
||||
SkSurfaces::Raster(SkImageInfo::MakeN32Premul(10, 10));
|
||||
surface->getCanvas()->clear(0xFFFFFFFF);
|
||||
image_ = surface->makeImageSnapshot();
|
||||
|
||||
sk_sp<SkSurface> surface2 = SkSurface::MakeRasterN32Premul(5, 5);
|
||||
sk_sp<SkSurface> surface2 =
|
||||
SkSurfaces::Raster(SkImageInfo::MakeN32Premul(5, 5));
|
||||
surface2->getCanvas()->clear(0xAAAAAAAA);
|
||||
image2_ = surface2->makeImageSnapshot();
|
||||
|
||||
@ -111,7 +113,7 @@ TEST_F(ImageBitmapTest, ImageResourceConsistency) {
|
||||
sk_sp<SkColorSpace> src_rgb_color_space = SkColorSpace::MakeSRGB();
|
||||
SkImageInfo raster_image_info =
|
||||
SkImageInfo::MakeN32Premul(5, 5, src_rgb_color_space);
|
||||
sk_sp<SkSurface> surface(SkSurface::MakeRaster(raster_image_info));
|
||||
sk_sp<SkSurface> surface(SkSurfaces::Raster(raster_image_info));
|
||||
sk_sp<SkImage> image = surface->makeImageSnapshot();
|
||||
ImageResourceContent* original_image_content =
|
||||
ImageResourceContent::CreateLoaded(
|
||||
@ -180,7 +182,7 @@ TEST_F(ImageBitmapTest, ImageBitmapSourceChanged) {
|
||||
sk_sp<SkColorSpace> src_rgb_color_space = SkColorSpace::MakeSRGB();
|
||||
SkImageInfo raster_image_info =
|
||||
SkImageInfo::MakeN32Premul(5, 5, src_rgb_color_space);
|
||||
sk_sp<SkSurface> raster_surface(SkSurface::MakeRaster(raster_image_info));
|
||||
sk_sp<SkSurface> raster_surface(SkSurfaces::Raster(raster_image_info));
|
||||
sk_sp<SkImage> raster_image = raster_surface->makeImageSnapshot();
|
||||
ImageResourceContent* original_image_content =
|
||||
ImageResourceContent::CreateLoaded(
|
||||
|
@ -21,7 +21,7 @@ class LayoutVideoTest : public RenderingTest {
|
||||
sk_sp<SkColorSpace> src_rgb_color_space = SkColorSpace::MakeSRGB();
|
||||
SkImageInfo raster_image_info =
|
||||
SkImageInfo::MakeN32Premul(width, height, src_rgb_color_space);
|
||||
sk_sp<SkSurface> surface(SkSurface::MakeRaster(raster_image_info));
|
||||
sk_sp<SkSurface> surface(SkSurfaces::Raster(raster_image_info));
|
||||
sk_sp<SkImage> image = surface->makeImageSnapshot();
|
||||
ImageResourceContent* image_content = ImageResourceContent::CreateLoaded(
|
||||
UnacceleratedStaticBitmapImage::Create(image).get());
|
||||
|
@ -238,7 +238,7 @@ static bool ExtractImageData(Image* image,
|
||||
|
||||
// Set |surface| to draw directly to |contents|.
|
||||
const SkSurfaceProps disable_lcd_props(0, kUnknown_SkPixelGeometry);
|
||||
sk_sp<SkSurface> surface = SkSurface::MakeRasterDirect(
|
||||
sk_sp<SkSurface> surface = SkSurfaces::WrapPixels(
|
||||
dst_info, contents.Data(), dst_info.minRowBytes(), &disable_lcd_props);
|
||||
if (!surface)
|
||||
return false;
|
||||
|
@ -250,8 +250,8 @@ scoped_refptr<Image> OffscreenCanvas::GetSourceImageForCanvas(
|
||||
const AlphaDisposition alpha_disposition) {
|
||||
if (!context_) {
|
||||
*status = kInvalidSourceImageStatus;
|
||||
sk_sp<SkSurface> surface =
|
||||
SkSurface::MakeRasterN32Premul(size_.width(), size_.height());
|
||||
sk_sp<SkSurface> surface = SkSurfaces::Raster(
|
||||
SkImageInfo::MakeN32Premul(size_.width(), size_.height()));
|
||||
return surface ? UnacceleratedStaticBitmapImage::Create(
|
||||
surface->makeImageSnapshot())
|
||||
: nullptr;
|
||||
|
@ -94,7 +94,7 @@ class TestImage : public Image {
|
||||
}
|
||||
|
||||
static sk_sp<SkSurface> CreateSkSurface(gfx::Size size) {
|
||||
return SkSurface::MakeRaster(
|
||||
return SkSurfaces::Raster(
|
||||
SkImageInfo::MakeN32(size.width(), size.height(), kPremul_SkAlphaType));
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ class ImageElementTimingTest : public testing::Test,
|
||||
sk_sp<SkColorSpace> src_rgb_color_space = SkColorSpace::MakeSRGB();
|
||||
SkImageInfo raster_image_info =
|
||||
SkImageInfo::MakeN32Premul(width, height, src_rgb_color_space);
|
||||
sk_sp<SkSurface> surface(SkSurface::MakeRaster(raster_image_info));
|
||||
sk_sp<SkSurface> surface(SkSurfaces::Raster(raster_image_info));
|
||||
sk_sp<SkImage> image = surface->makeImageSnapshot();
|
||||
ImageResourceContent* original_image_content =
|
||||
ImageResourceContent::CreateLoaded(
|
||||
|
@ -282,7 +282,7 @@ class ImagePaintTimingDetectorTest : public testing::Test,
|
||||
sk_sp<SkColorSpace> src_rgb_color_space = SkColorSpace::MakeSRGB();
|
||||
SkImageInfo raster_image_info =
|
||||
SkImageInfo::MakeN32Premul(width, height, src_rgb_color_space);
|
||||
sk_sp<SkSurface> surface(SkSurface::MakeRaster(raster_image_info));
|
||||
sk_sp<SkSurface> surface(SkSurfaces::Raster(raster_image_info));
|
||||
sk_sp<SkImage> image = surface->makeImageSnapshot();
|
||||
ImageResourceContent* original_image_content =
|
||||
ImageResourceContent::CreateLoaded(
|
||||
|
@ -70,7 +70,7 @@ class LargestContentfulPaintCalculatorTest : public RenderingTest {
|
||||
sk_sp<SkColorSpace> src_rgb_color_space = SkColorSpace::MakeSRGB();
|
||||
SkImageInfo raster_image_info =
|
||||
SkImageInfo::MakeN32Premul(width, height, src_rgb_color_space);
|
||||
sk_sp<SkSurface> surface(SkSurface::MakeRaster(raster_image_info));
|
||||
sk_sp<SkSurface> surface(SkSurfaces::Raster(raster_image_info));
|
||||
sk_sp<SkImage> image = surface->makeImageSnapshot();
|
||||
scoped_refptr<UnacceleratedStaticBitmapImage> original_image_data =
|
||||
UnacceleratedStaticBitmapImage::Create(image);
|
||||
|
@ -227,7 +227,7 @@ TEST_F(VideoFrameTest, ImageBitmapCreationAndZeroCopyRoundTrip) {
|
||||
auto* init = VideoFrameInit::Create();
|
||||
init->setTimestamp(0);
|
||||
|
||||
sk_sp<SkSurface> surface(SkSurface::MakeRaster(
|
||||
sk_sp<SkSurface> surface(SkSurfaces::Raster(
|
||||
SkImageInfo::MakeN32Premul(5, 5, SkColorSpace::MakeSRGB())));
|
||||
sk_sp<SkImage> original_image = surface->makeImageSnapshot();
|
||||
|
||||
@ -298,7 +298,7 @@ void TestWrappedVideoFrameImageReuse(V8TestingScope& scope,
|
||||
TEST_F(VideoFrameTest, ImageReuse_VideoFrameFromImage) {
|
||||
V8TestingScope scope;
|
||||
|
||||
sk_sp<SkSurface> surface(SkSurface::MakeRaster(
|
||||
sk_sp<SkSurface> surface(SkSurfaces::Raster(
|
||||
SkImageInfo::MakeN32Premul(5, 5, SkColorSpace::MakeSRGB())));
|
||||
sk_sp<SkImage> original_image = surface->makeImageSnapshot();
|
||||
|
||||
@ -317,7 +317,7 @@ TEST_F(VideoFrameTest, ImageReuse_VideoFrameFromImage) {
|
||||
TEST_F(VideoFrameTest, ImageReuse_VideoFrameFromVideoFrameFromImage) {
|
||||
V8TestingScope scope;
|
||||
|
||||
sk_sp<SkSurface> surface(SkSurface::MakeRaster(
|
||||
sk_sp<SkSurface> surface(SkSurfaces::Raster(
|
||||
SkImageInfo::MakeN32Premul(5, 5, SkColorSpace::MakeSRGB())));
|
||||
sk_sp<SkImage> original_image = surface->makeImageSnapshot();
|
||||
|
||||
@ -398,7 +398,7 @@ TEST_F(VideoFrameTest, HandleMonitoring) {
|
||||
media_frame1, scope.GetExecutionContext(), source1);
|
||||
verify_expectations(/* source1 */ 1, 1, 0, /* source2 */ 0, 0, 0);
|
||||
|
||||
sk_sp<SkSurface> surface(SkSurface::MakeRaster(
|
||||
sk_sp<SkSurface> surface(SkSurfaces::Raster(
|
||||
SkImageInfo::MakeN32Premul(5, 5, SkColorSpace::MakeSRGB())));
|
||||
sk_sp<SkImage> sk_image = surface->makeImageSnapshot();
|
||||
auto handle_2_1 = base::MakeRefCounted<VideoFrameHandle>(
|
||||
|
@ -727,9 +727,9 @@ void CanvasResourceRasterSharedImage::CopyRenderingResultsToGpuMemoryBuffer(
|
||||
if (!ContextProviderWrapper() || !gpu_memory_buffer_->Map())
|
||||
return;
|
||||
|
||||
auto surface = SkSurface::MakeRasterDirect(CreateSkImageInfo(),
|
||||
gpu_memory_buffer_->memory(0),
|
||||
gpu_memory_buffer_->stride(0));
|
||||
auto surface =
|
||||
SkSurfaces::WrapPixels(CreateSkImageInfo(), gpu_memory_buffer_->memory(0),
|
||||
gpu_memory_buffer_->stride(0));
|
||||
SkPixmap pixmap;
|
||||
image->peekPixels(&pixmap);
|
||||
surface->writePixels(pixmap, 0, 0);
|
||||
|
@ -159,7 +159,7 @@ class CanvasResourceProviderBitmap : public CanvasResourceProvider {
|
||||
|
||||
const auto info = GetSkImageInfo().makeAlphaType(kPremul_SkAlphaType);
|
||||
const auto props = GetSkSurfaceProps();
|
||||
return SkSurface::MakeRaster(info, &props);
|
||||
return SkSurfaces::Raster(info, &props);
|
||||
}
|
||||
};
|
||||
|
||||
@ -556,7 +556,7 @@ class CanvasResourceProviderSharedImage : public CanvasResourceProvider {
|
||||
|
||||
const auto props = GetSkSurfaceProps();
|
||||
if (is_accelerated_) {
|
||||
return SkSurface::MakeFromBackendTexture(
|
||||
return SkSurfaces::WrapBackendTexture(
|
||||
GetGrContext(), CreateGrTextureForResource(), GetGrSurfaceOrigin(),
|
||||
0 /* msaa_sample_count */, GetSkImageInfo().colorType(),
|
||||
GetSkImageInfo().refColorSpace(), &props);
|
||||
@ -565,7 +565,7 @@ class CanvasResourceProviderSharedImage : public CanvasResourceProvider {
|
||||
// For software raster path, we render into cpu memory managed internally
|
||||
// by SkSurface and copy the rendered results to the GMB before dispatching
|
||||
// it to the display compositor.
|
||||
return SkSurface::MakeRaster(resource_->CreateSkImageInfo(), &props);
|
||||
return SkSurfaces::Raster(resource_->CreateSkImageInfo(), &props);
|
||||
}
|
||||
|
||||
GrBackendTexture CreateGrTextureForResource() const {
|
||||
@ -844,7 +844,7 @@ class CanvasResourceProviderSwapChain final : public CanvasResourceProvider {
|
||||
GrMipMapped::kNo, texture_info);
|
||||
|
||||
const auto props = GetSkSurfaceProps();
|
||||
return SkSurface::MakeFromBackendTexture(
|
||||
return SkSurfaces::WrapBackendTexture(
|
||||
GetGrContext(), backend_texture, kTopLeft_GrSurfaceOrigin,
|
||||
0 /* msaa_sample_count */, GetSkImageInfo().colorType(),
|
||||
GetSkImageInfo().refColorSpace(), &props);
|
||||
|
@ -66,7 +66,7 @@ static void MixImages(const char* file_name,
|
||||
|
||||
// we now want to ensure we don't crash if we access these in this order
|
||||
SkImageInfo info = SkImageInfo::MakeN32Premul(10, 10);
|
||||
sk_sp<SkSurface> surf = SkSurface::MakeRaster(info);
|
||||
sk_sp<SkSurface> surf = SkSurfaces::Raster(info);
|
||||
surf->getCanvas()->drawImage(image_with_more_data, 0, 0);
|
||||
surf->getCanvas()->drawImage(partial_image, 0, 0);
|
||||
}
|
||||
|
@ -607,8 +607,8 @@ XRWebGLDrawingBuffer::TransferToStaticBitmapImage() {
|
||||
// to transferToImageBitmap are made back-to-back, if the framebuffer is
|
||||
// incomplete (likely due to a failed buffer allocation), or when the
|
||||
// context gets lost.
|
||||
sk_sp<SkSurface> surface =
|
||||
SkSurface::MakeRasterN32Premul(size_.width(), size_.height());
|
||||
sk_sp<SkSurface> surface = SkSurfaces::Raster(
|
||||
SkImageInfo::MakeN32Premul(size_.width(), size_.height()));
|
||||
return UnacceleratedStaticBitmapImage::Create(surface->makeImageSnapshot());
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ PaintImage Image::ResizeAndOrientImage(
|
||||
const SkImageInfo surface_info = SkImageInfo::MakeN32(
|
||||
size.width(), size.height(), image.GetSkImageInfo().alphaType(),
|
||||
surface_color_space);
|
||||
sk_sp<SkSurface> surface = SkSurface::MakeRaster(surface_info);
|
||||
sk_sp<SkSurface> surface = SkSurfaces::Raster(surface_info);
|
||||
if (!surface)
|
||||
return PaintImage();
|
||||
|
||||
|
@ -183,7 +183,7 @@ static void BlendRGBAF16Buffer(ImageFrame::PixelDataF16* dst,
|
||||
kRGBA_F16_SkColorType, dst_alpha_type,
|
||||
SkColorSpace::MakeSRGBLinear());
|
||||
sk_sp<SkSurface> surface =
|
||||
SkSurface::MakeRasterDirect(info, dst, info.minRowBytes());
|
||||
SkSurfaces::WrapPixels(info, dst, info.minRowBytes());
|
||||
|
||||
SkPixmap src_pixmap(info.makeAlphaType(kUnpremul_SkAlphaType), src,
|
||||
info.minRowBytes());
|
||||
|
@ -183,7 +183,7 @@ void X11SoftwareBitmapPresenter::Resize(const gfx::Size& pixel_size) {
|
||||
viewport_pixel_size_.height(),
|
||||
color_type, kOpaque_SkAlphaType);
|
||||
SkSurfaceProps props = skia::LegacyDisplayGlobals::GetSkSurfaceProps();
|
||||
surface_ = SkSurface::MakeRaster(info, &props);
|
||||
surface_ = SkSurfaces::Raster(info, &props);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "third_party/skia/include/core/SkSurface.h"
|
||||
#include "third_party/skia/include/gpu/GpuTypes.h"
|
||||
#include "third_party/skia/include/gpu/GrDirectContext.h"
|
||||
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
|
||||
#include "third_party/skia/include/private/SkGainmapInfo.h"
|
||||
#include "third_party/skia/include/private/SkGainmapShader.h"
|
||||
#include "ui/gfx/color_transform.h"
|
||||
@ -32,10 +33,10 @@ static sk_sp<SkSurface> MakeSurfaceForResult(SkImageInfo image_info,
|
||||
if (context) {
|
||||
// TODO(https://crbug.com/1286088): Consider adding mipmap support here.
|
||||
sk_sp<SkSurface> surface =
|
||||
SkSurface::MakeRenderTarget(context, skgpu::Budgeted::kNo, image_info,
|
||||
/*sampleCount=*/0, kTopLeft_GrSurfaceOrigin,
|
||||
/*surfaceProps=*/nullptr,
|
||||
/*shouldCreateWithMips=*/false);
|
||||
SkSurfaces::RenderTarget(context, skgpu::Budgeted::kNo, image_info,
|
||||
/*sampleCount=*/0, kTopLeft_GrSurfaceOrigin,
|
||||
/*surfaceProps=*/nullptr,
|
||||
/*shouldCreateWithMips=*/false);
|
||||
// It is not guaranteed that kRGBA_F16_SkColorType is renderable. If we fail
|
||||
// to create an SkSurface with that color type, fall back to
|
||||
// kN32_SkColorType.
|
||||
@ -44,15 +45,14 @@ static sk_sp<SkSurface> MakeSurfaceForResult(SkImageInfo image_info,
|
||||
}
|
||||
DLOG(ERROR) << "Falling back to tone mapped 8-bit surface.";
|
||||
image_info = image_info.makeColorType(kN32_SkColorType);
|
||||
return SkSurface::MakeRenderTarget(
|
||||
context, skgpu::Budgeted::kNo, image_info,
|
||||
/*sampleCount=*/0, kTopLeft_GrSurfaceOrigin,
|
||||
/*surfaceProps=*/nullptr,
|
||||
/*shouldCreateWithMips=*/false);
|
||||
return SkSurfaces::RenderTarget(context, skgpu::Budgeted::kNo, image_info,
|
||||
/*sampleCount=*/0, kTopLeft_GrSurfaceOrigin,
|
||||
/*surfaceProps=*/nullptr,
|
||||
/*shouldCreateWithMips=*/false);
|
||||
}
|
||||
#endif
|
||||
return SkSurface::MakeRaster(image_info, image_info.minRowBytes(),
|
||||
/*surfaceProps=*/nullptr);
|
||||
return SkSurfaces::Raster(image_info, image_info.minRowBytes(),
|
||||
/*surfaceProps=*/nullptr);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -205,8 +205,8 @@ class Buffer final : public ui::GbmBuffer {
|
||||
SkImageInfo info =
|
||||
SkImageInfo::MakeN32Premul(size_.width(), size_.height());
|
||||
SkSurfaceProps props = skia::LegacyDisplayGlobals::GetSkSurfaceProps();
|
||||
return SkSurface::MakeRasterDirectReleaseProc(
|
||||
info, addr, stride, &Buffer::UnmapGbmBo, this, &props);
|
||||
return SkSurfaces::WrapPixels(info, addr, stride, &Buffer::UnmapGbmBo, this,
|
||||
&props);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "third_party/skia/include/core/SkFont.h"
|
||||
#include "third_party/skia/include/effects/SkGradientShader.h"
|
||||
#include "third_party/skia/include/gpu/GrBackendSurface.h"
|
||||
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
|
||||
#include "third_party/skia/include/gpu/gl/GrGLAssembleInterface.h"
|
||||
#include "third_party/skia/include/gpu/gl/GrGLInterface.h"
|
||||
#include "ui/gfx/color_space.h"
|
||||
@ -95,7 +96,7 @@ void SkiaGlRenderer::RenderFrame() {
|
||||
GrBackendRenderTarget render_target(size_.width(), size_.height(), 0, 8,
|
||||
framebuffer_info);
|
||||
|
||||
sk_surface_ = SkSurface::MakeFromBackendRenderTarget(
|
||||
sk_surface_ = SkSurfaces::WrapBackendRenderTarget(
|
||||
gr_context_.get(), render_target, kBottomLeft_GrSurfaceOrigin,
|
||||
kRGBA_8888_SkColorType, nullptr, &surface_props);
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "third_party/skia/include/core/SkTypeface.h"
|
||||
#include "third_party/skia/include/gpu/GrBackendSurface.h"
|
||||
#include "third_party/skia/include/gpu/GrDirectContext.h"
|
||||
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
|
||||
#include "third_party/skia/include/gpu/gl/GrGLAssembleInterface.h"
|
||||
#include "third_party/skia/include/gpu/gl/GrGLInterface.h"
|
||||
#include "ui/display/types/display_snapshot.h"
|
||||
@ -141,7 +142,7 @@ bool SurfacelessSkiaGlRenderer::BufferWrapper::Initialize(
|
||||
texture_info.fFormat = GL_BGRA8_EXT;
|
||||
GrBackendTexture backend_texture(size_.width(), size_.height(),
|
||||
GrMipMapped::kNo, texture_info);
|
||||
sk_surface_ = SkSurface::MakeFromBackendTexture(
|
||||
sk_surface_ = SkSurfaces::WrapBackendTexture(
|
||||
gr_context, backend_texture, kTopLeft_GrSurfaceOrigin, 0,
|
||||
kBGRA_8888_SkColorType, nullptr, nullptr);
|
||||
if (!sk_surface_) {
|
||||
|
@ -90,7 +90,7 @@ bool DrmDumbBuffer::MapDumbBuffer(const SkImageInfo& info) {
|
||||
}
|
||||
|
||||
SkSurfaceProps props = skia::LegacyDisplayGlobals::GetSkSurfaceProps();
|
||||
surface_ = SkSurface::MakeRasterDirect(info, mmap_base_, stride_, &props);
|
||||
surface_ = SkSurfaces::WrapPixels(info, mmap_base_, stride_, &props);
|
||||
if (!surface_) {
|
||||
LOG(ERROR) << "DrmDumbBuffer: Failed to create SkSurface: handle "
|
||||
<< handle_;
|
||||
|
@ -754,7 +754,7 @@ bool MockDrmDevice::CreateDumbBuffer(const SkImageInfo& info,
|
||||
*stride = info.minRowBytes();
|
||||
void* pixels = new char[info.computeByteSize(*stride)];
|
||||
SkSurfaceProps props = skia::LegacyDisplayGlobals::GetSkSurfaceProps();
|
||||
buffers_.push_back(SkSurface::MakeRasterDirectReleaseProc(
|
||||
buffers_.push_back(SkSurfaces::WrapPixels(
|
||||
info, pixels, *stride,
|
||||
[](void* pixels, void* context) { delete[] static_cast<char*>(pixels); },
|
||||
/*context=*/nullptr, &props));
|
||||
|
@ -106,7 +106,7 @@ void FlatlandSurfaceCanvas::Frame::InitializeBuffer(
|
||||
|
||||
// Initialize `surface`.
|
||||
SkSurfaceProps props;
|
||||
surface = SkSurface::MakeRasterDirect(
|
||||
surface = SkSurfaces::WrapPixels(
|
||||
SkImageInfo::MakeN32Premul(size.width(), size.height()),
|
||||
memory_mapping.memory(), stride, &props);
|
||||
dirty_region.setRect(gfx::RectToSkIRect(gfx::Rect(size)));
|
||||
|
@ -75,10 +75,10 @@ class FileSurface : public SurfaceOzoneCanvas {
|
||||
// SurfaceOzoneCanvas overrides:
|
||||
void ResizeCanvas(const gfx::Size& viewport_size, float scale) override {
|
||||
SkSurfaceProps props = skia::LegacyDisplayGlobals::GetSkSurfaceProps();
|
||||
surface_ = SkSurface::MakeRaster(
|
||||
SkImageInfo::MakeN32Premul(viewport_size.width(),
|
||||
viewport_size.height()),
|
||||
&props);
|
||||
surface_ =
|
||||
SkSurfaces::Raster(SkImageInfo::MakeN32Premul(viewport_size.width(),
|
||||
viewport_size.height()),
|
||||
&props);
|
||||
}
|
||||
SkCanvas* GetCanvas() override { return surface_->getCanvas(); }
|
||||
void PresentCanvas(const gfx::Rect& damage) override {
|
||||
|
@ -49,7 +49,7 @@ void ScenicWindowCanvas::Frame::Initialize(gfx::Size size,
|
||||
scenic, memory_handle.PassPlatformHandle(), buffer_size,
|
||||
fuchsia::images::MemoryType::HOST_MEMORY);
|
||||
SkSurfaceProps props = skia::LegacyDisplayGlobals::GetSkSurfaceProps();
|
||||
surface = SkSurface::MakeRasterDirect(
|
||||
surface = SkSurfaces::WrapPixels(
|
||||
SkImageInfo::MakeN32Premul(size.width(), size.height()),
|
||||
memory_mapping.memory(), bytes_per_row, &props);
|
||||
dirty_region.setRect(gfx::RectToSkIRect(gfx::Rect(size)));
|
||||
|
@ -68,10 +68,10 @@ bool DrawBitmap(const SkBitmap& bitmap, ui::WaylandShmBuffer* out_buffer) {
|
||||
|
||||
auto* mapped_memory = out_buffer->GetMemory();
|
||||
auto size = out_buffer->size();
|
||||
sk_sp<SkSurface> sk_surface = SkSurface::MakeRasterDirect(
|
||||
SkImageInfo::Make(size.width(), size.height(), kColorType,
|
||||
kOpaque_SkAlphaType),
|
||||
mapped_memory, out_buffer->stride());
|
||||
sk_sp<SkSurface> sk_surface =
|
||||
SkSurfaces::WrapPixels(SkImageInfo::Make(size.width(), size.height(),
|
||||
kColorType, kOpaque_SkAlphaType),
|
||||
mapped_memory, out_buffer->stride());
|
||||
|
||||
if (!sk_surface)
|
||||
return false;
|
||||
|
@ -89,7 +89,7 @@ class WaylandCanvasSurface::SharedMemoryBuffer {
|
||||
size, buffer_id_);
|
||||
|
||||
SkSurfaceProps props = skia::LegacyDisplayGlobals::GetSkSurfaceProps();
|
||||
sk_surface_ = SkSurface::MakeRasterDirect(
|
||||
sk_surface_ = SkSurfaces::WrapPixels(
|
||||
SkImageInfo::MakeN32Premul(size.width(), size.height()),
|
||||
shm_mapping_.memory(), CalculateStride(size.width()), &props);
|
||||
DCHECK(sk_surface_);
|
||||
|
Reference in New Issue
Block a user