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

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

Issue 26237010: remove clipstack/region bounds assertion (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 2011 Google Inc. 2 * Copyright 2011 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 "SkGpuDevice.h" 8 #include "SkGpuDevice.h"
9 9
10 #include "effects/GrTextureDomainEffect.h" 10 #include "effects/GrTextureDomainEffect.h"
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 365
366 void SkGpuDevice::onDetachFromCanvas() { 366 void SkGpuDevice::onDetachFromCanvas() {
367 INHERITED::onDetachFromCanvas(); 367 INHERITED::onDetachFromCanvas();
368 368
369 // TODO: iterate through the clip stack and clean up any cached clip masks 369 // TODO: iterate through the clip stack and clean up any cached clip masks
370 fClipData.fClipStack->removePurgeClipCallback(purgeClipCB, fContext); 370 fClipData.fClipStack->removePurgeClipCallback(purgeClipCB, fContext);
371 371
372 fClipData.fClipStack = NULL; 372 fClipData.fClipStack = NULL;
373 } 373 }
374 374
375 #ifdef SK_DEBUG
376 static void check_bounds(const GrClipData& clipData,
377 const SkRegion& clipRegion,
378 int renderTargetWidth,
379 int renderTargetHeight) {
380
381 SkIRect devBound;
382
383 devBound.setLTRB(0, 0, renderTargetWidth, renderTargetHeight);
384
385 SkClipStack::BoundsType boundType;
386 SkRect canvTemp;
387
388 clipData.fClipStack->getBounds(&canvTemp, &boundType);
389 if (SkClipStack::kNormal_BoundsType == boundType) {
390 SkIRect devTemp;
391
392 canvTemp.roundOut(&devTemp);
393
394 devTemp.offset(-clipData.fOrigin.fX, -clipData.fOrigin.fY);
395
396 if (!devBound.intersect(devTemp)) {
397 devBound.setEmpty();
398 }
399 }
400
401 SkASSERT(devBound.contains(clipRegion.getBounds()));
402 }
403 #endif
404
405 ///////////////////////////////////////////////////////////////////////////////
406
407 // call this every draw call, to ensure that the context reflects our state, 375 // call this every draw call, to ensure that the context reflects our state,
408 // and not the state from some other canvas/device 376 // and not the state from some other canvas/device
409 void SkGpuDevice::prepareDraw(const SkDraw& draw, bool forceIdentity) { 377 void SkGpuDevice::prepareDraw(const SkDraw& draw, bool forceIdentity) {
410 SkASSERT(NULL != fClipData.fClipStack); 378 SkASSERT(NULL != fClipData.fClipStack);
411 379
412 fContext->setRenderTarget(fRenderTarget); 380 fContext->setRenderTarget(fRenderTarget);
413 381
414 SkASSERT(draw.fClipStack && draw.fClipStack == fClipData.fClipStack); 382 SkASSERT(draw.fClipStack && draw.fClipStack == fClipData.fClipStack);
415 383
416 if (forceIdentity) { 384 if (forceIdentity) {
417 fContext->setIdentityMatrix(); 385 fContext->setIdentityMatrix();
418 } else { 386 } else {
419 fContext->setMatrix(*draw.fMatrix); 387 fContext->setMatrix(*draw.fMatrix);
420 } 388 }
421 fClipData.fOrigin = this->getOrigin(); 389 fClipData.fOrigin = this->getOrigin();
422 390
423 #ifdef SK_DEBUG
424 check_bounds(fClipData, *draw.fClip, fRenderTarget->width(), fRenderTarget-> height());
425 #endif
426
427 fContext->setClip(&fClipData); 391 fContext->setClip(&fClipData);
428 392
429 DO_DEFERRED_CLEAR(); 393 DO_DEFERRED_CLEAR();
430 } 394 }
431 395
432 GrRenderTarget* SkGpuDevice::accessRenderTarget() { 396 GrRenderTarget* SkGpuDevice::accessRenderTarget() {
433 DO_DEFERRED_CLEAR(); 397 DO_DEFERRED_CLEAR();
434 return fRenderTarget; 398 return fRenderTarget;
435 } 399 }
436 400
(...skipping 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after
1878 GrTexture* texture, 1842 GrTexture* texture,
1879 bool needClear) 1843 bool needClear)
1880 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { 1844 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) {
1881 1845
1882 SkASSERT(texture && texture->asRenderTarget()); 1846 SkASSERT(texture && texture->asRenderTarget());
1883 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture 1847 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture
1884 // cache. We pass true for the third argument so that it will get unlocked. 1848 // cache. We pass true for the third argument so that it will get unlocked.
1885 this->initFromRenderTarget(context, texture->asRenderTarget(), true); 1849 this->initFromRenderTarget(context, texture->asRenderTarget(), true);
1886 fNeedClear = needClear; 1850 fNeedClear = needClear;
1887 } 1851 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698