Skip to content

Commit

Permalink
SkBudgeted -> skgpu::Budgeted (flutter#38660)
Browse files Browse the repository at this point in the history
* SkBudgeted -> skgpu::Budgeted

* colon

* format

* fix GN rules

* undo includes
  • Loading branch information
kjlubick authored and Ricardo Amador committed Jan 25, 2023
1 parent 8780330 commit bc394f3
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 25 deletions.
4 changes: 2 additions & 2 deletions display_list/display_list_benchmarks_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void OpenGLCanvasProvider::InitializeSurface(const size_t width,

const auto image_info = SkImageInfo::MakeN32Premul(surface_size_);
surface_ = SkSurface::MakeRenderTarget(
gl_surface_->GetGrContext().get(), SkBudgeted::kNo, image_info, 1,
gl_surface_->GetGrContext().get(), skgpu::Budgeted::kNo, image_info, 1,
kTopLeft_GrSurfaceOrigin, nullptr, false);
surface_->getCanvas()->clear(SK_ColorTRANSPARENT);
}
Expand All @@ -38,7 +38,7 @@ sk_sp<SkSurface> OpenGLCanvasProvider::MakeOffscreenSurface(
const auto image_info = SkImageInfo::MakeN32Premul(surface_size_);

auto offscreen_surface = SkSurface::MakeRenderTarget(
gl_surface_->GetGrContext().get(), SkBudgeted::kNo, image_info, 1,
gl_surface_->GetGrContext().get(), skgpu::Budgeted::kNo, image_info, 1,
kTopLeft_GrSurfaceOrigin, nullptr, false);

offscreen_surface->getCanvas()->clear(SK_ColorTRANSPARENT);
Expand Down
4 changes: 2 additions & 2 deletions flow/layers/offscreen_surface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ static sk_sp<SkSurface> CreateSnapshotSurface(GrDirectContext* surface_context,
// There is a rendering surface that may contain textures that are going to
// be referenced in the layer tree about to be drawn.
return SkSurface::MakeRenderTarget(
reinterpret_cast<GrRecordingContext*>(surface_context), SkBudgeted::kNo,
image_info);
reinterpret_cast<GrRecordingContext*>(surface_context),
skgpu::Budgeted::kNo, image_info);
}

// There is no rendering surface, assume no GPU textures are present and
Expand Down
7 changes: 4 additions & 3 deletions flow/raster_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ std::unique_ptr<RasterCacheResult> RasterCache::Rasterize(
sk_ref_sp(context.dst_color_space));

sk_sp<SkSurface> surface =
context.gr_context ? SkSurface::MakeRenderTarget(
context.gr_context, SkBudgeted::kYes, image_info)
: SkSurface::MakeRaster(image_info);
context.gr_context
? SkSurface::MakeRenderTarget(context.gr_context,
skgpu::Budgeted::kYes, image_info)
: SkSurface::MakeRaster(image_info);

if (!surface) {
return nullptr;
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/painting/image_encoding_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ sk_sp<SkImage> ConvertToRasterUsingResourceContext(
.SetIfFalse([&surface, &surface_info, resource_context] {
if (resource_context) {
surface = SkSurface::MakeRenderTarget(
resource_context.get(), SkBudgeted::kNo, surface_info);
resource_context.get(), skgpu::Budgeted::kNo, surface_info);
} else {
surface = SkSurface::MakeRaster(surface_info);
}
Expand Down
4 changes: 2 additions & 2 deletions shell/common/rasterizer_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -913,8 +913,8 @@ TEST(RasterizerTest, TeardownFreesResourceCache) {

auto image_info =
SkImageInfo::MakeN32Premul(500, 500, SkColorSpace::MakeSRGB());
auto sk_surface =
SkSurface::MakeRenderTarget(context.get(), SkBudgeted::kYes, image_info);
auto sk_surface = SkSurface::MakeRenderTarget(
context.get(), skgpu::Budgeted::kYes, image_info);
EXPECT_TRUE(sk_surface);

SkPaint paint;
Expand Down
4 changes: 2 additions & 2 deletions shell/common/shell_test_platform_view_vulkan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ ShellTestPlatformViewVulkan::OffScreenSurface::AcquireFrame(
const SkISize& size) {
auto image_info = SkImageInfo::Make(size, SkColorType::kRGBA_8888_SkColorType,
SkAlphaType::kOpaque_SkAlphaType);
auto surface = SkSurface::MakeRenderTarget(context_.get(), SkBudgeted::kNo,
image_info, 0, nullptr);
auto surface = SkSurface::MakeRenderTarget(
context_.get(), skgpu::Budgeted::kNo, image_info, 0, nullptr);
SurfaceFrame::SubmitCallback callback = [](const SurfaceFrame&,
SkCanvas* canvas) -> bool {
canvas->flush();
Expand Down
6 changes: 3 additions & 3 deletions shell/common/snapshot_controller_skia.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ sk_sp<DlImage> SnapshotControllerSkia::DoMakeRasterSnapshot(
// When there is an on screen surface, we need a render target
// SkSurface because we want to access texture backed images.
sk_sp<SkSurface> sk_surface =
SkSurface::MakeRenderTarget(context, // context
SkBudgeted::kNo, // budgeted
image_info // image info
SkSurface::MakeRenderTarget(context, // context
skgpu::Budgeted::kNo, // budgeted
image_info // image info
);
if (!sk_surface) {
FML_LOG(ERROR)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ - (CVPixelBufferRef)pixelBuffer {
[[FlutterDarwinContextMetalSkia alloc] initWithDefaultMTLDevice];
SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
GrDirectContext* grContext = darwinContextMetal.mainContext.get();
sk_sp<SkSurface> gpuSurface(SkSurface::MakeRenderTarget(grContext, SkBudgeted::kNo, info));
sk_sp<SkSurface> gpuSurface(SkSurface::MakeRenderTarget(grContext, skgpu::Budgeted::kNo, info));

// Create a texture.
MTLTextureDescriptor* textureDescriptor = [[MTLTextureDescriptor alloc] init];
Expand Down Expand Up @@ -133,7 +133,7 @@ - (CVPixelBufferRef)pixelBuffer {
[[FlutterDarwinContextMetalSkia alloc] initWithDefaultMTLDevice];
SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
GrDirectContext* grContext = darwinContextMetal.mainContext.get();
sk_sp<SkSurface> gpuSurface(SkSurface::MakeRenderTarget(grContext, SkBudgeted::kNo, info));
sk_sp<SkSurface> gpuSurface(SkSurface::MakeRenderTarget(grContext, skgpu::Budgeted::kNo, info));

// Create a texture.
TestExternalTexture* testExternalTexture =
Expand Down Expand Up @@ -185,7 +185,7 @@ - (CVPixelBufferRef)pixelBuffer {
[[FlutterDarwinContextMetalSkia alloc] initWithDefaultMTLDevice];
SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
GrDirectContext* grContext = darwinContextMetal.mainContext.get();
sk_sp<SkSurface> gpuSurface(SkSurface::MakeRenderTarget(grContext, SkBudgeted::kNo, info));
sk_sp<SkSurface> gpuSurface(SkSurface::MakeRenderTarget(grContext, skgpu::Budgeted::kNo, info));

// Create a texture.
TestExternalTexture* testExternalTexture =
Expand Down Expand Up @@ -239,7 +239,7 @@ - (CVPixelBufferRef)pixelBuffer {
[[FlutterDarwinContextMetalSkia alloc] initWithDefaultMTLDevice];
SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
GrDirectContext* grContext = darwinContextMetal.mainContext.get();
sk_sp<SkSurface> gpuSurface(SkSurface::MakeRenderTarget(grContext, SkBudgeted::kNo, info));
sk_sp<SkSurface> gpuSurface(SkSurface::MakeRenderTarget(grContext, skgpu::Budgeted::kNo, info));

// Create a texture.
TestExternalTexture* testExternalTexture =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ bool EmbedderTestBackingStoreProducer::CreateFramebuffer(

auto surface = SkSurface::MakeRenderTarget(
context_.get(), // context
SkBudgeted::kNo, // budgeted
skgpu::Budgeted::kNo, // budgeted
image_info, // image info
1, // sample count
kBottomLeft_GrSurfaceOrigin, // surface origin
Expand Down Expand Up @@ -136,7 +136,7 @@ bool EmbedderTestBackingStoreProducer::CreateTexture(

auto surface = SkSurface::MakeRenderTarget(
context_.get(), // context
SkBudgeted::kNo, // budgeted
skgpu::Budgeted::kNo, // budgeted
image_info, // image info
1, // sample count
kBottomLeft_GrSurfaceOrigin, // surface origin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ bool EmbedderTestCompositorGL::UpdateOffscrenComposition(

auto surface =
SkSurface::MakeRenderTarget(context_.get(), // context
SkBudgeted::kNo, // budgeted
skgpu::Budgeted::kNo, // budgeted
image_info, // image info
1, // sample count
kTopLeft_GrSurfaceOrigin, // surface origin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ bool EmbedderTestCompositorMetal::UpdateOffscrenComposition(

auto surface =
SkSurface::MakeRenderTarget(context_.get(), // context
SkBudgeted::kNo, // budgeted
skgpu::Budgeted::kNo, // budgeted
image_info, // image info
1, // sample count
kTopLeft_GrSurfaceOrigin, // surface origin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ bool EmbedderTestCompositorVulkan::UpdateOffscrenComposition(

sk_sp<SkSurface> surface =
SkSurface::MakeRenderTarget(context_.get(), // context
SkBudgeted::kNo, // budgeted
skgpu::Budgeted::kNo, // budgeted
image_info, // image info
1, // sample count
kTopLeft_GrSurfaceOrigin, // surface origin
Expand Down
2 changes: 1 addition & 1 deletion shell/platform/embedder/tests/embedder_unittests_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ sk_sp<SkSurface> CreateRenderSurface(const FlutterLayer& layer,
SkImageInfo::MakeN32Premul(layer.size.width, layer.size.height);
auto surface = context ? SkSurface::MakeRenderTarget(
context, // context
SkBudgeted::kNo, // budgeted
skgpu::Budgeted::kNo, // budgeted
image_info, // image info
1, // sample count
kTopLeft_GrSurfaceOrigin, // surface origin
Expand Down

0 comments on commit bc394f3

Please sign in to comment.