| Index: src/gpu/SkGpuDevice.cpp
|
| diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
|
| index 9357568117bebfcc6ed5900a110e6ad0dc13f0f3..19981e773257f45f1c3b96f9037c2c8d411b068d 100644
|
| --- a/src/gpu/SkGpuDevice.cpp
|
| +++ b/src/gpu/SkGpuDevice.cpp
|
| @@ -127,7 +127,8 @@ bool SkGpuDevice::CheckAlphaTypeAndGetFlags(
|
| return true;
|
| }
|
|
|
| -sk_sp<SkGpuDevice> SkGpuDevice::Make(sk_sp<GrRenderTarget> rt, const SkSurfaceProps* props,
|
| +sk_sp<SkGpuDevice> SkGpuDevice::Make(int width, int height,
|
| + sk_sp<GrRenderTarget> rt, const SkSurfaceProps* props,
|
| InitContents init) {
|
| if (!rt || rt->wasDestroyed() || !rt->getContext()) {
|
| return nullptr;
|
| @@ -137,17 +138,13 @@ sk_sp<SkGpuDevice> SkGpuDevice::Make(sk_sp<GrRenderTarget> rt, const SkSurfacePr
|
| return nullptr;
|
| }
|
|
|
| - const int width = rt->width();
|
| - const int height = rt->height();
|
| -
|
| GrContext* context = rt->getContext();
|
|
|
| - sk_sp<GrDrawContext> drawContext(context->drawContext(std::move(rt), props));
|
| - return sk_sp<SkGpuDevice>(new SkGpuDevice(std::move(drawContext), width, height, flags));
|
| + sk_sp<GrDrawContext> drawContext(context->drawContext(width, height, std::move(rt), props));
|
| + return sk_sp<SkGpuDevice>(new SkGpuDevice(std::move(drawContext), flags));
|
| }
|
|
|
| sk_sp<SkBaseDevice> SkGpuDevice::Make(sk_sp<GrDrawContext> drawContext,
|
| - int width, int height,
|
| InitContents init) {
|
| if (!drawContext || drawContext->wasAbandoned()) {
|
| return nullptr;
|
| @@ -156,7 +153,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<SkBaseDevice>(new SkGpuDevice(std::move(drawContext), flags));
|
| }
|
|
|
| sk_sp<SkGpuDevice> SkGpuDevice::Make(GrContext* context, SkBudgeted budgeted,
|
| @@ -173,11 +170,10 @@ sk_sp<SkGpuDevice> SkGpuDevice::Make(GrContext* context, SkBudgeted budgeted,
|
| return nullptr;
|
| }
|
|
|
| - return sk_sp<SkGpuDevice>(new SkGpuDevice(std::move(drawContext),
|
| - info.width(), info.height(), flags));
|
| + return sk_sp<SkGpuDevice>(new SkGpuDevice(std::move(drawContext), flags));
|
| }
|
|
|
| -SkGpuDevice::SkGpuDevice(sk_sp<GrDrawContext> drawContext, int width, int height, unsigned flags)
|
| +SkGpuDevice::SkGpuDevice(sk_sp<GrDrawContext> drawContext, unsigned flags)
|
| : INHERITED(drawContext->surfaceProps())
|
| , fContext(SkRef(drawContext->accessRenderTarget()->getContext()))
|
| , fRenderTarget(drawContext->renderTarget())
|
| @@ -185,11 +181,12 @@ SkGpuDevice::SkGpuDevice(sk_sp<GrDrawContext> drawContext, int width, int height
|
| fOpaque = SkToBool(flags & kIsOpaque_Flag);
|
|
|
| SkAlphaType at = fOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
|
| - SkImageInfo info = fRenderTarget->surfacePriv().info(at).makeWH(width, height);
|
| + SkImageInfo info = fRenderTarget->surfacePriv().info(at).makeWH(fDrawContext->width(),
|
| + fDrawContext->height());
|
| SkPixelRef* pr = new SkGrPixelRef(info, fRenderTarget.get());
|
| fLegacyBitmap.setInfo(info);
|
| fLegacyBitmap.setPixelRef(pr)->unref();
|
| -
|
| +
|
| if (flags & kNeedClear_Flag) {
|
| this->clearAll();
|
| }
|
| @@ -1886,9 +1883,7 @@ SkBaseDevice* SkGpuDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint
|
| // Skia's convention is to only clear a device if it is non-opaque.
|
| InitContents init = cinfo.fInfo.isOpaque() ? kUninit_InitContents : kClear_InitContents;
|
|
|
| - return SkGpuDevice::Make(std::move(dc),
|
| - cinfo.fInfo.width(), cinfo.fInfo.height(),
|
| - init).release();
|
| + return SkGpuDevice::Make(std::move(dc), init).release();
|
| }
|
|
|
| sk_sp<SkSurface> SkGpuDevice::makeSurface(const SkImageInfo& info, const SkSurfaceProps& props) {
|
|
|