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" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 } | 233 } |
234 | 234 |
235 bool GrContext::writeSurfacePixels(GrSurface* surface, | 235 bool GrContext::writeSurfacePixels(GrSurface* surface, |
236 int left, int top, int width, int height, | 236 int left, int top, int width, int height, |
237 GrPixelConfig srcConfig, const void* buffer,
size_t rowBytes, | 237 GrPixelConfig srcConfig, const void* buffer,
size_t rowBytes, |
238 uint32_t pixelOpsFlags) { | 238 uint32_t pixelOpsFlags) { |
239 ASSERT_SINGLE_OWNER | 239 ASSERT_SINGLE_OWNER |
240 RETURN_FALSE_IF_ABANDONED | 240 RETURN_FALSE_IF_ABANDONED |
241 ASSERT_OWNED_RESOURCE(surface); | 241 ASSERT_OWNED_RESOURCE(surface); |
242 SkASSERT(surface); | 242 SkASSERT(surface); |
| 243 GR_AUDIT_TRAIL_AUTO_FRAME(&fAuditTrail, "GrContext::writeSurfacePixels"); |
243 | 244 |
244 this->testPMConversionsIfNecessary(pixelOpsFlags); | 245 this->testPMConversionsIfNecessary(pixelOpsFlags); |
245 | 246 |
246 // Trim the params here so that if we wind up making a temporary surface it
can be as small as | 247 // Trim the params here so that if we wind up making a temporary surface it
can be as small as |
247 // necessary and because GrGpu::getWritePixelsInfo requires it. | 248 // necessary and because GrGpu::getWritePixelsInfo requires it. |
248 if (!GrSurfacePriv::AdjustWritePixelParams(surface->width(), surface->height
(), | 249 if (!GrSurfacePriv::AdjustWritePixelParams(surface->width(), surface->height
(), |
249 GrBytesPerPixel(srcConfig), &left
, &top, &width, | 250 GrBytesPerPixel(srcConfig), &left
, &top, &width, |
250 &height, &buffer, &rowBytes)) { | 251 &height, &buffer, &rowBytes)) { |
251 return false; | 252 return false; |
252 } | 253 } |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 } | 373 } |
373 | 374 |
374 bool GrContext::readSurfacePixels(GrSurface* src, | 375 bool GrContext::readSurfacePixels(GrSurface* src, |
375 int left, int top, int width, int height, | 376 int left, int top, int width, int height, |
376 GrPixelConfig dstConfig, void* buffer, size_t
rowBytes, | 377 GrPixelConfig dstConfig, void* buffer, size_t
rowBytes, |
377 uint32_t flags) { | 378 uint32_t flags) { |
378 ASSERT_SINGLE_OWNER | 379 ASSERT_SINGLE_OWNER |
379 RETURN_FALSE_IF_ABANDONED | 380 RETURN_FALSE_IF_ABANDONED |
380 ASSERT_OWNED_RESOURCE(src); | 381 ASSERT_OWNED_RESOURCE(src); |
381 SkASSERT(src); | 382 SkASSERT(src); |
| 383 GR_AUDIT_TRAIL_AUTO_FRAME(&fAuditTrail, "GrContext::readSurfacePixels"); |
382 | 384 |
383 this->testPMConversionsIfNecessary(flags); | 385 this->testPMConversionsIfNecessary(flags); |
384 SkAutoMutexAcquire ama(fReadPixelsMutex); | 386 SkAutoMutexAcquire ama(fReadPixelsMutex); |
385 | 387 |
386 // Adjust the params so that if we wind up using an intermediate surface we'
ve already done | 388 // Adjust the params so that if we wind up using an intermediate surface we'
ve already done |
387 // all the trimming and the temporary can be the min size required. | 389 // all the trimming and the temporary can be the min size required. |
388 if (!GrSurfacePriv::AdjustReadPixelParams(src->width(), src->height(), | 390 if (!GrSurfacePriv::AdjustReadPixelParams(src->width(), src->height(), |
389 GrBytesPerPixel(dstConfig), &left, | 391 GrBytesPerPixel(dstConfig), &left, |
390 &top, &width, &height, &buffer, &r
owBytes)) { | 392 &top, &width, &height, &buffer, &r
owBytes)) { |
391 return false; | 393 return false; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 GrRenderTarget* rt = surface->asRenderTarget(); | 515 GrRenderTarget* rt = surface->asRenderTarget(); |
514 if (fGpu && rt) { | 516 if (fGpu && rt) { |
515 fGpu->resolveRenderTarget(rt); | 517 fGpu->resolveRenderTarget(rt); |
516 } | 518 } |
517 } | 519 } |
518 | 520 |
519 void GrContext::copySurface(GrSurface* dst, GrSurface* src, const SkIRect& srcRe
ct, | 521 void GrContext::copySurface(GrSurface* dst, GrSurface* src, const SkIRect& srcRe
ct, |
520 const SkIPoint& dstPoint, uint32_t pixelOpsFlags) { | 522 const SkIPoint& dstPoint, uint32_t pixelOpsFlags) { |
521 ASSERT_SINGLE_OWNER | 523 ASSERT_SINGLE_OWNER |
522 RETURN_IF_ABANDONED | 524 RETURN_IF_ABANDONED |
| 525 GR_AUDIT_TRAIL_AUTO_FRAME(&fAuditTrail, "GrContext::copySurface"); |
| 526 |
523 if (!src || !dst) { | 527 if (!src || !dst) { |
524 return; | 528 return; |
525 } | 529 } |
526 ASSERT_OWNED_RESOURCE(src); | 530 ASSERT_OWNED_RESOURCE(src); |
527 ASSERT_OWNED_RESOURCE(dst); | 531 ASSERT_OWNED_RESOURCE(dst); |
528 | 532 |
529 // Since we're going to the draw target and not GPU, no need to check kNoFlu
sh | 533 // Since we're going to the draw target and not GPU, no need to check kNoFlu
sh |
530 // here. | 534 // here. |
531 if (!dst->asRenderTarget()) { | 535 if (!dst->asRenderTarget()) { |
532 return; | 536 return; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 ASSERT_SINGLE_OWNER | 662 ASSERT_SINGLE_OWNER |
659 fResourceCache->setLimits(maxTextures, maxTextureBytes); | 663 fResourceCache->setLimits(maxTextures, maxTextureBytes); |
660 } | 664 } |
661 | 665 |
662 ////////////////////////////////////////////////////////////////////////////// | 666 ////////////////////////////////////////////////////////////////////////////// |
663 | 667 |
664 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { | 668 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { |
665 ASSERT_SINGLE_OWNER | 669 ASSERT_SINGLE_OWNER |
666 fResourceCache->dumpMemoryStatistics(traceMemoryDump); | 670 fResourceCache->dumpMemoryStatistics(traceMemoryDump); |
667 } | 671 } |
OLD | NEW |