Chromium Code Reviews| Index: src/gpu/SkGpuDevice.cpp |
| diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp |
| index 72718192692447d45a89c9ce85a43161c612484f..858b34b75117ee4282805c4af9263bf7d44c2351 100644 |
| --- a/src/gpu/SkGpuDevice.cpp |
| +++ b/src/gpu/SkGpuDevice.cpp |
| @@ -9,13 +9,15 @@ |
| #include "GrBlurUtils.h" |
| #include "GrContext.h" |
| -#include "SkDraw.h" |
| +#include "GrDrawContextPriv.h" |
| #include "GrGpu.h" |
| #include "GrGpuResourcePriv.h" |
| #include "GrImageIDTextureAdjuster.h" |
| #include "GrStyle.h" |
| #include "GrTracing.h" |
| + |
| #include "SkCanvasPriv.h" |
| +#include "SkDraw.h" |
| #include "SkErrorInternals.h" |
| #include "SkGlyphCache.h" |
| #include "SkGr.h" |
| @@ -144,7 +146,6 @@ sk_sp<SkGpuDevice> SkGpuDevice::Make(GrContext* context, SkBudgeted budgeted, |
| SkGpuDevice::SkGpuDevice(sk_sp<GrDrawContext> drawContext, int width, int height, unsigned flags) |
| : INHERITED(drawContext->surfaceProps()) |
| , fContext(SkRef(drawContext->accessRenderTarget()->getContext())) |
| - , fRenderTarget(drawContext->renderTarget()) |
| , fDrawContext(std::move(drawContext)) { |
| fSize.set(width, height); |
| fOpaque = SkToBool(flags & kIsOpaque_Flag); |
| @@ -226,8 +227,10 @@ bool SkGpuDevice::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size |
| if (kUnpremul_SkAlphaType == dstInfo.alphaType()) { |
| flags = GrContext::kUnpremul_PixelOpsFlag; |
| } |
| - return fRenderTarget->readPixels(x, y, dstInfo.width(), dstInfo.height(), config, dstPixels, |
| - dstRowBytes, flags); |
| + return fDrawContext->accessRenderTarget()->readPixels(x, y, |
| + dstInfo.width(), dstInfo.height(), |
| + config, dstPixels, |
| + dstRowBytes, flags); |
| } |
| bool SkGpuDevice::onWritePixels(const SkImageInfo& info, const void* pixels, size_t rowBytes, |
| @@ -242,8 +245,8 @@ bool SkGpuDevice::onWritePixels(const SkImageInfo& info, const void* pixels, siz |
| if (kUnpremul_SkAlphaType == info.alphaType()) { |
| flags = GrContext::kUnpremul_PixelOpsFlag; |
| } |
| - fRenderTarget->writePixels(x, y, info.width(), info.height(), config, pixels, rowBytes, flags); |
| - |
| + fDrawContext->accessRenderTarget()->writePixels(x, y, info.width(), info.height(), |
| + config, pixels, rowBytes, flags); |
| return true; |
| } |
| @@ -276,7 +279,7 @@ void SkGpuDevice::clearAll() { |
| void SkGpuDevice::replaceDrawContext(bool shouldRetainContent) { |
| ASSERT_SINGLE_OWNER |
| - SkBudgeted budgeted = fRenderTarget->resourcePriv().isBudgeted(); |
| + SkBudgeted budgeted = fDrawContext->drawContextPriv().isBudgeted(); |
| sk_sp<GrDrawContext> newDC(MakeDrawContext(this->context(), |
| budgeted, |
| @@ -289,7 +292,7 @@ void SkGpuDevice::replaceDrawContext(bool shouldRetainContent) { |
| } |
| if (shouldRetainContent) { |
| - if (fRenderTarget->wasDestroyed()) { |
| + if (fDrawContext->wasAbandoned()) { |
|
egdaniel
2016/08/03 19:55:06
is there an actual difference in what abandoned vs
robertphillips
2016/08/03 20:36:10
The two (public) ways to get into the GrGpuResourc
|
| return; |
| } |
| newDC->copySurface(fDrawContext->asTexture().get(), |
| @@ -297,10 +300,6 @@ void SkGpuDevice::replaceDrawContext(bool shouldRetainContent) { |
| SkIPoint::Make(0, 0)); |
| } |
| - SkASSERT(fDrawContext->accessRenderTarget() != newDC->accessRenderTarget()); |
| - |
| - fRenderTarget = newDC->renderTarget(); |
| - |
| fDrawContext = newDC; |
| } |