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

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

Issue 1275543005: Move some work from backend onClear to base class clear (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Pass references and rebase Created 5 years, 4 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 | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrGpu.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 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrDrawTarget.h" 9 #include "GrDrawTarget.h"
10 10
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 const SkMatrix& viewMatrix, 302 const SkMatrix& viewMatrix,
303 const SkRect& rect, 303 const SkRect& rect,
304 const SkRect& devRect) { 304 const SkRect& devRect) {
305 GrAARectRenderer::FillAARect(this, pipelineBuilder, color, viewMatrix, rect, devRect); 305 GrAARectRenderer::FillAARect(this, pipelineBuilder, color, viewMatrix, rect, devRect);
306 } 306 }
307 307
308 void GrDrawTarget::clear(const SkIRect* rect, 308 void GrDrawTarget::clear(const SkIRect* rect,
309 GrColor color, 309 GrColor color,
310 bool canIgnoreRect, 310 bool canIgnoreRect,
311 GrRenderTarget* renderTarget) { 311 GrRenderTarget* renderTarget) {
312 SkIRect rtRect = SkIRect::MakeWH(renderTarget->width(), renderTarget->height ());
313 SkIRect clippedRect;
314 if (!rect ||
315 (canIgnoreRect && this->caps()->fullClearIsFree()) ||
316 rect->contains(rtRect)) {
317 rect = &rtRect;
318 } else {
319 clippedRect = *rect;
320 if (!clippedRect.intersect(rtRect)) {
321 return;
322 }
323 rect = &clippedRect;
324 }
325
312 if (fCaps->useDrawInsteadOfClear()) { 326 if (fCaps->useDrawInsteadOfClear()) {
313 // This works around a driver bug with clear by drawing a rect instead. 327 // This works around a driver bug with clear by drawing a rect instead.
314 // The driver will ignore a clear if it is the only thing rendered to a 328 // The driver will ignore a clear if it is the only thing rendered to a
315 // target before the target is read. 329 // target before the target is read.
316 SkIRect rtRect = SkIRect::MakeWH(renderTarget->width(), renderTarget->he ight()); 330 if (rect == &rtRect) {
317 if (NULL == rect || canIgnoreRect || rect->contains(rtRect)) {
318 rect = &rtRect;
319 // We first issue a discard() since that may help tilers.
320 this->discard(renderTarget); 331 this->discard(renderTarget);
321 } 332 }
322 333
323 GrPipelineBuilder pipelineBuilder; 334 GrPipelineBuilder pipelineBuilder;
324 pipelineBuilder.setRenderTarget(renderTarget); 335 pipelineBuilder.setRenderTarget(renderTarget);
325 336
326 this->drawSimpleRect(pipelineBuilder, color, SkMatrix::I(), *rect); 337 this->drawSimpleRect(pipelineBuilder, color, SkMatrix::I(), *rect);
327 } else { 338 } else {
328 this->onClear(rect, color, canIgnoreRect, renderTarget); 339 this->onClear(*rect, color, renderTarget);
329 } 340 }
330 } 341 }
331 342
332 typedef GrTraceMarkerSet::Iter TMIter; 343 typedef GrTraceMarkerSet::Iter TMIter;
333 void GrDrawTarget::saveActiveTraceMarkers() { 344 void GrDrawTarget::saveActiveTraceMarkers() {
334 if (this->caps()->gpuTracingSupport()) { 345 if (this->caps()->gpuTracingSupport()) {
335 SkASSERT(0 == fStoredTraceMarkers.count()); 346 SkASSERT(0 == fStoredTraceMarkers.count());
336 fStoredTraceMarkers.addSet(fActiveTraceMarkers); 347 fStoredTraceMarkers.addSet(fActiveTraceMarkers);
337 for (TMIter iter = fStoredTraceMarkers.begin(); iter != fStoredTraceMark ers.end(); ++iter) { 348 for (TMIter iter = fStoredTraceMarkers.begin(); iter != fStoredTraceMark ers.end(); ++iter) {
338 this->removeGpuTraceMarker(&(*iter)); 349 this->removeGpuTraceMarker(&(*iter));
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 ars, 515 ars,
505 scissorState, 516 scissorState,
506 devBounds); 517 devBounds);
507 } 518 }
508 519
509 void GrClipTarget::purgeResources() { 520 void GrClipTarget::purgeResources() {
510 // The clip mask manager can rebuild all its clip masks so just 521 // The clip mask manager can rebuild all its clip masks so just
511 // get rid of them all. 522 // get rid of them all.
512 fClipMaskManager->purgeResources(); 523 fClipMaskManager->purgeResources();
513 }; 524 };
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698