diff options
author | robertphillips <robertphillips@google.com> | 2016-08-04 08:45:02 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-04 08:45:02 -0700 |
commit | 15c42ca310e8b9785eab38b3dd36265948e85b0e (patch) | |
tree | c046b23f6c72377c28fdbd451bf2c997f799cc31 /src/gpu | |
parent | b83cdbcbb0829bf6e0c9cb2c7d9a0ff460f7f431 (diff) |
Remove SkSurface::MakeRenderTargetDirect
split into:
https://codereview.chromium.org/2182543003/ (Move prepareForExternalIO from GrRenderTarget to GrDrawContext)
https://codereview.chromium.org/2187573002/ (Reduce usage of MakeRenderTargetDirect)
https://codereview.chromium.org/2186073002/ (Rename GrContext's newDrawContext & drawContext to makeDrawContext)
https://codereview.chromium.org/2178353005/ (Remove use of MakeRenderTargetDirect from view system)
https://codereview.chromium.org/2198433003/ (Remove some ancillary users of SkSurface::MakeRenderTargetDirect)
https://codereview.chromium.org/2208483004/ (Remove GrRenderTarget member variable from SkGpuDevice)
https://codereview.chromium.org/2211473002/ (Move GrContext::makeDrawContext to new GrContextPriv object)
TBR=bsalomon@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2176333002
Review-Url: https://codereview.chromium.org/2176333002
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/SkGpuDevice.cpp | 37 | ||||
-rw-r--r-- | src/gpu/SkGpuDevice.h | 24 |
2 files changed, 9 insertions, 52 deletions
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index ab4b319ed0..b1c6407d2f 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -9,10 +9,8 @@ #include "GrBlurUtils.h" #include "GrContext.h" -#include "GrContextPriv.h" #include "GrDrawContextPriv.h" #include "GrGpu.h" -#include "GrGpuResourcePriv.h" #include "GrImageIDTextureAdjuster.h" #include "GrStyle.h" #include "GrTracing.h" @@ -92,31 +90,9 @@ bool SkGpuDevice::CheckAlphaTypeAndGetFlags( return true; } -sk_sp<SkGpuDevice> SkGpuDevice::Make(sk_sp<GrRenderTarget> rt, sk_sp<SkColorSpace> colorSpace, - const SkSurfaceProps* props, InitContents init) { - if (!rt || rt->wasDestroyed() || !rt->getContext()) { - return nullptr; - } - unsigned flags; - if (!CheckAlphaTypeAndGetFlags(nullptr, init, &flags)) { - return nullptr; - } - - const int width = rt->width(); - const int height = rt->height(); - - GrContext* context = rt->getContext(); - - sk_sp<GrDrawContext> drawContext(context->contextPriv().makeWrappedDrawContext( - std::move(rt), - std::move(colorSpace), - props)); - return sk_sp<SkGpuDevice>(new SkGpuDevice(std::move(drawContext), width, height, flags)); -} - -sk_sp<SkBaseDevice> SkGpuDevice::Make(sk_sp<GrDrawContext> drawContext, - int width, int height, - InitContents init) { +sk_sp<SkGpuDevice> SkGpuDevice::Make(sk_sp<GrDrawContext> drawContext, + int width, int height, + InitContents init) { if (!drawContext || drawContext->wasAbandoned()) { return nullptr; } @@ -124,7 +100,7 @@ sk_sp<SkBaseDevice> SkGpuDevice::Make(sk_sp<GrDrawContext> drawContext, if (!CheckAlphaTypeAndGetFlags(nullptr, init, &flags)) { return nullptr; } - return sk_sp<SkBaseDevice>(new SkGpuDevice(std::move(drawContext), width, height, flags)); + return sk_sp<SkGpuDevice>(new SkGpuDevice(std::move(drawContext), width, height, flags)); } sk_sp<SkGpuDevice> SkGpuDevice::Make(GrContext* context, SkBudgeted budgeted, @@ -248,9 +224,8 @@ bool SkGpuDevice::onWritePixels(const SkImageInfo& info, const void* pixels, siz if (kUnpremul_SkAlphaType == info.alphaType()) { flags = GrContext::kUnpremul_PixelOpsFlag; } - fDrawContext->accessRenderTarget()->writePixels(x, y, info.width(), info.height(), - config, pixels, rowBytes, flags); - return true; + return fDrawContext->accessRenderTarget()->writePixels(x, y, info.width(), info.height(), + config, pixels, rowBytes, flags); } bool SkGpuDevice::onAccessPixels(SkPixmap* pmap) { diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h index 1b41bde3a9..fbbcc4ed2e 100644 --- a/src/gpu/SkGpuDevice.h +++ b/src/gpu/SkGpuDevice.h @@ -38,23 +38,12 @@ 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, - sk_sp<SkColorSpace> colorSpace, - const SkSurfaceProps*, - InitContents); - - /** * 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<SkBaseDevice> Make(sk_sp<GrDrawContext> drawContext, - int width, int height, - InitContents); + static sk_sp<SkGpuDevice> Make(sk_sp<GrDrawContext> drawContext, + int width, int height, + InitContents); /** * New device that will create an offscreen renderTarget based on the ImageInfo and @@ -67,13 +56,6 @@ public: ~SkGpuDevice() override {} - SkGpuDevice* cloneDevice(const SkSurfaceProps& props) { - SkBaseDevice* dev = this->onCreateDevice(CreateInfo(this->imageInfo(), kPossible_TileUsage, - props.pixelGeometry()), - nullptr); - return static_cast<SkGpuDevice*>(dev); - } - GrContext* context() const override { return fContext; } // set all pixels to 0 |