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

Side by Side Diff: src/gpu/GrContext.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 | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrDrawContext.cpp » ('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 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 "GrContext.h" 8 #include "GrContext.h"
9 #include "GrContextOptions.h" 9 #include "GrContextOptions.h"
10 #include "GrDrawingManager.h" 10 #include "GrDrawingManager.h"
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(renderT arget))); 366 sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(renderT arget)));
367 if (!drawContext) { 367 if (!drawContext) {
368 return false; 368 return false;
369 } 369 }
370 // SRGBTODO: AllowSRGBInputs? (We could force it on here, so we don' t need the 370 // SRGBTODO: AllowSRGBInputs? (We could force it on here, so we don' t need the
371 // per-texture override in config conversion effect?) 371 // per-texture override in config conversion effect?)
372 GrPaint paint; 372 GrPaint paint;
373 paint.addColorFragmentProcessor(fp); 373 paint.addColorFragmentProcessor(fp);
374 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); 374 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
375 SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(hei ght)); 375 SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(hei ght));
376 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, rect, nullp tr); 376 drawContext->drawRect(GrNoClip(), paint, matrix, rect, nullptr);
377 377
378 if (kFlushWrites_PixelOp & pixelOpsFlags) { 378 if (kFlushWrites_PixelOp & pixelOpsFlags) {
379 this->flushSurfaceWrites(surface); 379 this->flushSurfaceWrites(surface);
380 } 380 }
381 } 381 }
382 } 382 }
383 if (!tempTexture) { 383 if (!tempTexture) {
384 if (applyPremulToSrc) { 384 if (applyPremulToSrc) {
385 size_t tmpRowBytes = 4 * width; 385 size_t tmpRowBytes = 4 * width;
386 tmpPixels.reset(width * height); 386 tmpPixels.reset(width * height);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 } 480 }
481 if (fp) { 481 if (fp) {
482 // SRGBTODO: AllowSRGBInputs? (We could force it on here, so we don't need the 482 // SRGBTODO: AllowSRGBInputs? (We could force it on here, so we don't need the
483 // per-texture override in config conversion effect?) 483 // per-texture override in config conversion effect?)
484 GrPaint paint; 484 GrPaint paint;
485 paint.addColorFragmentProcessor(fp); 485 paint.addColorFragmentProcessor(fp);
486 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); 486 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
487 SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar (height)); 487 SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar (height));
488 sk_sp<GrDrawContext> drawContext( 488 sk_sp<GrDrawContext> drawContext(
489 this->drawContext(sk_ref_sp(temp->as RenderTarget()))); 489 this->drawContext(sk_ref_sp(temp->as RenderTarget())));
490 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), rect, nullptr); 490 drawContext->drawRect(GrNoClip(), paint, SkMatrix::I(), rect, nu llptr);
491 surfaceToRead.reset(SkRef(temp.get())); 491 surfaceToRead.reset(SkRef(temp.get()));
492 left = 0; 492 left = 0;
493 top = 0; 493 top = 0;
494 didTempDraw = true; 494 didTempDraw = true;
495 } 495 }
496 } 496 }
497 } 497 }
498 498
499 if (GrGpu::kRequireDraw_DrawPreference == drawPreference && !didTempDraw) { 499 if (GrGpu::kRequireDraw_DrawPreference == drawPreference && !didTempDraw) {
500 return false; 500 return false;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 GrPaint paint; 552 GrPaint paint;
553 paint.addColorTextureProcessor(src, GrCoordTransform::MakeDivByTextureWHMatr ix(src)); 553 paint.addColorTextureProcessor(src, GrCoordTransform::MakeDivByTextureWHMatr ix(src));
554 if (!SkScalarNearlyEqual(gamma, 1.0f)) { 554 if (!SkScalarNearlyEqual(gamma, 1.0f)) {
555 paint.addColorFragmentProcessor(GrGammaEffect::Create(gamma))->unref(); 555 paint.addColorFragmentProcessor(GrGammaEffect::Create(gamma))->unref();
556 } 556 }
557 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); 557 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
558 paint.setGammaCorrect(true); 558 paint.setGammaCorrect(true);
559 559
560 SkRect rect; 560 SkRect rect;
561 src->getBoundsRect(&rect); 561 src->getBoundsRect(&rect);
562 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), rect); 562 drawContext->drawRect(GrNoClip(), paint, SkMatrix::I(), rect);
563 563
564 this->flushSurfaceWrites(dst); 564 this->flushSurfaceWrites(dst);
565 return true; 565 return true;
566 } 566 }
567 567
568 void GrContext::prepareSurfaceForExternalIO(GrSurface* surface) { 568 void GrContext::prepareSurfaceForExternalIO(GrSurface* surface) {
569 ASSERT_SINGLE_OWNER 569 ASSERT_SINGLE_OWNER
570 RETURN_IF_ABANDONED 570 RETURN_IF_ABANDONED
571 SkASSERT(surface); 571 SkASSERT(surface);
572 ASSERT_OWNED_RESOURCE(surface); 572 ASSERT_OWNED_RESOURCE(surface);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 ASSERT_SINGLE_OWNER 764 ASSERT_SINGLE_OWNER
765 fResourceCache->setLimits(maxTextures, maxTextureBytes); 765 fResourceCache->setLimits(maxTextures, maxTextureBytes);
766 } 766 }
767 767
768 ////////////////////////////////////////////////////////////////////////////// 768 //////////////////////////////////////////////////////////////////////////////
769 769
770 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { 770 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const {
771 ASSERT_SINGLE_OWNER 771 ASSERT_SINGLE_OWNER
772 fResourceCache->dumpMemoryStatistics(traceMemoryDump); 772 fResourceCache->dumpMemoryStatistics(traceMemoryDump);
773 } 773 }
OLDNEW
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrDrawContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698