GrSurfaceContext not ref counted.
Also don't specify redundant width/height to SkGpuDevice.
Change-Id: I389df5c4b073c2c05632ba6b7c95b02a22dfaf98
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235824
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index 6421702..9d0e058 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -42,8 +42,8 @@
* Creates an SkGpuDevice from a GrRenderTargetContext whose backing width/height is
* different than its actual width/height (e.g., approx-match scratch texture).
*/
- static sk_sp<SkGpuDevice> Make(GrContext*, sk_sp<GrRenderTargetContext> renderTargetContext,
- int width, int height, InitContents);
+ static sk_sp<SkGpuDevice> Make(
+ GrContext*, std::unique_ptr<GrRenderTargetContext>, InitContents);
/**
* New device that will create an offscreen renderTarget based on the ImageInfo and
@@ -65,7 +65,8 @@
void clearAll();
void replaceRenderTargetContext(bool shouldRetainContent);
- void replaceRenderTargetContext(sk_sp<GrRenderTargetContext>, bool shouldRetainContent);
+ void replaceRenderTargetContext(std::unique_ptr<GrRenderTargetContext>,
+ bool shouldRetainContent);
GrRenderTargetContext* accessRenderTargetContext() override;
@@ -132,10 +133,8 @@
private:
// We want these unreffed in RenderTargetContext, GrContext order.
- sk_sp<GrContext> fContext;
- sk_sp<GrRenderTargetContext> fRenderTargetContext;
-
- SkISize fSize;
+ sk_sp<GrContext> fContext;
+ std::unique_ptr<GrRenderTargetContext> fRenderTargetContext;
enum Flags {
kNeedClear_Flag = 1 << 0, //!< Surface requires an initial clear
@@ -145,7 +144,7 @@
static bool CheckAlphaTypeAndGetFlags(const SkImageInfo* info, InitContents init,
unsigned* flags);
- SkGpuDevice(GrContext*, sk_sp<GrRenderTargetContext>, int width, int height, unsigned flags);
+ SkGpuDevice(GrContext*, std::unique_ptr<GrRenderTargetContext>, unsigned flags);
SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override;
@@ -233,13 +232,13 @@
const SkVertices::Bone bones[], int boneCount, SkBlendMode,
const uint16_t indices[], int indexCount, const SkPaint&);
- static sk_sp<GrRenderTargetContext> MakeRenderTargetContext(GrContext*,
- SkBudgeted,
- const SkImageInfo&,
- int sampleCount,
- GrSurfaceOrigin,
- const SkSurfaceProps*,
- GrMipMapped);
+ static std::unique_ptr<GrRenderTargetContext> MakeRenderTargetContext(GrContext*,
+ SkBudgeted,
+ const SkImageInfo&,
+ int sampleCount,
+ GrSurfaceOrigin,
+ const SkSurfaceProps*,
+ GrMipMapped);
friend class GrAtlasTextContext;
friend class SkSurface_Gpu; // for access to surfaceProps