Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Side by Side Diff: src/gpu/GrRenderTargetOpList.cpp

Issue 2448593002: Remove SkAutoTUnref and SkAutoTDelete from public includes. (Closed)
Patch Set: And Vulcan. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrGpu.cpp ('k') | src/gpu/GrResourceProvider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2010 Google Inc. 2 * Copyright 2010 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrRenderTargetOpList.h" 8 #include "GrRenderTargetOpList.h"
9 9
10 #include "GrAppliedClip.h" 10 #include "GrAppliedClip.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 bounds.outset(0.5f, 0.5f); 106 bounds.outset(0.5f, 0.5f);
107 107
108 if (!pipelineBuilder.willXPNeedDstTexture(*this->caps(), optimizations)) { 108 if (!pipelineBuilder.willXPNeedDstTexture(*this->caps(), optimizations)) {
109 return true; 109 return true;
110 } 110 }
111 111
112 if (this->caps()->textureBarrierSupport()) { 112 if (this->caps()->textureBarrierSupport()) {
113 if (GrTexture* rtTex = rt->asTexture()) { 113 if (GrTexture* rtTex = rt->asTexture()) {
114 // The render target is a texture, so we can read from it directly i n the shader. The XP 114 // The render target is a texture, so we can read from it directly i n the shader. The XP
115 // will be responsible to detect this situation and request a textur e barrier. 115 // will be responsible to detect this situation and request a textur e barrier.
116 dstTexture->setTexture(rtTex); 116 dstTexture->setTexture(sk_ref_sp(rtTex));
117 dstTexture->setOffset(0, 0); 117 dstTexture->setOffset(0, 0);
118 return true; 118 return true;
119 } 119 }
120 } 120 }
121 121
122 SkIRect copyRect; 122 SkIRect copyRect;
123 clip.getConservativeBounds(rt->width(), rt->height(), &copyRect); 123 clip.getConservativeBounds(rt->width(), rt->height(), &copyRect);
124 124
125 SkIRect drawIBounds; 125 SkIRect drawIBounds;
126 bounds.roundOut(&drawIBounds); 126 bounds.roundOut(&drawIBounds);
(...skipping 11 matching lines...) Expand all
138 if (!fGpu->initDescForDstCopy(rt, &desc)) { 138 if (!fGpu->initDescForDstCopy(rt, &desc)) {
139 desc.fOrigin = kDefault_GrSurfaceOrigin; 139 desc.fOrigin = kDefault_GrSurfaceOrigin;
140 desc.fFlags = kRenderTarget_GrSurfaceFlag; 140 desc.fFlags = kRenderTarget_GrSurfaceFlag;
141 desc.fConfig = rt->config(); 141 desc.fConfig = rt->config();
142 } 142 }
143 143
144 desc.fWidth = copyRect.width(); 144 desc.fWidth = copyRect.width();
145 desc.fHeight = copyRect.height(); 145 desc.fHeight = copyRect.height();
146 146
147 static const uint32_t kFlags = 0; 147 static const uint32_t kFlags = 0;
148 SkAutoTUnref<GrTexture> copy(fResourceProvider->createApproxTexture(desc, kF lags)); 148 sk_sp<GrTexture> copy(fResourceProvider->createApproxTexture(desc, kFlags));
149 149
150 if (!copy) { 150 if (!copy) {
151 SkDebugf("Failed to create temporary copy of destination texture.\n"); 151 SkDebugf("Failed to create temporary copy of destination texture.\n");
152 return false; 152 return false;
153 } 153 }
154 SkIPoint dstPoint = {0, 0}; 154 SkIPoint dstPoint = {0, 0};
155 this->copySurface(copy, rt, copyRect, dstPoint); 155 this->copySurface(copy.get(), rt, copyRect, dstPoint);
156 dstTexture->setTexture(copy); 156 dstTexture->setTexture(std::move(copy));
157 dstTexture->setOffset(copyRect.fLeft, copyRect.fTop); 157 dstTexture->setOffset(copyRect.fLeft, copyRect.fTop);
158 return true; 158 return true;
159 } 159 }
160 160
161 void GrRenderTargetOpList::prepareBatches(GrBatchFlushState* flushState) { 161 void GrRenderTargetOpList::prepareBatches(GrBatchFlushState* flushState) {
162 // Semi-usually the GrOpLists are already closed at this point, but sometime s Ganesh 162 // Semi-usually the GrOpLists are already closed at this point, but sometime s Ganesh
163 // needs to flush mid-draw. In that case, the SkGpuDevice's GrOpLists won't be closed 163 // needs to flush mid-draw. In that case, the SkGpuDevice's GrOpLists won't be closed
164 // but need to be flushed anyway. Closing such GrOpLists here will mean new 164 // but need to be flushed anyway. Closing such GrOpLists here will mean new
165 // GrOpLists will be created to replace them if the SkGpuDevice(s) write to them again. 165 // GrOpLists will be created to replace them if the SkGpuDevice(s) write to them again.
166 this->makeClosed(); 166 this->makeClosed();
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 570
571 /////////////////////////////////////////////////////////////////////////////// 571 ///////////////////////////////////////////////////////////////////////////////
572 572
573 void GrRenderTargetOpList::clearStencilClip(const GrFixedClip& clip, 573 void GrRenderTargetOpList::clearStencilClip(const GrFixedClip& clip,
574 bool insideStencilMask, 574 bool insideStencilMask,
575 GrRenderTarget* rt) { 575 GrRenderTarget* rt) {
576 GrBatch* batch = new GrClearStencilClipBatch(clip, insideStencilMask, rt); 576 GrBatch* batch = new GrClearStencilClipBatch(clip, insideStencilMask, rt);
577 this->recordBatch(batch, batch->bounds()); 577 this->recordBatch(batch, batch->bounds());
578 batch->unref(); 578 batch->unref();
579 } 579 }
OLDNEW
« no previous file with comments | « src/gpu/GrGpu.cpp ('k') | src/gpu/GrResourceProvider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698