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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 tempDrawInfo.fWriteConfig, buffer, | 359 tempDrawInfo.fWriteConfig, buffer, |
360 rowBytes)) { | 360 rowBytes)) { |
361 return false; | 361 return false; |
362 } | 362 } |
363 SkMatrix matrix; | 363 SkMatrix matrix; |
364 matrix.setTranslate(SkIntToScalar(left), SkIntToScalar(top)); | 364 matrix.setTranslate(SkIntToScalar(left), SkIntToScalar(top)); |
365 SkAutoTUnref<GrDrawContext> drawContext(this->drawContext(renderTarg
et)); | 365 SkAutoTUnref<GrDrawContext> drawContext(this->drawContext(renderTarg
et)); |
366 if (!drawContext) { | 366 if (!drawContext) { |
367 return false; | 367 return false; |
368 } | 368 } |
| 369 // SRGBTODO: AllowSRGBInputs? (We could force it on here, so we don'
t need the |
| 370 // per-texture override in config conversion effect?) |
369 GrPaint paint; | 371 GrPaint paint; |
370 paint.addColorFragmentProcessor(fp); | 372 paint.addColorFragmentProcessor(fp); |
371 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 373 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
372 SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(hei
ght)); | 374 SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(hei
ght)); |
373 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, rect, nullp
tr); | 375 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, rect, nullp
tr); |
374 | 376 |
375 if (kFlushWrites_PixelOp & pixelOpsFlags) { | 377 if (kFlushWrites_PixelOp & pixelOpsFlags) { |
376 this->flushSurfaceWrites(surface); | 378 this->flushSurfaceWrites(surface); |
377 } | 379 } |
378 } | 380 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 // 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 |
470 // bother. | 472 // bother. |
471 temp.reset(nullptr); | 473 temp.reset(nullptr); |
472 } | 474 } |
473 } | 475 } |
474 if (!fp && temp) { | 476 if (!fp && temp) { |
475 fp.reset(GrConfigConversionEffect::Create(src->asTexture(), temp
DrawInfo.fSwizzle, | 477 fp.reset(GrConfigConversionEffect::Create(src->asTexture(), temp
DrawInfo.fSwizzle, |
476 GrConfigConversionEffect::kNone_PMConversion, textureMatrix)
); | 478 GrConfigConversionEffect::kNone_PMConversion, textureMatrix)
); |
477 } | 479 } |
478 if (fp) { | 480 if (fp) { |
| 481 // SRGBTODO: AllowSRGBInputs? (We could force it on here, so we
don't need the |
| 482 // per-texture override in config conversion effect?) |
479 GrPaint paint; | 483 GrPaint paint; |
480 paint.addColorFragmentProcessor(fp); | 484 paint.addColorFragmentProcessor(fp); |
481 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 485 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
482 SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar
(height)); | 486 SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar
(height)); |
483 SkAutoTUnref<GrDrawContext> drawContext(this->drawContext(temp->
asRenderTarget())); | 487 SkAutoTUnref<GrDrawContext> drawContext(this->drawContext(temp->
asRenderTarget())); |
484 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(),
rect, nullptr); | 488 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(),
rect, nullptr); |
485 surfaceToRead.reset(SkRef(temp.get())); | 489 surfaceToRead.reset(SkRef(temp.get())); |
486 left = 0; | 490 left = 0; |
487 top = 0; | 491 top = 0; |
488 didTempDraw = true; | 492 didTempDraw = true; |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 ASSERT_SINGLE_OWNER | 693 ASSERT_SINGLE_OWNER |
690 fResourceCache->setLimits(maxTextures, maxTextureBytes); | 694 fResourceCache->setLimits(maxTextures, maxTextureBytes); |
691 } | 695 } |
692 | 696 |
693 ////////////////////////////////////////////////////////////////////////////// | 697 ////////////////////////////////////////////////////////////////////////////// |
694 | 698 |
695 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { | 699 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { |
696 ASSERT_SINGLE_OWNER | 700 ASSERT_SINGLE_OWNER |
697 fResourceCache->dumpMemoryStatistics(traceMemoryDump); | 701 fResourceCache->dumpMemoryStatistics(traceMemoryDump); |
698 } | 702 } |
OLD | NEW |