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