OLD | NEW |
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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 tempDrawInfo.fWriteConfig, buffer, | 360 tempDrawInfo.fWriteConfig, buffer, |
361 rowBytes)) { | 361 rowBytes)) { |
362 return false; | 362 return false; |
363 } | 363 } |
364 SkMatrix matrix; | 364 SkMatrix matrix; |
365 matrix.setTranslate(SkIntToScalar(left), SkIntToScalar(top)); | 365 matrix.setTranslate(SkIntToScalar(left), SkIntToScalar(top)); |
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 | |
371 // per-texture override in config conversion effect?) | |
372 GrPaint paint; | 370 GrPaint paint; |
373 paint.addColorFragmentProcessor(fp); | 371 paint.addColorFragmentProcessor(fp); |
374 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 372 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
| 373 paint.setAllowSRGBInputs(true); |
375 SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(hei
ght)); | 374 SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(hei
ght)); |
376 drawContext->drawRect(GrNoClip(), paint, matrix, rect, nullptr); | 375 drawContext->drawRect(GrNoClip(), paint, matrix, rect, nullptr); |
377 | 376 |
378 if (kFlushWrites_PixelOp & pixelOpsFlags) { | 377 if (kFlushWrites_PixelOp & pixelOpsFlags) { |
379 this->flushSurfaceWrites(surface); | 378 this->flushSurfaceWrites(surface); |
380 } | 379 } |
381 } | 380 } |
382 } | 381 } |
383 if (!tempTexture) { | 382 if (!tempTexture) { |
384 if (applyPremulToSrc) { | 383 if (applyPremulToSrc) { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 // We only wanted to do the draw in order to perform the unp
remul so don't | 471 // We only wanted to do the draw in order to perform the unp
remul so don't |
473 // bother. | 472 // bother. |
474 temp.reset(nullptr); | 473 temp.reset(nullptr); |
475 } | 474 } |
476 } | 475 } |
477 if (!fp && temp) { | 476 if (!fp && temp) { |
478 fp.reset(GrConfigConversionEffect::Create(src->asTexture(), temp
DrawInfo.fSwizzle, | 477 fp.reset(GrConfigConversionEffect::Create(src->asTexture(), temp
DrawInfo.fSwizzle, |
479 GrConfigConversionEffect::kNone_PMConversion, textureMatrix)
); | 478 GrConfigConversionEffect::kNone_PMConversion, textureMatrix)
); |
480 } | 479 } |
481 if (fp) { | 480 if (fp) { |
482 // SRGBTODO: AllowSRGBInputs? (We could force it on here, so we
don't need the | |
483 // per-texture override in config conversion effect?) | |
484 GrPaint paint; | 481 GrPaint paint; |
485 paint.addColorFragmentProcessor(fp); | 482 paint.addColorFragmentProcessor(fp); |
486 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 483 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
| 484 paint.setAllowSRGBInputs(true); |
487 SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar
(height)); | 485 SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar
(height)); |
488 sk_sp<GrDrawContext> drawContext( | 486 sk_sp<GrDrawContext> drawContext( |
489 this->drawContext(sk_ref_sp(temp->as
RenderTarget()))); | 487 this->drawContext(sk_ref_sp(temp->as
RenderTarget()))); |
490 drawContext->drawRect(GrNoClip(), paint, SkMatrix::I(), rect, nu
llptr); | 488 drawContext->drawRect(GrNoClip(), paint, SkMatrix::I(), rect, nu
llptr); |
491 surfaceToRead.reset(SkRef(temp.get())); | 489 surfaceToRead.reset(SkRef(temp.get())); |
492 left = 0; | 490 left = 0; |
493 top = 0; | 491 top = 0; |
494 didTempDraw = true; | 492 didTempDraw = true; |
495 } | 493 } |
496 } | 494 } |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 ASSERT_SINGLE_OWNER | 763 ASSERT_SINGLE_OWNER |
766 fResourceCache->setLimits(maxTextures, maxTextureBytes); | 764 fResourceCache->setLimits(maxTextures, maxTextureBytes); |
767 } | 765 } |
768 | 766 |
769 ////////////////////////////////////////////////////////////////////////////// | 767 ////////////////////////////////////////////////////////////////////////////// |
770 | 768 |
771 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { | 769 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { |
772 ASSERT_SINGLE_OWNER | 770 ASSERT_SINGLE_OWNER |
773 fResourceCache->dumpMemoryStatistics(traceMemoryDump); | 771 fResourceCache->dumpMemoryStatistics(traceMemoryDump); |
774 } | 772 } |
OLD | NEW |