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

Side by Side Diff: tools/gpu/GrTest.cpp

Issue 1971343002: Convert GrClip to an abstract base class (Closed) Base URL: https://skia.googlesource.com/skia.git@upload2_clipout
Patch Set: fix crash Created 4 years, 7 months 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 | « tests/TessellatingPathRendererTests.cpp ('k') | no next file » | 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 2013 Google Inc. 2 * Copyright 2013 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 "GrTest.h" 8 #include "GrTest.h"
9 9
10 #include "GrBatchAtlas.h" 10 #include "GrBatchAtlas.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 161 }
162 SkMatrix textureMat; 162 SkMatrix textureMat;
163 textureMat.reset(); 163 textureMat.reset();
164 textureMat[SkMatrix::kMScaleX] = 1.0f/dst.width(); 164 textureMat[SkMatrix::kMScaleX] = 1.0f/dst.width();
165 textureMat[SkMatrix::kMScaleY] = 1.0f/dst.height(); 165 textureMat[SkMatrix::kMScaleY] = 1.0f/dst.height();
166 textureMat[SkMatrix::kMTransX] = -dst.fLeft/dst.width(); 166 textureMat[SkMatrix::kMTransX] = -dst.fLeft/dst.width();
167 textureMat[SkMatrix::kMTransY] = -dst.fTop/dst.height(); 167 textureMat[SkMatrix::kMTransY] = -dst.fTop/dst.height();
168 168
169 grPaint.addColorTextureProcessor(tex, textureMat); 169 grPaint.addColorTextureProcessor(tex, textureMat);
170 170
171 GrClip clip; 171 fDrawContext->drawRect(GrNoClip(), grPaint, mat, dst);
172 fDrawContext->drawRect(clip, grPaint, mat, dst);
173 } 172 }
174 173
175 174
176 #if GR_GPU_STATS 175 #if GR_GPU_STATS
177 void GrGpu::Stats::dump(SkString* out) { 176 void GrGpu::Stats::dump(SkString* out) {
178 out->appendf("Render Target Binds: %d\n", fRenderTargetBinds); 177 out->appendf("Render Target Binds: %d\n", fRenderTargetBinds);
179 out->appendf("Shader Compilations: %d\n", fShaderCompilations); 178 out->appendf("Shader Compilations: %d\n", fShaderCompilations);
180 out->appendf("Textures Created: %d\n", fTextureCreates); 179 out->appendf("Textures Created: %d\n", fTextureCreates);
181 out->appendf("Texture Uploads: %d\n", fTextureUploads); 180 out->appendf("Texture Uploads: %d\n", fTextureUploads);
182 out->appendf("Transfers to Texture: %d\n", fTransfersToTexture); 181 out->appendf("Transfers to Texture: %d\n", fTransfersToTexture);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 #define RETURN_IF_ABANDONED if (fDrawContext->fDrawingManager->abandoned( )) { return; } 252 #define RETURN_IF_ABANDONED if (fDrawContext->fDrawingManager->abandoned( )) { return; }
254 253
255 void GrDrawContextPriv::testingOnly_drawBatch(const GrPipelineBuilder& pipelineB uilder, 254 void GrDrawContextPriv::testingOnly_drawBatch(const GrPipelineBuilder& pipelineB uilder,
256 GrDrawBatch* batch, 255 GrDrawBatch* batch,
257 const GrClip* clip) { 256 const GrClip* clip) {
258 ASSERT_SINGLE_OWNER 257 ASSERT_SINGLE_OWNER
259 RETURN_IF_ABANDONED 258 RETURN_IF_ABANDONED
260 SkDEBUGCODE(fDrawContext->validate();) 259 SkDEBUGCODE(fDrawContext->validate();)
261 GR_AUDIT_TRAIL_AUTO_FRAME(fDrawContext->fAuditTrail, "GrDrawContext::testing Only_drawBatch"); 260 GR_AUDIT_TRAIL_AUTO_FRAME(fDrawContext->fAuditTrail, "GrDrawContext::testing Only_drawBatch");
262 261
263 const GrClip& drawClip = clip ? *clip : GrClip::WideOpen(); 262 if (clip) {
264 fDrawContext->getDrawTarget()->drawBatch(pipelineBuilder, drawClip, batch); 263 fDrawContext->getDrawTarget()->drawBatch(pipelineBuilder, *clip, batch);
264 } else {
265 fDrawContext->getDrawTarget()->drawBatch(pipelineBuilder, GrNoClip(), ba tch);
266 }
265 } 267 }
266 268
267 #undef ASSERT_SINGLE_OWNER 269 #undef ASSERT_SINGLE_OWNER
268 #undef RETURN_IF_ABANDONED 270 #undef RETURN_IF_ABANDONED
269 271
270 /////////////////////////////////////////////////////////////////////////////// 272 ///////////////////////////////////////////////////////////////////////////////
271 // Code for the mock context. It's built on a mock GrGpu class that does nothing . 273 // Code for the mock context. It's built on a mock GrGpu class that does nothing .
272 //// 274 ////
273 275
274 #include "GrGpu.h" 276 #include "GrGpu.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 SkASSERT(nullptr == fGpu); 415 SkASSERT(nullptr == fGpu);
414 fGpu = new MockGpu(this, options); 416 fGpu = new MockGpu(this, options);
415 SkASSERT(fGpu); 417 SkASSERT(fGpu);
416 this->initCommon(options); 418 this->initCommon(options);
417 419
418 // We delete these because we want to test the cache starting with zero reso urces. Also, none of 420 // We delete these because we want to test the cache starting with zero reso urces. Also, none of
419 // these objects are required for any of tests that use this context. TODO: make stop allocating 421 // these objects are required for any of tests that use this context. TODO: make stop allocating
420 // resources in the buffer pools. 422 // resources in the buffer pools.
421 fDrawingManager->abandon(); 423 fDrawingManager->abandon();
422 } 424 }
OLDNEW
« no previous file with comments | « tests/TessellatingPathRendererTests.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698