| 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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 } | 543 } |
| 544 | 544 |
| 545 SkSurfaceProps props(SkSurfaceProps::kGammaCorrect_Flag, | 545 SkSurfaceProps props(SkSurfaceProps::kGammaCorrect_Flag, |
| 546 SkSurfaceProps::kLegacyFontHost_InitType); | 546 SkSurfaceProps::kLegacyFontHost_InitType); |
| 547 sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(dst), &props)); | 547 sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(dst), &props)); |
| 548 if (!drawContext) { | 548 if (!drawContext) { |
| 549 return false; | 549 return false; |
| 550 } | 550 } |
| 551 | 551 |
| 552 GrPaint paint; | 552 GrPaint paint; |
| 553 paint.addColorTextureProcessor(src, GrCoordTransform::MakeDivByTextureWHMatr
ix(src)); | 553 if (SkScalarNearlyEqual(gamma, 1.0f)) { |
| 554 if (!SkScalarNearlyEqual(gamma, 1.0f)) { | 554 paint.addColorTextureProcessor(src, GrCoordTransform::MakeDivByTextureWH
Matrix(src)); |
| 555 paint.addColorFragmentProcessor(GrGammaEffect::Create(gamma))->unref(); | 555 } else { |
| 556 SkAutoTUnref<const GrFragmentProcessor> fp; |
| 557 fp.reset(GrGammaEffect::Create(src, gamma)); |
| 558 paint.addColorFragmentProcessor(fp); |
| 556 } | 559 } |
| 557 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 560 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
| 558 paint.setGammaCorrect(true); | 561 paint.setGammaCorrect(true); |
| 559 | 562 |
| 560 SkRect rect; | 563 SkRect rect; |
| 561 src->getBoundsRect(&rect); | 564 src->getBoundsRect(&rect); |
| 562 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), rect); | 565 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), rect); |
| 563 | 566 |
| 564 this->flushSurfaceWrites(dst); | 567 this->flushSurfaceWrites(dst); |
| 565 return true; | 568 return true; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 ASSERT_SINGLE_OWNER | 767 ASSERT_SINGLE_OWNER |
| 765 fResourceCache->setLimits(maxTextures, maxTextureBytes); | 768 fResourceCache->setLimits(maxTextures, maxTextureBytes); |
| 766 } | 769 } |
| 767 | 770 |
| 768 ////////////////////////////////////////////////////////////////////////////// | 771 ////////////////////////////////////////////////////////////////////////////// |
| 769 | 772 |
| 770 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { | 773 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { |
| 771 ASSERT_SINGLE_OWNER | 774 ASSERT_SINGLE_OWNER |
| 772 fResourceCache->dumpMemoryStatistics(traceMemoryDump); | 775 fResourceCache->dumpMemoryStatistics(traceMemoryDump); |
| 773 } | 776 } |
| OLD | NEW |