Make the SkGpuDevice factories return SkBaseGpuDevices
and make SkSurface_Gpu hold an SkBaseGpuDevice. Bug: skia:11837 Change-Id: Ief3b78440bce95a6b95f26642130ba8e2f2f3193 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/415460 Reviewed-by: Michael Ludwig <michaelludwig@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
d7b8dc086b
commit
6dd19477c5
@ -124,7 +124,7 @@ sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRaster(const SkImageInfo& info,
|
||||
|
||||
class SkSpecialSurface_Gpu : public SkSpecialSurface_Base {
|
||||
public:
|
||||
SkSpecialSurface_Gpu(sk_sp<SkGpuDevice> device, SkIRect subset)
|
||||
SkSpecialSurface_Gpu(sk_sp<SkBaseGpuDevice> device, SkIRect subset)
|
||||
: INHERITED(subset, device->surfaceProps())
|
||||
, fReadView(device->readSurfaceView()) {
|
||||
|
||||
|
@ -72,13 +72,13 @@ bool SkGpuDevice::CheckAlphaTypeAndGetFlags(
|
||||
return true;
|
||||
}
|
||||
|
||||
sk_sp<SkGpuDevice> SkGpuDevice::Make(GrRecordingContext* rContext,
|
||||
GrColorType colorType,
|
||||
sk_sp<GrSurfaceProxy> proxy,
|
||||
sk_sp<SkColorSpace> colorSpace,
|
||||
GrSurfaceOrigin origin,
|
||||
const SkSurfaceProps& surfaceProps,
|
||||
InitContents init) {
|
||||
sk_sp<SkBaseGpuDevice> SkGpuDevice::Make(GrRecordingContext* rContext,
|
||||
GrColorType colorType,
|
||||
sk_sp<GrSurfaceProxy> proxy,
|
||||
sk_sp<SkColorSpace> colorSpace,
|
||||
GrSurfaceOrigin origin,
|
||||
const SkSurfaceProps& surfaceProps,
|
||||
InitContents init) {
|
||||
auto sdc = GrSurfaceDrawContext::Make(rContext,
|
||||
colorType,
|
||||
std::move(proxy),
|
||||
@ -89,9 +89,9 @@ sk_sp<SkGpuDevice> SkGpuDevice::Make(GrRecordingContext* rContext,
|
||||
return SkGpuDevice::Make(std::move(sdc), nullptr, init);
|
||||
}
|
||||
|
||||
sk_sp<SkGpuDevice> SkGpuDevice::Make(std::unique_ptr<GrSurfaceDrawContext> sdc,
|
||||
const SkImageInfo* ii,
|
||||
InitContents init) {
|
||||
sk_sp<SkBaseGpuDevice> SkGpuDevice::Make(std::unique_ptr<GrSurfaceDrawContext> sdc,
|
||||
const SkImageInfo* ii,
|
||||
InitContents init) {
|
||||
if (!sdc) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -111,16 +111,16 @@ sk_sp<SkGpuDevice> SkGpuDevice::Make(std::unique_ptr<GrSurfaceDrawContext> sdc,
|
||||
return sk_sp<SkGpuDevice>(new SkGpuDevice(std::move(sdc), flags));
|
||||
}
|
||||
|
||||
sk_sp<SkGpuDevice> SkGpuDevice::Make(GrRecordingContext* rContext,
|
||||
SkBudgeted budgeted,
|
||||
const SkImageInfo& ii,
|
||||
SkBackingFit fit,
|
||||
int sampleCount,
|
||||
GrMipmapped mipMapped,
|
||||
GrProtected isProtected,
|
||||
GrSurfaceOrigin origin,
|
||||
const SkSurfaceProps& props,
|
||||
InitContents init) {
|
||||
sk_sp<SkBaseGpuDevice> SkGpuDevice::Make(GrRecordingContext* rContext,
|
||||
SkBudgeted budgeted,
|
||||
const SkImageInfo& ii,
|
||||
SkBackingFit fit,
|
||||
int sampleCount,
|
||||
GrMipmapped mipMapped,
|
||||
GrProtected isProtected,
|
||||
GrSurfaceOrigin origin,
|
||||
const SkSurfaceProps& props,
|
||||
InitContents init) {
|
||||
auto sdc = MakeSurfaceDrawContext(rContext,
|
||||
budgeted,
|
||||
ii,
|
||||
|
@ -74,13 +74,13 @@ public:
|
||||
* This factory uses the color space, origin, surface properties, and initialization
|
||||
* method along with the provided proxy to create the gpu device.
|
||||
*/
|
||||
static sk_sp<SkGpuDevice> Make(GrRecordingContext*,
|
||||
GrColorType,
|
||||
sk_sp<GrSurfaceProxy>,
|
||||
sk_sp<SkColorSpace>,
|
||||
GrSurfaceOrigin,
|
||||
const SkSurfaceProps&,
|
||||
InitContents);
|
||||
static sk_sp<SkBaseGpuDevice> Make(GrRecordingContext*,
|
||||
GrColorType,
|
||||
sk_sp<GrSurfaceProxy>,
|
||||
sk_sp<SkColorSpace>,
|
||||
GrSurfaceOrigin,
|
||||
const SkSurfaceProps&,
|
||||
InitContents);
|
||||
|
||||
/**
|
||||
* This factory uses the budgeted, imageInfo, fit, sampleCount, mipmapped, and isProtected
|
||||
@ -88,16 +88,16 @@ public:
|
||||
* origin, surface properties, and initialization method are then used (with the created proxy)
|
||||
* to create the device.
|
||||
*/
|
||||
static sk_sp<SkGpuDevice> Make(GrRecordingContext*,
|
||||
SkBudgeted,
|
||||
const SkImageInfo&,
|
||||
SkBackingFit,
|
||||
int sampleCount,
|
||||
GrMipmapped,
|
||||
GrProtected,
|
||||
GrSurfaceOrigin,
|
||||
const SkSurfaceProps&,
|
||||
InitContents);
|
||||
static sk_sp<SkBaseGpuDevice> Make(GrRecordingContext*,
|
||||
SkBudgeted,
|
||||
const SkImageInfo&,
|
||||
SkBackingFit,
|
||||
int sampleCount,
|
||||
GrMipmapped,
|
||||
GrProtected,
|
||||
GrSurfaceOrigin,
|
||||
const SkSurfaceProps&,
|
||||
InitContents);
|
||||
|
||||
~SkGpuDevice() override {}
|
||||
|
||||
@ -203,9 +203,9 @@ private:
|
||||
static bool CheckAlphaTypeAndGetFlags(const SkImageInfo* info, InitContents init,
|
||||
unsigned* flags);
|
||||
|
||||
static sk_sp<SkGpuDevice> Make(std::unique_ptr<GrSurfaceDrawContext>,
|
||||
const SkImageInfo*,
|
||||
InitContents);
|
||||
static sk_sp<SkBaseGpuDevice> Make(std::unique_ptr<GrSurfaceDrawContext>,
|
||||
const SkImageInfo*,
|
||||
InitContents);
|
||||
|
||||
SkGpuDevice(std::unique_ptr<GrSurfaceDrawContext>, unsigned flags);
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "src/gpu/GrSurfaceDrawContext.h"
|
||||
#include "src/gpu/GrTexture.h"
|
||||
#include "src/gpu/GrThreadSafePipelineBuilder.h"
|
||||
#include "src/gpu/SkGpuDevice.h"
|
||||
#include "src/gpu/SkGr.h"
|
||||
#include "src/gpu/vk/GrVkAMDMemoryAllocator.h"
|
||||
#include "src/gpu/vk/GrVkBuffer.h"
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
|
||||
SkSurface_Gpu::SkSurface_Gpu(sk_sp<SkGpuDevice> device)
|
||||
SkSurface_Gpu::SkSurface_Gpu(sk_sp<SkBaseGpuDevice> device)
|
||||
: INHERITED(device->width(), device->height(), &device->surfaceProps())
|
||||
, fDevice(std::move(device)) {
|
||||
SkASSERT(fDevice->targetProxy()->priv().isExact());
|
||||
@ -463,10 +463,10 @@ sk_sp<SkSurface> SkSurface::MakeRenderTarget(GrRecordingContext* rContext, SkBud
|
||||
mipMapped = GrMipmapped::kNo;
|
||||
}
|
||||
|
||||
sk_sp<SkGpuDevice> device(SkGpuDevice::Make(rContext, budgeted, info, SkBackingFit::kExact,
|
||||
sampleCount, mipMapped, GrProtected::kNo, origin,
|
||||
SkSurfacePropsCopyOrDefault(props),
|
||||
SkBaseGpuDevice::kClear_InitContents));
|
||||
sk_sp<SkBaseGpuDevice> device(SkGpuDevice::Make(rContext, budgeted, info, SkBackingFit::kExact,
|
||||
sampleCount, mipMapped, GrProtected::kNo,
|
||||
origin, SkSurfacePropsCopyOrDefault(props),
|
||||
SkBaseGpuDevice::kClear_InitContents));
|
||||
if (!device) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ class SkGpuDevice;
|
||||
|
||||
class SkSurface_Gpu : public SkSurface_Base {
|
||||
public:
|
||||
SkSurface_Gpu(sk_sp<SkGpuDevice>);
|
||||
SkSurface_Gpu(sk_sp<SkBaseGpuDevice>);
|
||||
~SkSurface_Gpu() override;
|
||||
|
||||
GrRecordingContext* onGetRecordingContext() override;
|
||||
@ -61,7 +61,7 @@ public:
|
||||
SkBaseGpuDevice* getDevice();
|
||||
|
||||
private:
|
||||
sk_sp<SkGpuDevice> fDevice;
|
||||
sk_sp<SkBaseGpuDevice> fDevice;
|
||||
|
||||
using INHERITED = SkSurface_Base;
|
||||
};
|
||||
|
@ -5,7 +5,7 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "src/gpu/SkGpuDevice.h"
|
||||
#include "include/gpu/GrTypes.h"
|
||||
|
||||
// For the GrClipStack case, this is covered in GrClipStack_RectDeviceClip
|
||||
#if defined(SK_DISABLE_NEW_GR_CLIP_STACK)
|
||||
|
@ -1545,8 +1545,6 @@ DEF_TEST(ClipStack, reporter) {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "src/gpu/SkGpuDevice.h"
|
||||
|
||||
// For the GrClipStack case, this is covered in GrClipStack_SWMask
|
||||
#if defined(SK_DISABLE_NEW_GR_CLIP_STACK)
|
||||
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "src/gpu/GrRenderTargetProxy.h"
|
||||
#include "src/gpu/GrSurfaceDrawContext.h"
|
||||
#include "src/gpu/GrTextureProxy.h"
|
||||
#include "src/gpu/SkGpuDevice.h"
|
||||
#include "src/gpu/gl/GrGLDefines.h"
|
||||
#include "src/image/SkImage_GpuBase.h"
|
||||
#include "src/image/SkSurface_Gpu.h"
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "src/gpu/GrSurfaceProxyPriv.h"
|
||||
#include "src/gpu/GrTexture.h"
|
||||
#include "src/gpu/GrTextureProxy.h"
|
||||
#include "src/gpu/SkGpuDevice.h"
|
||||
#include "src/gpu/SkBaseGpuDevice.h"
|
||||
#include "src/image/SkImage_Base.h"
|
||||
#include "src/image/SkSurface_Gpu.h"
|
||||
#include "tests/Test.h"
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "src/gpu/GrRenderTarget.h"
|
||||
#include "src/gpu/GrResourceProvider.h"
|
||||
#include "src/gpu/GrSurfaceDrawContext.h"
|
||||
#include "src/gpu/SkGpuDevice.h"
|
||||
#include "src/gpu/SkBaseGpuDevice.h"
|
||||
#include "src/image/SkImage_Base.h"
|
||||
#include "src/image/SkImage_Gpu.h"
|
||||
#include "src/image/SkSurface_Gpu.h"
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "src/gpu/GrSurfaceDrawContext.h"
|
||||
#include "src/gpu/GrTexture.h"
|
||||
#include "src/gpu/GrTextureProxy.h"
|
||||
#include "src/gpu/SkGpuDevice.h"
|
||||
#include "src/gpu/vk/GrVkGpu.h"
|
||||
#include "src/gpu/vk/GrVkImageLayout.h"
|
||||
#include "src/gpu/vk/GrVkTexture.h"
|
||||
|
Loading…
Reference in New Issue
Block a user