Add SkBaseGpuDevice ...
between SkBaseDevice/SkClipStackDevice and SkGpuDevice/SkGpuDevice_nga The idea is that SkCanvas will deal with SkBaseGpuDevices rather than SkGpuDevice*s Change-Id: I1bffeccab44d2a2b73413f50d7c905fa2df8eedc Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407459 Reviewed-by: Michael Ludwig <michaelludwig@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
4e9d5e2bdf
commit
09b2bcbb81
@ -541,6 +541,7 @@ skia_gpu_sources = [
|
|||||||
"$_src/gpu/mock/GrMockTypes.cpp",
|
"$_src/gpu/mock/GrMockTypes.cpp",
|
||||||
|
|
||||||
# Sk files
|
# Sk files
|
||||||
|
"$_src/gpu/SkBaseGpuDevice.h",
|
||||||
"$_src/gpu/SkGpuDevice.cpp",
|
"$_src/gpu/SkGpuDevice.cpp",
|
||||||
"$_src/gpu/SkGpuDevice.h",
|
"$_src/gpu/SkGpuDevice.h",
|
||||||
"$_src/gpu/SkGpuDevice_drawTexture.cpp",
|
"$_src/gpu/SkGpuDevice_drawTexture.cpp",
|
||||||
|
45
src/gpu/SkBaseGpuDevice.h
Normal file
45
src/gpu/SkBaseGpuDevice.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2021 Google LLC
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by a BSD-style license that can be
|
||||||
|
* found in the LICENSE file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SkBaseGpuDevice_DEFINED
|
||||||
|
#define SkBaseGpuDevice_DEFINED
|
||||||
|
|
||||||
|
// NOTE: when not defined, SkGpuDevice extends SkBaseDevice directly and manages its clip stack
|
||||||
|
// using GrClipStack. When false, SkGpuDevice continues to extend SkClipStackDevice and uses
|
||||||
|
// SkClipStack and GrClipStackClip to manage the clip stack.
|
||||||
|
#if !defined(SK_DISABLE_NEW_GR_CLIP_STACK)
|
||||||
|
// For staging purposes, disable this for Android Framework
|
||||||
|
#if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK)
|
||||||
|
#define SK_DISABLE_NEW_GR_CLIP_STACK
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(SK_DISABLE_NEW_GR_CLIP_STACK)
|
||||||
|
#include "src/core/SkDevice.h"
|
||||||
|
#define BASE_DEVICE SkBaseDevice
|
||||||
|
#else
|
||||||
|
#include "src/core/SkClipStackDevice.h"
|
||||||
|
#define BASE_DEVICE SkClipStackDevice
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class SkBaseGpuDevice : public BASE_DEVICE {
|
||||||
|
public:
|
||||||
|
SkBaseGpuDevice(const SkImageInfo& ii, const SkSurfaceProps& props)
|
||||||
|
: INHERITED(ii, props) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: SkGpuDevice/SkGpuDevice_nga shared stuff goes here
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
private:
|
||||||
|
using INHERITED = BASE_DEVICE;
|
||||||
|
};
|
||||||
|
|
||||||
|
#undef BASE_DEVICE
|
||||||
|
|
||||||
|
#endif
|
@ -14,39 +14,25 @@
|
|||||||
#include "include/core/SkSurface.h"
|
#include "include/core/SkSurface.h"
|
||||||
#include "include/gpu/GrTypes.h"
|
#include "include/gpu/GrTypes.h"
|
||||||
#include "src/gpu/GrSurfaceDrawContext.h"
|
#include "src/gpu/GrSurfaceDrawContext.h"
|
||||||
|
#include "src/gpu/SkBaseGpuDevice.h"
|
||||||
#include "src/gpu/SkGr.h"
|
#include "src/gpu/SkGr.h"
|
||||||
|
|
||||||
class SkSpecialImage;
|
class SkSpecialImage;
|
||||||
class SkSurface;
|
class SkSurface;
|
||||||
class SkVertices;
|
class SkVertices;
|
||||||
|
|
||||||
// NOTE: when not defined, SkGpuDevice extends SkBaseDevice directly and manages its clip stack
|
|
||||||
// using GrClipStack. When false, SkGpuDevice continues to extend SkClipStackDevice and uses
|
|
||||||
// SkClipStack and GrClipStackClip to manage the clip stack.
|
|
||||||
#if !defined(SK_DISABLE_NEW_GR_CLIP_STACK)
|
#if !defined(SK_DISABLE_NEW_GR_CLIP_STACK)
|
||||||
// For staging purposes, disable this for Android Framework
|
|
||||||
#if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK)
|
|
||||||
#define SK_DISABLE_NEW_GR_CLIP_STACK
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(SK_DISABLE_NEW_GR_CLIP_STACK)
|
|
||||||
#include "src/core/SkDevice.h"
|
|
||||||
#include "src/gpu/GrClipStack.h"
|
#include "src/gpu/GrClipStack.h"
|
||||||
#define BASE_DEVICE SkBaseDevice
|
|
||||||
#define GR_CLIP_STACK GrClipStack
|
#define GR_CLIP_STACK GrClipStack
|
||||||
#else
|
#else
|
||||||
#include "src/core/SkClipStackDevice.h"
|
|
||||||
#include "src/gpu/GrClipStackClip.h"
|
#include "src/gpu/GrClipStackClip.h"
|
||||||
#define BASE_DEVICE SkClipStackDevice
|
|
||||||
#define GR_CLIP_STACK GrClipStackClip
|
#define GR_CLIP_STACK GrClipStackClip
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subclass of SkBaseDevice, which directs all drawing to the GrGpu owned by the
|
* Subclass of SkBaseGpuDevice, which directs all drawing to the GrGpu owned by the canvas.
|
||||||
* canvas.
|
|
||||||
*/
|
*/
|
||||||
class SkGpuDevice : public BASE_DEVICE {
|
class SkGpuDevice : public SkBaseGpuDevice {
|
||||||
public:
|
public:
|
||||||
enum InitContents {
|
enum InitContents {
|
||||||
kClear_InitContents,
|
kClear_InitContents,
|
||||||
@ -221,10 +207,9 @@ private:
|
|||||||
GrMipmapped);
|
GrMipmapped);
|
||||||
|
|
||||||
friend class SkSurface_Gpu; // for access to surfaceProps
|
friend class SkSurface_Gpu; // for access to surfaceProps
|
||||||
using INHERITED = BASE_DEVICE;
|
using INHERITED = SkBaseGpuDevice;
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef BASE_DEVICE
|
|
||||||
#undef GR_CLIP_STACK
|
#undef GR_CLIP_STACK
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -12,11 +12,12 @@
|
|||||||
|
|
||||||
#ifdef SK_NGA
|
#ifdef SK_NGA
|
||||||
|
|
||||||
#include "src/core/SkDevice.h"
|
#include "src/gpu/SkBaseGpuDevice.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Subclass of SkBaseGpuDevice, which directs all drawing to the GrGpu owned by the canvas.
|
||||||
*/
|
*/
|
||||||
class SkGpuDevice_nga : public SkBaseDevice {
|
class SkGpuDevice_nga : public SkBaseGpuDevice {
|
||||||
public:
|
public:
|
||||||
~SkGpuDevice_nga() override;
|
~SkGpuDevice_nga() override;
|
||||||
|
|
||||||
@ -94,7 +95,7 @@ private:
|
|||||||
|
|
||||||
sk_sp<GrRecordingContext> fContext;
|
sk_sp<GrRecordingContext> fContext;
|
||||||
|
|
||||||
using INHERITED = SkBaseDevice;
|
using INHERITED = SkBaseGpuDevice;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SK_NGA
|
#endif // SK_NGA
|
||||||
|
Loading…
Reference in New Issue
Block a user