From ca6eafc0f7e59ed89f03a9891b9fdf7de64f1f35 Mon Sep 17 00:00:00 2001 From: robertphillips Date: Tue, 17 May 2016 09:57:46 -0700 Subject: (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 --- src/gpu/SkGpuDevice.h | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'src/gpu/SkGpuDevice.h') 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 Make(sk_sp 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 Make(sk_sp target, int width, int height, - const SkSurfaceProps*, InitContents); + static sk_sp Make(sk_sp 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 fContext; - SkAutoTUnref fRenderTarget; + sk_sp fRenderTarget; sk_sp fDrawContext; SkAutoTUnref 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, 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 CreateDrawContext(GrContext*, + SkBudgeted, + const SkImageInfo&, + int sampleCount, + const SkSurfaceProps*); void drawSpriteWithFilter(const SkDraw&, const SkBitmap&, int x, int y, const SkPaint&) override; -- cgit v1.2.3