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 "GrContextPriv.h" | 9 #include "GrContextPriv.h" |
10 #include "GrContextOptions.h" | 10 #include "GrContextOptions.h" |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 // conversion from a passed-in color space? For now, specifying null
ptr means that this | 349 // conversion from a passed-in color space? For now, specifying null
ptr means that this |
350 // path will do no conversion, so it will match the behavior of the
non-draw path. | 350 // path will do no conversion, so it will match the behavior of the
non-draw path. |
351 sk_sp<GrDrawContext> drawContext(this->contextPriv().makeWrappedDraw
Context( | 351 sk_sp<GrDrawContext> drawContext(this->contextPriv().makeWrappedDraw
Context( |
352 sk_ref_s
p(renderTarget), | 352 sk_ref_s
p(renderTarget), |
353 nullptr)
); | 353 nullptr)
); |
354 if (!drawContext) { | 354 if (!drawContext) { |
355 return false; | 355 return false; |
356 } | 356 } |
357 GrPaint paint; | 357 GrPaint paint; |
358 paint.addColorFragmentProcessor(std::move(fp)); | 358 paint.addColorFragmentProcessor(std::move(fp)); |
359 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 359 paint.setPorterDuffXPFactory(SkBlendMode::kSrc); |
360 paint.setAllowSRGBInputs(true); | 360 paint.setAllowSRGBInputs(true); |
361 SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(hei
ght)); | 361 SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(hei
ght)); |
362 drawContext->drawRect(GrNoClip(), paint, matrix, rect, nullptr); | 362 drawContext->drawRect(GrNoClip(), paint, matrix, rect, nullptr); |
363 | 363 |
364 if (kFlushWrites_PixelOp & pixelOpsFlags) { | 364 if (kFlushWrites_PixelOp & pixelOpsFlags) { |
365 this->flushSurfaceWrites(surface); | 365 this->flushSurfaceWrites(surface); |
366 } | 366 } |
367 } | 367 } |
368 } | 368 } |
369 if (!tempTexture) { | 369 if (!tempTexture) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 } | 464 } |
465 } | 465 } |
466 if (!fp && tempDC) { | 466 if (!fp && tempDC) { |
467 fp = GrConfigConversionEffect::Make(src->asTexture(), tempDrawIn
fo.fSwizzle, | 467 fp = GrConfigConversionEffect::Make(src->asTexture(), tempDrawIn
fo.fSwizzle, |
468 GrConfigConversionEffect::kN
one_PMConversion, | 468 GrConfigConversionEffect::kN
one_PMConversion, |
469 textureMatrix); | 469 textureMatrix); |
470 } | 470 } |
471 if (fp) { | 471 if (fp) { |
472 GrPaint paint; | 472 GrPaint paint; |
473 paint.addColorFragmentProcessor(std::move(fp)); | 473 paint.addColorFragmentProcessor(std::move(fp)); |
474 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 474 paint.setPorterDuffXPFactory(SkBlendMode::kSrc); |
475 paint.setAllowSRGBInputs(true); | 475 paint.setAllowSRGBInputs(true); |
476 SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar
(height)); | 476 SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar
(height)); |
477 tempDC->drawRect(GrNoClip(), paint, SkMatrix::I(), rect, nullptr
); | 477 tempDC->drawRect(GrNoClip(), paint, SkMatrix::I(), rect, nullptr
); |
478 surfaceToRead.reset(tempDC->asTexture().release()); | 478 surfaceToRead.reset(tempDC->asTexture().release()); |
479 left = 0; | 479 left = 0; |
480 top = 0; | 480 top = 0; |
481 didTempDraw = true; | 481 didTempDraw = true; |
482 } | 482 } |
483 } | 483 } |
484 } | 484 } |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 ASSERT_SINGLE_OWNER | 834 ASSERT_SINGLE_OWNER |
835 fResourceCache->setLimits(maxTextures, maxTextureBytes); | 835 fResourceCache->setLimits(maxTextures, maxTextureBytes); |
836 } | 836 } |
837 | 837 |
838 ////////////////////////////////////////////////////////////////////////////// | 838 ////////////////////////////////////////////////////////////////////////////// |
839 | 839 |
840 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { | 840 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { |
841 ASSERT_SINGLE_OWNER | 841 ASSERT_SINGLE_OWNER |
842 fResourceCache->dumpMemoryStatistics(traceMemoryDump); | 842 fResourceCache->dumpMemoryStatistics(traceMemoryDump); |
843 } | 843 } |
OLD | NEW |