Migrate GrDstProxyView to its own header.

Change-Id: Ic1b362a38d60c50ee6b4ead307fb57eb26c375e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/415459
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
This commit is contained in:
John Stiles 2021-06-03 16:44:53 -04:00 committed by Skia Commit-Bot
parent 6dd19477c5
commit 87960de2ae
9 changed files with 74 additions and 52 deletions

View File

@ -100,6 +100,7 @@ skia_gpu_sources = [
"$_src/gpu/GrDrawingManager.cpp", "$_src/gpu/GrDrawingManager.cpp",
"$_src/gpu/GrDrawingManager.h", "$_src/gpu/GrDrawingManager.h",
"$_src/gpu/GrDriverBugWorkarounds.cpp", "$_src/gpu/GrDriverBugWorkarounds.cpp",
"$_src/gpu/GrDstProxyView.h",
"$_src/gpu/GrDynamicAtlas.cpp", "$_src/gpu/GrDynamicAtlas.cpp",
"$_src/gpu/GrDynamicAtlas.h", "$_src/gpu/GrDynamicAtlas.h",
"$_src/gpu/GrEagerVertexAllocator.h", "$_src/gpu/GrEagerVertexAllocator.h",

67
src/gpu/GrDstProxyView.h Normal file
View File

@ -0,0 +1,67 @@
/*
* 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 GrDstProxyView_DEFINED
#define GrDstProxyView_DEFINED
#include "include/gpu/GrTypes.h"
#include "include/private/GrTypesPriv.h"
#include "src/gpu/GrSurfaceProxyView.h"
/**
* GrDstProxyView holds a texture containing the destination pixel values, and an integer-coordinate
* offset from device-space to the space of the texture. When framebuffer fetch is not available, a
* GrDstProxyView may be used to support blending in the fragment shader/xfer processor.
*/
class GrDstProxyView {
public:
GrDstProxyView() {}
GrDstProxyView(const GrDstProxyView& other) {
*this = other;
}
GrDstProxyView& operator=(const GrDstProxyView& other) {
fProxyView = other.fProxyView;
fOffset = other.fOffset;
fDstSampleType = other.fDstSampleType;
return *this;
}
bool operator==(const GrDstProxyView& that) const {
return fProxyView == that.fProxyView &&
fOffset == that.fOffset &&
fDstSampleType == that.fDstSampleType;
}
bool operator!=(const GrDstProxyView& that) const { return !(*this == that); }
const SkIPoint& offset() const { return fOffset; }
void setOffset(const SkIPoint& offset) { fOffset = offset; }
void setOffset(int ox, int oy) { fOffset.set(ox, oy); }
GrSurfaceProxy* proxy() const { return fProxyView.proxy(); }
const GrSurfaceProxyView& proxyView() const { return fProxyView; }
void setProxyView(GrSurfaceProxyView view) {
fProxyView = std::move(view);
if (!fProxyView.proxy()) {
fOffset = {0, 0};
}
}
GrDstSampleType dstSampleType() const { return fDstSampleType; }
void setDstSampleType(GrDstSampleType dstSampleType) { fDstSampleType = dstSampleType; }
private:
GrSurfaceProxyView fProxyView;
SkIPoint fOffset = {0, 0};
GrDstSampleType fDstSampleType = GrDstSampleType::kNone;
};
#endif

View File

@ -21,6 +21,7 @@
#include "src/core/SkStringUtils.h" #include "src/core/SkStringUtils.h"
#include "src/core/SkTLazy.h" #include "src/core/SkTLazy.h"
#include "src/gpu/GrAppliedClip.h" #include "src/gpu/GrAppliedClip.h"
#include "src/gpu/GrDstProxyView.h"
#include "src/gpu/GrGeometryProcessor.h" #include "src/gpu/GrGeometryProcessor.h"
#include "src/gpu/GrRenderTask.h" #include "src/gpu/GrRenderTask.h"
#include "src/gpu/ops/GrDrawOp.h" #include "src/gpu/ops/GrDrawOp.h"

View File

@ -11,6 +11,7 @@
#include "include/core/SkMatrix.h" #include "include/core/SkMatrix.h"
#include "include/core/SkRefCnt.h" #include "include/core/SkRefCnt.h"
#include "src/gpu/GrColor.h" #include "src/gpu/GrColor.h"
#include "src/gpu/GrDstProxyView.h"
#include "src/gpu/GrFragmentProcessor.h" #include "src/gpu/GrFragmentProcessor.h"
#include "src/gpu/GrProcessorSet.h" #include "src/gpu/GrProcessorSet.h"
#include "src/gpu/GrScissorState.h" #include "src/gpu/GrScissorState.h"

View File

@ -28,6 +28,7 @@ class GrClip;
class GrColorSpaceXform; class GrColorSpaceXform;
class GrCoverageCountingPathRenderer; class GrCoverageCountingPathRenderer;
class GrDrawOp; class GrDrawOp;
class GrDstProxyView;
class GrOp; class GrOp;
class GrRenderTarget; class GrRenderTarget;
class GrStyledShape; class GrStyledShape;

View File

@ -8,6 +8,7 @@
#include "src/gpu/GrSurfaceFillContext.h" #include "src/gpu/GrSurfaceFillContext.h"
#include "include/private/GrImageContext.h" #include "include/private/GrImageContext.h"
#include "src/gpu/GrDstProxyView.h"
#include "src/gpu/GrImageContextPriv.h" #include "src/gpu/GrImageContextPriv.h"
#include "src/gpu/GrProxyProvider.h" #include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrSurfaceDrawContext.h" #include "src/gpu/GrSurfaceDrawContext.h"

View File

@ -40,58 +40,6 @@ enum class GrXferBarrierFlags {
GR_MAKE_BITFIELD_CLASS_OPS(GrXferBarrierFlags) GR_MAKE_BITFIELD_CLASS_OPS(GrXferBarrierFlags)
/**
* GrDstProxyView holds a texture containing the destination pixel values, and an integer-coordinate
* offset from device-space to the space of the texture. When framebuffer fetch is not available, a
* GrDstProxyView may be used to support blending in the fragment shader/xfer processor.
*/
class GrDstProxyView {
public:
GrDstProxyView() { fOffset.set(0, 0); }
GrDstProxyView(const GrDstProxyView& other) {
*this = other;
}
GrDstProxyView& operator=(const GrDstProxyView& other) {
fProxyView = other.fProxyView;
fOffset = other.fOffset;
fDstSampleType = other.fDstSampleType;
return *this;
}
bool operator==(const GrDstProxyView& that) const {
return fProxyView == that.fProxyView &&
fOffset == that.fOffset &&
fDstSampleType == that.fDstSampleType;
}
bool operator!=(const GrDstProxyView& that) const { return !(*this == that); }
const SkIPoint& offset() const { return fOffset; }
void setOffset(const SkIPoint& offset) { fOffset = offset; }
void setOffset(int ox, int oy) { fOffset.set(ox, oy); }
GrSurfaceProxy* proxy() const { return fProxyView.proxy(); }
const GrSurfaceProxyView& proxyView() const { return fProxyView; }
void setProxyView(GrSurfaceProxyView view) {
fProxyView = std::move(view);
if (!fProxyView.proxy()) {
fOffset = {0, 0};
}
}
GrDstSampleType dstSampleType() const { return fDstSampleType; }
void setDstSampleType(GrDstSampleType dstSampleType) { fDstSampleType = dstSampleType; }
private:
GrSurfaceProxyView fProxyView;
SkIPoint fOffset;
GrDstSampleType fDstSampleType = GrDstSampleType::kNone;
};
/** /**
* GrXferProcessor is responsible for implementing the xfer mode that blends the src color and dst * GrXferProcessor is responsible for implementing the xfer mode that blends the src color and dst
* color, and for applying any coverage. It does this by emitting fragment shader code and * color, and for applying any coverage. It does this by emitting fragment shader code and

View File

@ -10,6 +10,7 @@
#include "include/gpu/GrDirectContext.h" #include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrDirectContextPriv.h" #include "src/gpu/GrDirectContextPriv.h"
#include "src/gpu/GrDstProxyView.h"
#include "src/gpu/GrGpu.h" #include "src/gpu/GrGpu.h"
#include "src/gpu/ops/GrMeshDrawOp.h" #include "src/gpu/ops/GrMeshDrawOp.h"

View File

@ -22,6 +22,7 @@
class GrAppliedClip; class GrAppliedClip;
class GrCaps; class GrCaps;
class GrDstProxyView;
class GrOpFlushState; class GrOpFlushState;
class GrOpsRenderPass; class GrOpsRenderPass;
class GrPaint; class GrPaint;