blob: 9dadaca5065fccb91834ae6a269a73c136ed4053 [file] [log] [blame]
robertphillips76948d42016-05-04 12:47:41 -07001/*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "GrSurfaceProxy.h"
Robert Phillipsb726d582017-03-09 16:36:32 -05009#include "GrSurfaceProxyPriv.h"
robertphillips76948d42016-05-04 12:47:41 -070010
Robert Phillips784b7bf2016-12-09 13:35:02 -050011#include "GrCaps.h"
Robert Phillipse2f7d182016-12-15 09:23:05 -050012#include "GrContext.h"
13#include "GrContextPriv.h"
Robert Phillipsc7635fa2016-10-28 13:25:24 -040014#include "GrGpuResourcePriv.h"
Robert Phillipsf2361d22016-10-25 14:20:06 -040015#include "GrOpList.h"
Robert Phillips1afd4cd2018-01-08 13:40:32 -050016#include "GrProxyProvider.h"
Robert Phillipse2f7d182016-12-15 09:23:05 -050017#include "GrSurfaceContext.h"
Robert Phillipsa4c41b32017-03-15 13:02:45 -040018#include "GrTexturePriv.h"
Robert Phillips37430132016-11-09 06:50:43 -050019#include "GrTextureRenderTargetProxy.h"
Robert Phillipsf2361d22016-10-25 14:20:06 -040020
Robert Phillips93f16332016-11-23 19:37:13 -050021#include "SkMathPriv.h"
Greg Daniele1da1d92017-10-06 15:59:27 -040022#include "SkMipMap.h"
Robert Phillips93f16332016-11-23 19:37:13 -050023
Greg Daniel65fa8ca2018-01-10 17:06:31 -050024#ifdef SK_DEBUG
25static bool is_valid_fully_lazy(const GrSurfaceDesc& desc, SkBackingFit fit) {
26 return desc.fWidth <= 0 &&
27 desc.fHeight <= 0 &&
28 desc.fConfig != kUnknown_GrPixelConfig &&
29 desc.fSampleCnt == 0 &&
30 SkBackingFit::kApprox == fit;
31}
32
33static bool is_valid_partially_lazy(const GrSurfaceDesc& desc) {
34 return ((desc.fWidth > 0 && desc.fHeight > 0) ||
35 (desc.fWidth <= 0 && desc.fHeight <= 0)) &&
36 desc.fConfig != kUnknown_GrPixelConfig;
37}
38
39static bool is_valid_non_lazy(const GrSurfaceDesc& desc) {
40 return desc.fWidth > 0 &&
41 desc.fHeight > 0 &&
42 desc.fConfig != kUnknown_GrPixelConfig;
43}
44#endif
45
Chris Dalton706a6ff2017-11-29 22:01:06 -070046// Lazy-callback version
Greg Daniel65fa8ca2018-01-10 17:06:31 -050047GrSurfaceProxy::GrSurfaceProxy(LazyInstantiateCallback&& callback, const GrSurfaceDesc& desc,
48 SkBackingFit fit, SkBudgeted budgeted, uint32_t flags)
49 : fConfig(desc.fConfig)
50 , fWidth(desc.fWidth)
51 , fHeight(desc.fHeight)
52 , fOrigin(desc.fOrigin)
53 , fFit(fit)
54 , fBudgeted(budgeted)
55 , fFlags(flags)
Chris Dalton706a6ff2017-11-29 22:01:06 -070056 , fLazyInstantiateCallback(std::move(callback))
Greg Daniel65fa8ca2018-01-10 17:06:31 -050057 , fNeedsClear(SkToBool(desc.fFlags & kPerformInitialClear_GrSurfaceFlag))
Chris Dalton706a6ff2017-11-29 22:01:06 -070058 , fGpuMemorySize(kInvalidGpuMemorySize)
59 , fLastOpList(nullptr) {
60 // NOTE: the default fUniqueID ctor pulls a value from the same pool as the GrGpuResources.
Greg Daniel65fa8ca2018-01-10 17:06:31 -050061 if (fLazyInstantiateCallback) {
62 SkASSERT(is_valid_fully_lazy(desc, fit) || is_valid_partially_lazy(desc));
63 } else {
64 SkASSERT(is_valid_non_lazy(desc));
65 }
66
Chris Dalton706a6ff2017-11-29 22:01:06 -070067}
68
69// Wrapped version
Robert Phillips066f0202017-07-25 10:16:35 -040070GrSurfaceProxy::GrSurfaceProxy(sk_sp<GrSurface> surface, GrSurfaceOrigin origin, SkBackingFit fit)
Brian Salomonbb5711a2017-05-17 13:49:59 -040071 : INHERITED(std::move(surface))
72 , fConfig(fTarget->config())
73 , fWidth(fTarget->width())
74 , fHeight(fTarget->height())
Robert Phillips066f0202017-07-25 10:16:35 -040075 , fOrigin(origin)
Brian Salomonbb5711a2017-05-17 13:49:59 -040076 , fFit(fit)
77 , fBudgeted(fTarget->resourcePriv().isBudgeted())
78 , fFlags(0)
79 , fUniqueID(fTarget->uniqueID()) // Note: converting from unique resource ID to a proxy ID!
Brian Salomond17b4a62017-05-23 16:53:47 -040080 , fNeedsClear(false)
Brian Salomonbb5711a2017-05-17 13:49:59 -040081 , fGpuMemorySize(kInvalidGpuMemorySize)
Robert Phillips019ff272017-07-24 14:47:57 -040082 , fLastOpList(nullptr) {
Robert Phillips019ff272017-07-24 14:47:57 -040083}
Robert Phillipsc7635fa2016-10-28 13:25:24 -040084
Robert Phillipsf2361d22016-10-25 14:20:06 -040085GrSurfaceProxy::~GrSurfaceProxy() {
Greg Daniel94a6ce82018-01-16 16:14:41 -050086 if (fLazyInstantiateCallback) {
87 // We have an uninstantiated lazy proxy. Call fLazyInstantiateCallback with a nullptr for
88 // the GrResourceProvider to signal the callback should clean itself up.
89 this->fLazyInstantiateCallback(nullptr, nullptr);
90 }
Robert Phillips6cdc22c2017-05-11 16:29:14 -040091 // For this to be deleted the opList that held a ref on it (if there was one) must have been
92 // deleted. Which would have cleared out this back pointer.
93 SkASSERT(!fLastOpList);
Robert Phillipsf2361d22016-10-25 14:20:06 -040094}
95
Robert Phillipseafd48a2017-11-16 07:52:08 -050096bool GrSurfaceProxyPriv::AttachStencilIfNeeded(GrResourceProvider* resourceProvider,
97 GrSurface* surface, bool needsStencil) {
Robert Phillips65048132017-08-10 08:44:49 -040098 if (needsStencil) {
99 GrRenderTarget* rt = surface->asRenderTarget();
100 if (!rt) {
101 SkASSERT(0);
102 return false;
103 }
104
105 if (!resourceProvider->attachStencilAttachment(rt)) {
106 return false;
107 }
108 }
109
110 return true;
111}
112
Robert Phillips5af44de2017-07-18 14:49:38 -0400113sk_sp<GrSurface> GrSurfaceProxy::createSurfaceImpl(
Robert Phillips65048132017-08-10 08:44:49 -0400114 GrResourceProvider* resourceProvider,
115 int sampleCnt, bool needsStencil,
Greg Daniele252f082017-10-23 16:05:23 -0400116 GrSurfaceFlags flags, GrMipMapped mipMapped,
Robert Phillips5af44de2017-07-18 14:49:38 -0400117 SkDestinationSurfaceColorMode mipColorMode) const {
Greg Daniel65fa8ca2018-01-10 17:06:31 -0500118 SkASSERT(GrSurfaceProxy::LazyState::kNot == this->lazyInstantiationState());
Greg Daniele252f082017-10-23 16:05:23 -0400119 SkASSERT(GrMipMapped::kNo == mipMapped);
Brian Salomonbb5711a2017-05-17 13:49:59 -0400120 GrSurfaceDesc desc;
Brian Salomonbb5711a2017-05-17 13:49:59 -0400121 desc.fFlags = flags;
Brian Salomond17b4a62017-05-23 16:53:47 -0400122 if (fNeedsClear) {
123 desc.fFlags |= kPerformInitialClear_GrSurfaceFlag;
124 }
Robert Phillips16d8ec62017-07-27 16:16:25 -0400125 desc.fOrigin = fOrigin;
126 desc.fWidth = fWidth;
127 desc.fHeight = fHeight;
128 desc.fConfig = fConfig;
129 desc.fSampleCnt = sampleCnt;
Robert Phillipseaa86252016-11-08 13:49:39 +0000130
Robert Phillips5af44de2017-07-18 14:49:38 -0400131 sk_sp<GrSurface> surface;
Robert Phillipseaa86252016-11-08 13:49:39 +0000132 if (SkBackingFit::kApprox == fFit) {
Robert Phillips5af44de2017-07-18 14:49:38 -0400133 surface.reset(resourceProvider->createApproxTexture(desc, fFlags).release());
Robert Phillipseaa86252016-11-08 13:49:39 +0000134 } else {
Robert Phillips5af44de2017-07-18 14:49:38 -0400135 surface.reset(resourceProvider->createTexture(desc, fBudgeted, fFlags).release());
Robert Phillipseaa86252016-11-08 13:49:39 +0000136 }
Robert Phillips65048132017-08-10 08:44:49 -0400137 if (!surface) {
138 return nullptr;
139 }
140
141 surface->asTexture()->texturePriv().setMipColorMode(mipColorMode);
142
Robert Phillipseafd48a2017-11-16 07:52:08 -0500143 if (!GrSurfaceProxyPriv::AttachStencilIfNeeded(resourceProvider, surface.get(), needsStencil)) {
Robert Phillips65048132017-08-10 08:44:49 -0400144 return nullptr;
Robert Phillipseaa86252016-11-08 13:49:39 +0000145 }
146
Robert Phillips5af44de2017-07-18 14:49:38 -0400147 return surface;
148}
149
150void GrSurfaceProxy::assign(sk_sp<GrSurface> surface) {
Greg Daniel65fa8ca2018-01-10 17:06:31 -0500151 SkASSERT(LazyState::kNot == this->lazyInstantiationState());
Robert Phillips5af44de2017-07-18 14:49:38 -0400152 SkASSERT(!fTarget && surface);
153 fTarget = surface.release();
robertphillips1125a032016-11-16 11:17:17 -0800154 this->INHERITED::transferRefs();
155
Robert Phillipseaa86252016-11-08 13:49:39 +0000156#ifdef SK_DEBUG
157 if (kInvalidGpuMemorySize != this->getRawGpuMemorySize_debugOnly()) {
Robert Phillips784b7bf2016-12-09 13:35:02 -0500158 SkASSERT(fTarget->gpuMemorySize() <= this->getRawGpuMemorySize_debugOnly());
Robert Phillipseaa86252016-11-08 13:49:39 +0000159 }
160#endif
Robert Phillips5af44de2017-07-18 14:49:38 -0400161}
Robert Phillipseaa86252016-11-08 13:49:39 +0000162
Robert Phillips5af44de2017-07-18 14:49:38 -0400163bool GrSurfaceProxy::instantiateImpl(GrResourceProvider* resourceProvider, int sampleCnt,
Greg Daniele252f082017-10-23 16:05:23 -0400164 bool needsStencil, GrSurfaceFlags flags, GrMipMapped mipMapped,
Robert Phillipsae7d3f32017-09-21 08:26:08 -0400165 SkDestinationSurfaceColorMode mipColorMode,
166 const GrUniqueKey* uniqueKey) {
Greg Daniel65fa8ca2018-01-10 17:06:31 -0500167 SkASSERT(LazyState::kNot == this->lazyInstantiationState());
Robert Phillips5af44de2017-07-18 14:49:38 -0400168 if (fTarget) {
Robert Phillipsae7d3f32017-09-21 08:26:08 -0400169 if (uniqueKey) {
170 SkASSERT(fTarget->getUniqueKey() == *uniqueKey);
171 }
Robert Phillipseafd48a2017-11-16 07:52:08 -0500172 return GrSurfaceProxyPriv::AttachStencilIfNeeded(resourceProvider, fTarget, needsStencil);
Robert Phillips5af44de2017-07-18 14:49:38 -0400173 }
174
Robert Phillips65048132017-08-10 08:44:49 -0400175 sk_sp<GrSurface> surface = this->createSurfaceImpl(resourceProvider, sampleCnt, needsStencil,
Greg Daniele252f082017-10-23 16:05:23 -0400176 flags, mipMapped, mipColorMode);
Robert Phillips5af44de2017-07-18 14:49:38 -0400177 if (!surface) {
178 return false;
179 }
180
Brian Osman28c434b2017-09-27 13:11:16 -0400181 // If there was an invalidation message pending for this key, we might have just processed it,
182 // causing the key (stored on this proxy) to become invalid.
183 if (uniqueKey && uniqueKey->isValid()) {
Robert Phillipsae7d3f32017-09-21 08:26:08 -0400184 resourceProvider->assignUniqueKeyToResource(*uniqueKey, surface.get());
185 }
186
Robert Phillips5af44de2017-07-18 14:49:38 -0400187 this->assign(std::move(surface));
Robert Phillipseee4d6e2017-06-05 09:26:07 -0400188 return true;
Robert Phillipseaa86252016-11-08 13:49:39 +0000189}
190
Robert Phillips57aa3672017-07-21 11:38:13 -0400191void GrSurfaceProxy::computeScratchKey(GrScratchKey* key) const {
Greg Daniel65fa8ca2018-01-10 17:06:31 -0500192 SkASSERT(LazyState::kFully != this->lazyInstantiationState());
Robert Phillips57aa3672017-07-21 11:38:13 -0400193 const GrRenderTargetProxy* rtp = this->asRenderTargetProxy();
194 int sampleCount = 0;
195 if (rtp) {
196 sampleCount = rtp->numStencilSamples();
197 }
198
199 const GrTextureProxy* tp = this->asTextureProxy();
Greg Daniele252f082017-10-23 16:05:23 -0400200 GrMipMapped mipMapped = GrMipMapped::kNo;
Robert Phillips57aa3672017-07-21 11:38:13 -0400201 if (tp) {
Greg Daniele252f082017-10-23 16:05:23 -0400202 mipMapped = tp->mipMapped();
Robert Phillips57aa3672017-07-21 11:38:13 -0400203 }
204
Robert Phillipsa108c922017-10-10 10:42:19 -0400205 int width = this->worstCaseWidth();
206 int height = this->worstCaseHeight();
Robert Phillips57aa3672017-07-21 11:38:13 -0400207
Robert Phillipsb0e93a22017-08-29 08:26:54 -0400208 GrTexturePriv::ComputeScratchKey(this->config(), width, height, SkToBool(rtp), sampleCount,
Greg Daniele252f082017-10-23 16:05:23 -0400209 mipMapped, key);
Robert Phillips57aa3672017-07-21 11:38:13 -0400210}
211
Robert Phillipsf2361d22016-10-25 14:20:06 -0400212void GrSurfaceProxy::setLastOpList(GrOpList* opList) {
Robert Phillips6cdc22c2017-05-11 16:29:14 -0400213#ifdef SK_DEBUG
Robert Phillipsf2361d22016-10-25 14:20:06 -0400214 if (fLastOpList) {
Robert Phillipsf2361d22016-10-25 14:20:06 -0400215 SkASSERT(fLastOpList->isClosed());
Robert Phillips4a395042017-04-24 16:27:17 +0000216 }
Robert Phillips6cdc22c2017-05-11 16:29:14 -0400217#endif
Robert Phillipsf2361d22016-10-25 14:20:06 -0400218
Robert Phillips6cdc22c2017-05-11 16:29:14 -0400219 // Un-reffed
220 fLastOpList = opList;
Robert Phillipsf2361d22016-10-25 14:20:06 -0400221}
Robert Phillips37430132016-11-09 06:50:43 -0500222
Brian Osman45580d32016-11-23 09:37:01 -0500223GrRenderTargetOpList* GrSurfaceProxy::getLastRenderTargetOpList() {
224 return fLastOpList ? fLastOpList->asRenderTargetOpList() : nullptr;
225}
226
227GrTextureOpList* GrSurfaceProxy::getLastTextureOpList() {
228 return fLastOpList ? fLastOpList->asTextureOpList() : nullptr;
229}
230
Robert Phillipsa108c922017-10-10 10:42:19 -0400231int GrSurfaceProxy::worstCaseWidth() const {
Greg Daniel65fa8ca2018-01-10 17:06:31 -0500232 SkASSERT(LazyState::kFully != this->lazyInstantiationState());
Robert Phillipsa108c922017-10-10 10:42:19 -0400233 if (fTarget) {
234 return fTarget->width();
235 }
236
237 if (SkBackingFit::kExact == fFit) {
238 return fWidth;
239 }
240 return SkTMax(GrResourceProvider::kMinScratchTextureSize, GrNextPow2(fWidth));
241}
242
243int GrSurfaceProxy::worstCaseHeight() const {
Greg Daniel65fa8ca2018-01-10 17:06:31 -0500244 SkASSERT(LazyState::kFully != this->lazyInstantiationState());
Robert Phillipsa108c922017-10-10 10:42:19 -0400245 if (fTarget) {
246 return fTarget->height();
247 }
248
249 if (SkBackingFit::kExact == fFit) {
250 return fHeight;
251 }
252 return SkTMax(GrResourceProvider::kMinScratchTextureSize, GrNextPow2(fHeight));
253}
254
Brian Osman45580d32016-11-23 09:37:01 -0500255#ifdef SK_DEBUG
256void GrSurfaceProxy::validate(GrContext* context) const {
257 if (fTarget) {
258 SkASSERT(fTarget->getContext() == context);
259 }
260
261 INHERITED::validate();
262}
263#endif
Robert Phillipse2f7d182016-12-15 09:23:05 -0500264
Robert Phillips63c67462017-02-15 14:19:01 -0500265sk_sp<GrTextureProxy> GrSurfaceProxy::Copy(GrContext* context,
Robert Phillipse2f7d182016-12-15 09:23:05 -0500266 GrSurfaceProxy* src,
Greg Daniel65c7f662017-10-30 13:39:09 -0400267 GrMipMapped mipMapped,
Robert Phillipse2f7d182016-12-15 09:23:05 -0500268 SkIRect srcRect,
269 SkBudgeted budgeted) {
Greg Daniel65fa8ca2018-01-10 17:06:31 -0500270 SkASSERT(LazyState::kFully != src->lazyInstantiationState());
Robert Phillipse2f7d182016-12-15 09:23:05 -0500271 if (!srcRect.intersect(SkIRect::MakeWH(src->width(), src->height()))) {
272 return nullptr;
273 }
274
Brian Salomon63e79732017-05-15 21:23:13 -0400275 GrSurfaceDesc dstDesc;
Robert Phillips16d8ec62017-07-27 16:16:25 -0400276 dstDesc.fOrigin = src->origin();
Robert Phillipse2f7d182016-12-15 09:23:05 -0500277 dstDesc.fWidth = srcRect.width();
278 dstDesc.fHeight = srcRect.height();
Robert Phillips16d8ec62017-07-27 16:16:25 -0400279 dstDesc.fConfig = src->config();
Robert Phillipse2f7d182016-12-15 09:23:05 -0500280
281 sk_sp<GrSurfaceContext> dstContext(context->contextPriv().makeDeferredSurfaceContext(
282 dstDesc,
Greg Daniel65c7f662017-10-30 13:39:09 -0400283 mipMapped,
Robert Phillipse2f7d182016-12-15 09:23:05 -0500284 SkBackingFit::kExact,
285 budgeted));
286 if (!dstContext) {
287 return nullptr;
288 }
289
290 if (!dstContext->copy(src, srcRect, SkIPoint::Make(0, 0))) {
291 return nullptr;
292 }
293
Robert Phillips63c67462017-02-15 14:19:01 -0500294 return dstContext->asTextureProxyRef();
295}
296
297sk_sp<GrTextureProxy> GrSurfaceProxy::Copy(GrContext* context, GrSurfaceProxy* src,
Greg Daniel65c7f662017-10-30 13:39:09 -0400298 GrMipMapped mipMapped, SkBudgeted budgeted) {
Greg Daniel65fa8ca2018-01-10 17:06:31 -0500299 SkASSERT(LazyState::kFully != src->lazyInstantiationState());
Greg Daniel65c7f662017-10-30 13:39:09 -0400300 return Copy(context, src, mipMapped, SkIRect::MakeWH(src->width(), src->height()), budgeted);
Robert Phillipse2f7d182016-12-15 09:23:05 -0500301}
302
Robert Phillipsd46697a2017-01-25 12:10:37 -0500303sk_sp<GrSurfaceContext> GrSurfaceProxy::TestCopy(GrContext* context, const GrSurfaceDesc& dstDesc,
304 GrSurfaceProxy* srcProxy) {
Greg Daniel65fa8ca2018-01-10 17:06:31 -0500305 SkASSERT(LazyState::kFully != srcProxy->lazyInstantiationState());
Robert Phillipse2f7d182016-12-15 09:23:05 -0500306 sk_sp<GrSurfaceContext> dstContext(context->contextPriv().makeDeferredSurfaceContext(
307 dstDesc,
Greg Daniel65c7f662017-10-30 13:39:09 -0400308 GrMipMapped::kNo,
Robert Phillipse2f7d182016-12-15 09:23:05 -0500309 SkBackingFit::kExact,
Robert Phillipsd46697a2017-01-25 12:10:37 -0500310 SkBudgeted::kYes));
Robert Phillipse2f7d182016-12-15 09:23:05 -0500311 if (!dstContext) {
312 return nullptr;
313 }
314
Robert Phillipsd46697a2017-01-25 12:10:37 -0500315 if (!dstContext->copy(srcProxy)) {
Robert Phillipse2f7d182016-12-15 09:23:05 -0500316 return nullptr;
317 }
318
Robert Phillipsd46697a2017-01-25 12:10:37 -0500319 return dstContext;
Robert Phillipse2f7d182016-12-15 09:23:05 -0500320}
Robert Phillipsb726d582017-03-09 16:36:32 -0500321
Robert Phillips0ae6faa2017-03-21 16:22:00 -0400322void GrSurfaceProxyPriv::exactify() {
Greg Daniel65fa8ca2018-01-10 17:06:31 -0500323 SkASSERT(GrSurfaceProxy::LazyState::kFully != fProxy->lazyInstantiationState());
Robert Phillips0ae6faa2017-03-21 16:22:00 -0400324 if (this->isExact()) {
325 return;
326 }
327
328 SkASSERT(SkBackingFit::kApprox == fProxy->fFit);
329
330 if (fProxy->fTarget) {
331 // The kApprox but already instantiated case. Setting the proxy's width & height to
332 // the instantiated width & height could have side-effects going forward, since we're
Ben Wagner63fd7602017-10-09 15:45:33 -0400333 // obliterating the area of interest information. This call (exactify) only used
Robert Phillips0ae6faa2017-03-21 16:22:00 -0400334 // when converting an SkSpecialImage to an SkImage so the proxy shouldn't be
335 // used for additional draws.
Brian Salomonbb5711a2017-05-17 13:49:59 -0400336 fProxy->fWidth = fProxy->fTarget->width();
337 fProxy->fHeight = fProxy->fTarget->height();
Robert Phillips0ae6faa2017-03-21 16:22:00 -0400338 return;
339 }
340
341 // The kApprox uninstantiated case. Making this proxy be exact should be okay.
342 // It could mess things up if prior decisions were based on the approximate size.
343 fProxy->fFit = SkBackingFit::kExact;
344 // If fGpuMemorySize is used when caching specialImages for the image filter DAG. If it has
Robert Phillips6cdc22c2017-05-11 16:29:14 -0400345 // already been computed we want to leave it alone so that amount will be removed when
Robert Phillips0ae6faa2017-03-21 16:22:00 -0400346 // the special image goes away. If it hasn't been computed yet it might as well compute the
347 // exact amount.
348}
349
Chris Dalton706a6ff2017-11-29 22:01:06 -0700350void GrSurfaceProxyPriv::doLazyInstantiation(GrResourceProvider* resourceProvider) {
351 SkASSERT(fProxy->fLazyInstantiateCallback);
352 SkASSERT(!fProxy->fTarget);
353
354 sk_sp<GrTexture> texture = fProxy->fLazyInstantiateCallback(resourceProvider, &fProxy->fOrigin);
355
356 // Indicate we are no longer pending lazy instantiation.
357 fProxy->fLazyInstantiateCallback = nullptr;
358
359 if (!texture) {
360 fProxy->fWidth = 0;
361 fProxy->fHeight = 0;
362 fProxy->fOrigin = kTopLeft_GrSurfaceOrigin;
363 return;
364 }
365
366 fProxy->fWidth = texture->width();
367 fProxy->fHeight = texture->height();
368
369 SkASSERT(texture->config() == fProxy->fConfig);
Chris Dalton706a6ff2017-11-29 22:01:06 -0700370 SkDEBUGCODE(fProxy->validateLazyTexture(texture.get());)
371 this->assign(std::move(texture));
372}
373