Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1086)

Unified Diff: src/gpu/SkGpuDevice.h

Issue 1930013002: (Mostly) Retract GrRenderTarget from SkGpuDevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: clean up Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGpuDevice.h
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index e940159b22d068eb1deb3f2827cb8940c1b27110..474a030ef5bd787ab8152f0011bef8fffc7388cc 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -36,17 +36,21 @@ public:
/**
* Creates an SkGpuDevice from a GrRenderTarget.
+ * TODO: rm this factory. It is used by SkSurface::MakeRenderTargetDirect,
+ * MakeFromBackendTexture, MakeFromBackendRenderTarget,
+ * and MakeFromBackendTextureAsRenderTarget. Only the first is worrisome.
*/
static sk_sp<SkGpuDevice> Make(sk_sp<GrRenderTarget> target,
const SkSurfaceProps*,
InitContents);
/**
- * Creates an SkGpuDevice from a GrRenderTarget whose texture width/height is
+ * Creates an SkGpuDevice from a GrDrawContext whose backing width/height is
* different than its actual width/height (e.g., approx-match scratch texture).
*/
- static sk_sp<SkGpuDevice> Make(sk_sp<GrRenderTarget> target, int width, int height,
- const SkSurfaceProps*, InitContents);
+ static sk_sp<SkBaseDevice> Make(sk_sp<GrDrawContext> drawContext,
+ int width, int height,
+ InitContents);
/**
* New device that will create an offscreen renderTarget based on the ImageInfo and
@@ -70,7 +74,7 @@ public:
// set all pixels to 0
void clearAll();
- void replaceRenderTarget(bool shouldRetainContent);
+ void replaceDrawContext(bool shouldRetainContent);
GrRenderTarget* accessRenderTarget() override;
GrDrawContext* accessDrawContext() override;
@@ -148,7 +152,7 @@ protected:
private:
// We want these unreffed in DrawContext, RenderTarget, GrContext order.
SkAutoTUnref<GrContext> fContext;
- SkAutoTUnref<GrRenderTarget> fRenderTarget;
+ sk_sp<GrRenderTarget> fRenderTarget;
sk_sp<GrDrawContext> fDrawContext;
SkAutoTUnref<const SkClipStack> fClipStack;
@@ -166,7 +170,7 @@ private:
static bool CheckAlphaTypeAndGetFlags(const SkImageInfo* info, InitContents init,
unsigned* flags);
- SkGpuDevice(GrRenderTarget*, int width, int height, const SkSurfaceProps*, unsigned flags);
+ SkGpuDevice(sk_sp<GrDrawContext>, int width, int height, unsigned flags);
SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override;
@@ -249,8 +253,11 @@ private:
bool drawDashLine(const SkPoint pts[2], const SkPaint& paint);
- static GrRenderTarget* CreateRenderTarget(GrContext*, SkBudgeted, const SkImageInfo&,
- int sampleCount);
+ static sk_sp<GrDrawContext> CreateDrawContext(GrContext*,
+ SkBudgeted,
+ const SkImageInfo&,
+ int sampleCount,
+ const SkSurfaceProps*);
void drawSpriteWithFilter(const SkDraw&, const SkBitmap&, int x, int y,
const SkPaint&) override;
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698