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 | 10 |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 return true; | 453 return true; |
454 } | 454 } |
455 | 455 |
456 bool GrContext::readSurfacePixels(GrSurface* src, | 456 bool GrContext::readSurfacePixels(GrSurface* src, |
457 int left, int top, int width, int height, | 457 int left, int top, int width, int height, |
458 GrPixelConfig dstConfig, void* buffer, size_t
rowBytes, | 458 GrPixelConfig dstConfig, void* buffer, size_t
rowBytes, |
459 uint32_t flags) { | 459 uint32_t flags) { |
460 RETURN_FALSE_IF_ABANDONED | 460 RETURN_FALSE_IF_ABANDONED |
461 ASSERT_OWNED_RESOURCE(src); | 461 ASSERT_OWNED_RESOURCE(src); |
462 SkASSERT(src); | 462 SkASSERT(src); |
463 SkAutoMutexAcquire ama(fReadPixelsMutex); | 463 |
464 // Adjust the params so that if we wind up using an intermediate surface we'
ve already done | 464 // Adjust the params so that if we wind up using an intermediate surface we'
ve already done |
465 // all the trimming and the temporary can be the min size required. | 465 // all the trimming and the temporary can be the min size required. |
466 if (!GrSurfacePriv::AdjustReadPixelParams(src->width(), src->height(), | 466 if (!GrSurfacePriv::AdjustReadPixelParams(src->width(), src->height(), |
467 GrBytesPerPixel(dstConfig), &left, | 467 GrBytesPerPixel(dstConfig), &left, |
468 &top, &width, &height, &buffer, &r
owBytes)) { | 468 &top, &width, &height, &buffer, &r
owBytes)) { |
469 return false; | 469 return false; |
470 } | 470 } |
471 | 471 |
472 if (!(kDontFlush_PixelOpsFlag & flags) && src->surfacePriv().hasPendingWrite
()) { | 472 if (!(kDontFlush_PixelOpsFlag & flags) && src->surfacePriv().hasPendingWrite
()) { |
473 this->flush(); | 473 this->flush(); |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 } | 744 } |
745 if (maxTextureBytes) { | 745 if (maxTextureBytes) { |
746 *maxTextureBytes = fResourceCache->getMaxResourceBytes(); | 746 *maxTextureBytes = fResourceCache->getMaxResourceBytes(); |
747 } | 747 } |
748 } | 748 } |
749 | 749 |
750 void GrContext::setResourceCacheLimits(int maxTextures, size_t maxTextureBytes)
{ | 750 void GrContext::setResourceCacheLimits(int maxTextures, size_t maxTextureBytes)
{ |
751 fResourceCache->setLimits(maxTextures, maxTextureBytes); | 751 fResourceCache->setLimits(maxTextures, maxTextureBytes); |
752 } | 752 } |
753 | 753 |
OLD | NEW |