| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "GrContext.h" | 9 #include "GrContext.h" |
| 10 #include "GrContextOptions.h" | 10 #include "GrContextOptions.h" |
| 11 #include "GrDrawingManager.h" | 11 #include "GrDrawingManager.h" |
| 12 #include "GrDrawContext.h" | 12 #include "GrDrawContext.h" |
| 13 #include "GrLayerCache.h" | 13 #include "GrLayerCache.h" |
| 14 #include "GrResourceCache.h" | 14 #include "GrResourceCache.h" |
| 15 #include "GrResourceProvider.h" | 15 #include "GrResourceProvider.h" |
| 16 #include "GrSoftwarePathRenderer.h" | 16 #include "GrSoftwarePathRenderer.h" |
| 17 #include "GrSurfacePriv.h" | 17 #include "GrSurfacePriv.h" |
| 18 #include "GrTextBlobCache.h" | 18 #include "GrTextBlobCache.h" |
| 19 | 19 |
| 20 #include "SkConfig8888.h" | 20 #include "SkConfig8888.h" |
| 21 #include "SkGrPriv.h" | 21 #include "SkGrPriv.h" |
| 22 | 22 |
| 23 #include "effects/GrConfigConversionEffect.h" | 23 #include "effects/GrConfigConversionEffect.h" |
| 24 | 24 |
| 25 class GrDrawTarget; |
| 26 |
| 25 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this) | 27 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this) |
| 26 #define RETURN_IF_ABANDONED if (fDrawingManager->abandoned()) { return; } | 28 #define RETURN_IF_ABANDONED if (fDrawingManager->abandoned()) { return; } |
| 27 #define RETURN_FALSE_IF_ABANDONED if (fDrawingManager->abandoned()) { return fal
se; } | 29 #define RETURN_FALSE_IF_ABANDONED if (fDrawingManager->abandoned()) { return fal
se; } |
| 28 #define RETURN_NULL_IF_ABANDONED if (fDrawingManager->abandoned()) { return null
ptr; } | 30 #define RETURN_NULL_IF_ABANDONED if (fDrawingManager->abandoned()) { return null
ptr; } |
| 29 | 31 |
| 30 //////////////////////////////////////////////////////////////////////////////// | 32 //////////////////////////////////////////////////////////////////////////////// |
| 31 | 33 |
| 32 GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext)
{ | 34 GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext)
{ |
| 33 GrContextOptions defaultOptions; | 35 GrContextOptions defaultOptions; |
| 34 return Create(backend, backendContext, defaultOptions); | 36 return Create(backend, backendContext, defaultOptions); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 delete fResourceProvider; | 113 delete fResourceProvider; |
| 112 delete fResourceCache; | 114 delete fResourceCache; |
| 113 delete fBatchFontCache; | 115 delete fBatchFontCache; |
| 114 | 116 |
| 115 fGpu->unref(); | 117 fGpu->unref(); |
| 116 fCaps->unref(); | 118 fCaps->unref(); |
| 117 } | 119 } |
| 118 | 120 |
| 119 void GrContext::abandonContext() { | 121 void GrContext::abandonContext() { |
| 120 fResourceProvider->abandon(); | 122 fResourceProvider->abandon(); |
| 123 |
| 124 fDrawingManager->abandon(); |
| 121 // abandon first to so destructors | 125 // abandon first to so destructors |
| 122 // don't try to free the resources in the API. | 126 // don't try to free the resources in the API. |
| 123 fResourceCache->abandonAll(); | 127 fResourceCache->abandonAll(); |
| 124 | 128 |
| 125 fGpu->contextAbandoned(); | 129 fGpu->contextAbandoned(); |
| 126 | 130 |
| 127 fDrawingManager->abandon(); | |
| 128 | |
| 129 fBatchFontCache->freeAll(); | 131 fBatchFontCache->freeAll(); |
| 130 fLayerCache->freeAll(); | 132 fLayerCache->freeAll(); |
| 131 fTextBlobCache->freeAll(); | 133 fTextBlobCache->freeAll(); |
| 132 } | 134 } |
| 133 | 135 |
| 134 void GrContext::resetContext(uint32_t state) { | 136 void GrContext::resetContext(uint32_t state) { |
| 135 fGpu->markContextDirty(state); | 137 fGpu->markContextDirty(state); |
| 136 } | 138 } |
| 137 | 139 |
| 138 void GrContext::freeGpuResources() { | 140 void GrContext::freeGpuResources() { |
| 139 this->flush(); | 141 this->flush(); |
| 140 | 142 |
| 143 //fDrawingMgr.purgeResources1(); |
| 144 |
| 141 fBatchFontCache->freeAll(); | 145 fBatchFontCache->freeAll(); |
| 142 fLayerCache->freeAll(); | 146 fLayerCache->freeAll(); |
| 143 | 147 |
| 144 fDrawingManager->freeGpuResources(); | 148 fDrawingManager->freeGpuResources(); |
| 145 | 149 |
| 146 fResourceCache->purgeAllUnlocked(); | 150 fResourceCache->purgeAllUnlocked(); |
| 147 } | 151 } |
| 148 | 152 |
| 149 void GrContext::getResourceCacheUsage(int* resourceCount, size_t* resourceBytes)
const { | 153 void GrContext::getResourceCacheUsage(int* resourceCount, size_t* resourceBytes)
const { |
| 150 if (resourceCount) { | 154 if (resourceCount) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 207 |
| 204 SkDstPixelInfo dstPI; | 208 SkDstPixelInfo dstPI; |
| 205 dstPI.fColorType = srcPI.fColorType; | 209 dstPI.fColorType = srcPI.fColorType; |
| 206 dstPI.fAlphaType = kPremul_SkAlphaType; | 210 dstPI.fAlphaType = kPremul_SkAlphaType; |
| 207 dstPI.fPixels = outPixels; | 211 dstPI.fPixels = outPixels; |
| 208 dstPI.fRowBytes = outRowBytes; | 212 dstPI.fRowBytes = outRowBytes; |
| 209 | 213 |
| 210 return srcPI.convertPixelsTo(&dstPI, width, height); | 214 return srcPI.convertPixelsTo(&dstPI, width, height); |
| 211 } | 215 } |
| 212 | 216 |
| 213 bool GrContext::writeSurfacePixels(GrSurface* surface, | 217 bool GrContext::writeSurfacePixels(GrDrawContext* surfaceDC, GrSurface* surface, |
| 214 int left, int top, int width, int height, | 218 int left, int top, int width, int height, |
| 215 GrPixelConfig srcConfig, const void* buffer,
size_t rowBytes, | 219 GrPixelConfig srcConfig, const void* buffer,
size_t rowBytes, |
| 216 uint32_t pixelOpsFlags) { | 220 uint32_t pixelOpsFlags) { |
| 217 RETURN_FALSE_IF_ABANDONED | 221 RETURN_FALSE_IF_ABANDONED |
| 218 ASSERT_OWNED_RESOURCE(surface); | 222 ASSERT_OWNED_RESOURCE(surface); |
| 219 SkASSERT(surface); | 223 SkASSERT(surface); |
| 220 | 224 |
| 221 this->testPMConversionsIfNecessary(pixelOpsFlags); | 225 this->testPMConversionsIfNecessary(pixelOpsFlags); |
| 222 | 226 |
| 223 // Trim the params here so that if we wind up making a temporary surface it
can be as small as | 227 // Trim the params here so that if we wind up making a temporary surface it
can be as small as |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 SkAutoSTMalloc<48 * 48, uint32_t> tmpPixels(0); | 272 SkAutoSTMalloc<48 * 48, uint32_t> tmpPixels(0); |
| 269 #else | 273 #else |
| 270 SkAutoSTMalloc<128 * 128, uint32_t> tmpPixels(0); | 274 SkAutoSTMalloc<128 * 128, uint32_t> tmpPixels(0); |
| 271 #endif | 275 #endif |
| 272 if (tempTexture) { | 276 if (tempTexture) { |
| 273 SkAutoTUnref<const GrFragmentProcessor> fp; | 277 SkAutoTUnref<const GrFragmentProcessor> fp; |
| 274 SkMatrix textureMatrix; | 278 SkMatrix textureMatrix; |
| 275 textureMatrix.setIDiv(tempTexture->width(), tempTexture->height()); | 279 textureMatrix.setIDiv(tempTexture->width(), tempTexture->height()); |
| 276 GrPaint paint; | 280 GrPaint paint; |
| 277 if (applyPremulToSrc) { | 281 if (applyPremulToSrc) { |
| 278 fp.reset(this->createUPMToPMEffect(tempTexture, tempDrawInfo.fSwapRA
ndB, | 282 fp.reset(this->createUPMToPMEffect(tempTexture, |
| 279 textureMatrix)); | 283 tempDrawInfo.fSwapRAndB, textureM
atrix, surface->asRenderTarget())); |
| 280 // If premultiplying was the only reason for the draw, fall back to
a straight write. | 284 // If premultiplying was the only reason for the draw, fall back to
a straight write. |
| 281 if (!fp) { | 285 if (!fp) { |
| 282 if (GrGpu::kCallerPrefersDraw_DrawPreference == drawPreference)
{ | 286 if (GrGpu::kCallerPrefersDraw_DrawPreference == drawPreference)
{ |
| 283 tempTexture.reset(nullptr); | 287 tempTexture.reset(nullptr); |
| 284 } | 288 } |
| 285 } else { | 289 } else { |
| 286 applyPremulToSrc = false; | 290 applyPremulToSrc = false; |
| 287 } | 291 } |
| 288 } | 292 } |
| 289 if (tempTexture) { | 293 if (tempTexture) { |
| 294 GrRenderTarget* renderTarget = surface->asRenderTarget(); |
| 295 SkASSERT(renderTarget); |
| 290 if (!fp) { | 296 if (!fp) { |
| 291 fp.reset(GrConfigConversionEffect::Create(tempTexture, tempDrawI
nfo.fSwapRAndB, | 297 fp.reset(GrConfigConversionEffect::Create( |
| 292 GrConfigConversionEffect::kNone_PMConversion, textureMatrix)
); | 298 tempTexture, tempDrawInfo.fSwapRAndB, |
| 299 GrConfigConversionEffect::kNone_PMConversion, textureMatrix,
renderTarget)); |
| 293 if (!fp) { | 300 if (!fp) { |
| 294 return false; | 301 return false; |
| 295 } | 302 } |
| 296 } | 303 } |
| 297 GrRenderTarget* renderTarget = surface->asRenderTarget(); | |
| 298 SkASSERT(renderTarget); | |
| 299 if (tempTexture->surfacePriv().hasPendingIO()) { | 304 if (tempTexture->surfacePriv().hasPendingIO()) { |
| 300 this->flush(); | 305 this->flush(); |
| 301 } | 306 } |
| 302 if (applyPremulToSrc) { | 307 if (applyPremulToSrc) { |
| 303 size_t tmpRowBytes = 4 * width; | 308 size_t tmpRowBytes = 4 * width; |
| 304 tmpPixels.reset(width * height); | 309 tmpPixels.reset(width * height); |
| 305 if (!sw_convert_to_premul(srcConfig, width, height, rowBytes, bu
ffer, tmpRowBytes, | 310 if (!sw_convert_to_premul(srcConfig, width, height, rowBytes, bu
ffer, tmpRowBytes, |
| 306 tmpPixels.get())) { | 311 tmpPixels.get())) { |
| 307 return false; | 312 return false; |
| 308 } | 313 } |
| 309 rowBytes = tmpRowBytes; | 314 rowBytes = tmpRowBytes; |
| 310 buffer = tmpPixels.get(); | 315 buffer = tmpPixels.get(); |
| 311 applyPremulToSrc = false; | 316 applyPremulToSrc = false; |
| 312 } | 317 } |
| 313 if (!fGpu->writePixels(tempTexture, 0, 0, width, height, | 318 if (!fGpu->writePixels(tempTexture, 0, 0, width, height, |
| 314 tempDrawInfo.fTempSurfaceDesc.fConfig, buffer
, | 319 tempDrawInfo.fTempSurfaceDesc.fConfig, buffer
, |
| 315 rowBytes)) { | 320 rowBytes)) { |
| 316 return false; | 321 return false; |
| 317 } | 322 } |
| 323 if (buffer) { |
| 324 tempTexture->setFromRawPixels(true); |
| 325 tempTexture->setException(true); |
| 326 } |
| 318 SkMatrix matrix; | 327 SkMatrix matrix; |
| 319 matrix.setTranslate(SkIntToScalar(left), SkIntToScalar(top)); | 328 matrix.setTranslate(SkIntToScalar(left), SkIntToScalar(top)); |
| 329 |
| 320 SkAutoTUnref<GrDrawContext> drawContext(this->drawContext(renderTarg
et)); | 330 SkAutoTUnref<GrDrawContext> drawContext(this->drawContext(renderTarg
et)); |
| 321 if (!drawContext) { | 331 if (!drawContext) { |
| 322 return false; | 332 return false; |
| 323 } | 333 } |
| 324 paint.addColorFragmentProcessor(fp); | 334 paint.addColorFragmentProcessor(fp); |
| 325 SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(hei
ght)); | 335 SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(hei
ght)); |
| 326 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, rect, nullp
tr); | 336 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, rect, nullp
tr); |
| 327 | 337 |
| 328 if (kFlushWrites_PixelOp & pixelOpsFlags) { | 338 if (kFlushWrites_PixelOp & pixelOpsFlags) { |
| 329 this->flushSurfaceWrites(surface); | 339 this->flushSurfaceWrites(surface); |
| 330 } | 340 } |
| 331 } | 341 } |
| 332 } | 342 } |
| 333 if (!tempTexture) { | 343 if (!tempTexture) { |
| 334 if (applyPremulToSrc) { | 344 if (applyPremulToSrc) { |
| 335 size_t tmpRowBytes = 4 * width; | 345 size_t tmpRowBytes = 4 * width; |
| 336 tmpPixels.reset(width * height); | 346 tmpPixels.reset(width * height); |
| 337 if (!sw_convert_to_premul(srcConfig, width, height, rowBytes, buffer
, tmpRowBytes, | 347 if (!sw_convert_to_premul(srcConfig, width, height, rowBytes, buffer
, tmpRowBytes, |
| 338 tmpPixels.get())) { | 348 tmpPixels.get())) { |
| 339 return false; | 349 return false; |
| 340 } | 350 } |
| 341 rowBytes = tmpRowBytes; | 351 rowBytes = tmpRowBytes; |
| 342 buffer = tmpPixels.get(); | 352 buffer = tmpPixels.get(); |
| 343 applyPremulToSrc = false; | 353 applyPremulToSrc = false; |
| 344 } | 354 } |
| 345 return fGpu->writePixels(surface, left, top, width, height, srcConfig, b
uffer, rowBytes); | 355 return fGpu->writePixels(surface, left, top, width, height, srcConfig, b
uffer, rowBytes); |
| 346 } | 356 } |
| 357 |
| 347 return true; | 358 return true; |
| 348 } | 359 } |
| 349 | 360 |
| 350 bool GrContext::readSurfacePixels(GrSurface* src, | 361 bool GrContext::readSurfacePixels(GrSurface* src, |
| 351 int left, int top, int width, int height, | 362 int left, int top, int width, int height, |
| 352 GrPixelConfig dstConfig, void* buffer, size_t
rowBytes, | 363 GrPixelConfig dstConfig, void* buffer, size_t
rowBytes, |
| 353 uint32_t flags) { | 364 uint32_t flags) { |
| 354 RETURN_FALSE_IF_ABANDONED | 365 RETURN_FALSE_IF_ABANDONED |
| 355 ASSERT_OWNED_RESOURCE(src); | 366 ASSERT_OWNED_RESOURCE(src); |
| 356 SkASSERT(src); | 367 SkASSERT(src); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 } else { | 416 } else { |
| 406 temp.reset(this->textureProvider()->createApproxTexture(tempDrawInfo
.fTempSurfaceDesc)); | 417 temp.reset(this->textureProvider()->createApproxTexture(tempDrawInfo
.fTempSurfaceDesc)); |
| 407 } | 418 } |
| 408 if (temp) { | 419 if (temp) { |
| 409 SkMatrix textureMatrix; | 420 SkMatrix textureMatrix; |
| 410 textureMatrix.setTranslate(SkIntToScalar(left), SkIntToScalar(top)); | 421 textureMatrix.setTranslate(SkIntToScalar(left), SkIntToScalar(top)); |
| 411 textureMatrix.postIDiv(src->width(), src->height()); | 422 textureMatrix.postIDiv(src->width(), src->height()); |
| 412 GrPaint paint; | 423 GrPaint paint; |
| 413 SkAutoTUnref<const GrFragmentProcessor> fp; | 424 SkAutoTUnref<const GrFragmentProcessor> fp; |
| 414 if (unpremul) { | 425 if (unpremul) { |
| 415 fp.reset(this->createPMToUPMEffect(src->asTexture(), tempDrawInf
o.fSwapRAndB, | 426 fp.reset(this->createPMToUPMEffect( |
| 416 textureMatrix)); | 427 src->asTexture(), tempDrawInfo.fSwapRAndB, |
| 428 textureMatrix, temp->asRenderTarget())); |
| 417 if (fp) { | 429 if (fp) { |
| 418 unpremul = false; // we no longer need to do this on CPU aft
er the read back. | 430 unpremul = false; // we no longer need to do this on CPU aft
er the read back. |
| 419 } else if (GrGpu::kCallerPrefersDraw_DrawPreference == drawPrefe
rence) { | 431 } else if (GrGpu::kCallerPrefersDraw_DrawPreference == drawPrefe
rence) { |
| 420 // We only wanted to do the draw in order to perform the unp
remul so don't | 432 // We only wanted to do the draw in order to perform the unp
remul so don't |
| 421 // bother. | 433 // bother. |
| 422 temp.reset(nullptr); | 434 temp.reset(nullptr); |
| 423 } | 435 } |
| 424 } | 436 } |
| 425 if (!fp && temp) { | 437 if (!fp && temp) { |
| 426 fp.reset(GrConfigConversionEffect::Create(src->asTexture(), temp
DrawInfo.fSwapRAndB, | 438 fp.reset(GrConfigConversionEffect::Create( |
| 427 GrConfigConversionEffect::kNone_PMConversion, textureMatrix)
); | 439 src->asTexture(), tempDrawInfo.fSwapRAndB, |
| 440 GrConfigConversionEffect::kNone_PMConversion, textureMatrix,
temp->asRenderTarget())); |
| 428 } | 441 } |
| 429 if (fp) { | 442 if (fp) { |
| 430 paint.addColorFragmentProcessor(fp); | 443 paint.addColorFragmentProcessor(fp); |
| 431 SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar
(height)); | 444 SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar
(height)); |
| 432 SkAutoTUnref<GrDrawContext> drawContext(this->drawContext(temp->
asRenderTarget())); | 445 SkAutoTUnref<GrDrawContext> drawContext(this->drawContext(temp->
asRenderTarget())); |
| 433 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(),
rect, nullptr); | 446 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(),
rect, nullptr); |
| 434 surfaceToRead.reset(SkRef(temp.get())); | 447 surfaceToRead.reset(SkRef(temp.get())); |
| 435 left = 0; | 448 left = 0; |
| 436 top = 0; | 449 top = 0; |
| 437 didTempDraw = true; | 450 didTempDraw = true; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 SkAutoMutexAcquire ama(fTestPMConversionsMutex); | 578 SkAutoMutexAcquire ama(fTestPMConversionsMutex); |
| 566 if (!fDidTestPMConversions) { | 579 if (!fDidTestPMConversions) { |
| 567 test_pm_conversions(this, &fPMToUPMConversion, &fUPMToPMConversion); | 580 test_pm_conversions(this, &fPMToUPMConversion, &fUPMToPMConversion); |
| 568 fDidTestPMConversions = true; | 581 fDidTestPMConversions = true; |
| 569 } | 582 } |
| 570 } | 583 } |
| 571 } | 584 } |
| 572 | 585 |
| 573 const GrFragmentProcessor* GrContext::createPMToUPMEffect(GrTexture* texture, | 586 const GrFragmentProcessor* GrContext::createPMToUPMEffect(GrTexture* texture, |
| 574 bool swapRAndB, | 587 bool swapRAndB, |
| 575 const SkMatrix& matrix
) const { | 588 const SkMatrix& matrix
, |
| 589 GrRenderTarget* dst) c
onst { |
| 576 // We should have already called this->testPMConversionsIfNecessary(). | 590 // We should have already called this->testPMConversionsIfNecessary(). |
| 577 SkASSERT(fDidTestPMConversions); | 591 SkASSERT(fDidTestPMConversions); |
| 578 GrConfigConversionEffect::PMConversion pmToUPM = | 592 GrConfigConversionEffect::PMConversion pmToUPM = |
| 579 static_cast<GrConfigConversionEffect::PMConversion>(fPMToUPMConversion); | 593 static_cast<GrConfigConversionEffect::PMConversion>(fPMToUPMConversion); |
| 580 if (GrConfigConversionEffect::kNone_PMConversion != pmToUPM) { | 594 if (GrConfigConversionEffect::kNone_PMConversion != pmToUPM) { |
| 581 return GrConfigConversionEffect::Create(texture, swapRAndB, pmToUPM, mat
rix); | 595 return GrConfigConversionEffect::Create(texture, swapRAndB, pmToUPM, |
| 596 matrix, dst); |
| 582 } else { | 597 } else { |
| 583 return nullptr; | 598 return nullptr; |
| 584 } | 599 } |
| 585 } | 600 } |
| 586 | 601 |
| 587 const GrFragmentProcessor* GrContext::createUPMToPMEffect(GrTexture* texture, | 602 const GrFragmentProcessor* GrContext::createUPMToPMEffect(GrTexture* texture, |
| 588 bool swapRAndB, | 603 bool swapRAndB, |
| 589 const SkMatrix& matrix
) const { | 604 const SkMatrix& matrix
, GrRenderTarget* dst) const { |
| 590 // We should have already called this->testPMConversionsIfNecessary(). | 605 // We should have already called this->testPMConversionsIfNecessary(). |
| 591 SkASSERT(fDidTestPMConversions); | 606 SkASSERT(fDidTestPMConversions); |
| 592 GrConfigConversionEffect::PMConversion upmToPM = | 607 GrConfigConversionEffect::PMConversion upmToPM = |
| 593 static_cast<GrConfigConversionEffect::PMConversion>(fUPMToPMConversion); | 608 static_cast<GrConfigConversionEffect::PMConversion>(fUPMToPMConversion); |
| 594 if (GrConfigConversionEffect::kNone_PMConversion != upmToPM) { | 609 if (GrConfigConversionEffect::kNone_PMConversion != upmToPM) { |
| 595 return GrConfigConversionEffect::Create(texture, swapRAndB, upmToPM, mat
rix); | 610 return GrConfigConversionEffect::Create(texture, swapRAndB, upmToPM, |
| 611 matrix, dst); |
| 596 } else { | 612 } else { |
| 597 return nullptr; | 613 return nullptr; |
| 598 } | 614 } |
| 599 } | 615 } |
| 600 | 616 |
| 601 bool GrContext::didFailPMUPMConversionTest() const { | 617 bool GrContext::didFailPMUPMConversionTest() const { |
| 602 // We should have already called this->testPMConversionsIfNecessary(). | 618 // We should have already called this->testPMConversionsIfNecessary(). |
| 603 SkASSERT(fDidTestPMConversions); | 619 SkASSERT(fDidTestPMConversions); |
| 604 // The PM<->UPM tests fail or succeed together so we only need to check one. | 620 // The PM<->UPM tests fail or succeed together so we only need to check one. |
| 605 return GrConfigConversionEffect::kNone_PMConversion == fPMToUPMConversion; | 621 return GrConfigConversionEffect::kNone_PMConversion == fPMToUPMConversion; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 618 | 634 |
| 619 void GrContext::setResourceCacheLimits(int maxTextures, size_t maxTextureBytes)
{ | 635 void GrContext::setResourceCacheLimits(int maxTextures, size_t maxTextureBytes)
{ |
| 620 fResourceCache->setLimits(maxTextures, maxTextureBytes); | 636 fResourceCache->setLimits(maxTextures, maxTextureBytes); |
| 621 } | 637 } |
| 622 | 638 |
| 623 ////////////////////////////////////////////////////////////////////////////// | 639 ////////////////////////////////////////////////////////////////////////////// |
| 624 | 640 |
| 625 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { | 641 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { |
| 626 fResourceCache->dumpMemoryStatistics(traceMemoryDump); | 642 fResourceCache->dumpMemoryStatistics(traceMemoryDump); |
| 627 } | 643 } |
| OLD | NEW |