diff options
author | 2016-05-17 09:57:46 -0700 | |
---|---|---|
committer | 2016-05-17 09:57:46 -0700 | |
commit | ca6eafc0f7e59ed89f03a9891b9fdf7de64f1f35 (patch) | |
tree | 06a052b8018ae4fb6ccbac647d2a4f77cc3a99d1 /src/gpu/SkGpuDevice.h | |
parent | cc49e5950d3a0de03c24da71d23bbdaebead97c6 (diff) |
(Mostly) Retract GrRenderTarget from SkGpuDevice
This gets us most of the way to having SkGpuDevice exclusively use a GrDrawContext instead of a GrRenderTarget. There are a few other refactorings (e.g., rm need for fLegacyBitmap and accessRenderTarget) before the GrRenderTarget can be completely removed.
Has calved off:
https://codereview.chromium.org/1925313002/ (Tighten up SkSpecialSurface factory functions)
https://codereview.chromium.org/1925803004/ (Add sk_sp to SkSurface_Gpu and SkGpuDevice)
https://codereview.chromium.org/1956473002/ (Retract GrRenderTarget a bit within SkGpuDevice)
https://codereview.chromium.org/1979913002/ (Rename GrDrawingMgr::abandon to wasAbandoned & add a matching entry point to GrDrawingContext)
https://codereview.chromium.org/1982583002/ (Add isUnifiedMultisampled entry point to GrDrawContext)
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1930013002
Review-Url: https://codereview.chromium.org/1930013002
Diffstat (limited to 'src/gpu/SkGpuDevice.h')
-rw-r--r-- | src/gpu/SkGpuDevice.h | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h index e940159b22..474a030ef5 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; |