aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/SkGpuDevice.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/SkGpuDevice.cpp')
-rw-r--r--src/gpu/SkGpuDevice.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 5738764a5b..3cdc34e982 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -15,7 +15,6 @@
#include "GrRenderTargetContextPriv.h"
#include "GrStyle.h"
#include "GrTextureAdjuster.h"
-#include "GrTextureProxy.h"
#include "GrTracing.h"
#include "SkCanvasPriv.h"
@@ -263,7 +262,9 @@ void SkGpuDevice::replaceRenderTargetContext(bool shouldRetainContent) {
if (fRenderTargetContext->wasAbandoned()) {
return;
}
- newRTC->copy(fRenderTargetContext->asDeferredSurface());
+ newRTC->copySurface(fRenderTargetContext->asTexture().get(),
+ SkIRect::MakeWH(this->width(), this->height()),
+ SkIPoint::Make(0, 0));
}
fRenderTargetContext = newRTC;
@@ -1331,15 +1332,19 @@ sk_sp<SkSpecialImage> SkGpuDevice::makeSpecial(const SkImage* image) {
}
sk_sp<SkSpecialImage> SkGpuDevice::snapSpecial() {
- sk_sp<GrSurfaceProxy> sProxy(sk_ref_sp(this->accessRenderTargetContext()->asDeferredTexture()));
- if (!sProxy) {
+ sk_sp<GrTexture> texture(this->accessRenderTargetContext()->asTexture());
+ if (!texture) {
// When the device doesn't have a texture, we create a temporary texture.
// TODO: we should actually only copy the portion of the source needed to apply the image
// filter
- sProxy = GrSurfaceProxy::Copy(fContext.get(),
- this->accessRenderTargetContext()->asDeferredSurface(),
- SkBudgeted::kYes);
- if (!sProxy) {
+ texture.reset(fContext->textureProvider()->createTexture(
+ this->accessRenderTargetContext()->desc(), SkBudgeted::kYes));
+ if (!texture) {
+ return nullptr;
+ }
+
+ if (!fContext->copySurface(texture.get(),
+ this->accessRenderTargetContext()->accessRenderTarget())) {
return nullptr;
}
}
@@ -1347,12 +1352,11 @@ sk_sp<SkSpecialImage> SkGpuDevice::snapSpecial() {
const SkImageInfo ii = this->imageInfo();
const SkIRect srcRect = SkIRect::MakeWH(ii.width(), ii.height());
- return SkSpecialImage::MakeDeferredFromGpu(fContext.get(),
- srcRect,
- kNeedNewImageUniqueID_SpecialImage,
- sProxy,
- sk_ref_sp(ii.colorSpace()),
- &this->surfaceProps());
+ return SkSpecialImage::MakeFromGpu(srcRect,
+ kNeedNewImageUniqueID_SpecialImage,
+ std::move(texture),
+ sk_ref_sp(ii.colorSpace()),
+ &this->surfaceProps());
}
void SkGpuDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device,