| 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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 RETURN_FALSE_IF_ABANDONED | 532 RETURN_FALSE_IF_ABANDONED |
| 533 ASSERT_OWNED_RESOURCE(dst); | 533 ASSERT_OWNED_RESOURCE(dst); |
| 534 ASSERT_OWNED_RESOURCE(src); | 534 ASSERT_OWNED_RESOURCE(src); |
| 535 GR_AUDIT_TRAIL_AUTO_FRAME(&fAuditTrail, "GrContext::applyGamma"); | 535 GR_AUDIT_TRAIL_AUTO_FRAME(&fAuditTrail, "GrContext::applyGamma"); |
| 536 | 536 |
| 537 // Dimensions must match exactly. | 537 // Dimensions must match exactly. |
| 538 if (dst->width() != src->width() || dst->height() != src->height()) { | 538 if (dst->width() != src->width() || dst->height() != src->height()) { |
| 539 return false; | 539 return false; |
| 540 } | 540 } |
| 541 | 541 |
| 542 SkSurfaceProps props(SkSurfaceProps::kGammaCorrect_Flag, | |
| 543 SkSurfaceProps::kLegacyFontHost_InitType); | |
| 544 // TODO: Supply color space? | 542 // TODO: Supply color space? |
| 545 sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(dst), nullptr,
&props)); | 543 sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(dst), nullptr))
; |
| 546 if (!drawContext) { | 544 if (!drawContext) { |
| 547 return false; | 545 return false; |
| 548 } | 546 } |
| 549 | 547 |
| 550 GrPaint paint; | 548 GrPaint paint; |
| 551 paint.addColorTextureProcessor(src, nullptr, GrCoordTransform::MakeDivByText
ureWHMatrix(src)); | 549 paint.addColorTextureProcessor(src, nullptr, GrCoordTransform::MakeDivByText
ureWHMatrix(src)); |
| 552 if (!SkScalarNearlyEqual(gamma, 1.0f)) { | 550 if (!SkScalarNearlyEqual(gamma, 1.0f)) { |
| 553 paint.addColorFragmentProcessor(GrGammaEffect::Make(gamma)); | 551 paint.addColorFragmentProcessor(GrGammaEffect::Make(gamma)); |
| 554 } | 552 } |
| 555 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 553 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
| (...skipping 209 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 |