| 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 | 9 |
| 10 #include "GrContext.h" | 10 #include "GrContext.h" |
| (...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1340 if ((kUnpremul_PixelOpsFlag & flags) || !fGpu->canWriteTexturePixels(texture
, config)) { | 1340 if ((kUnpremul_PixelOpsFlag & flags) || !fGpu->canWriteTexturePixels(texture
, config)) { |
| 1341 if (texture->asRenderTarget()) { | 1341 if (texture->asRenderTarget()) { |
| 1342 return this->writeRenderTargetPixels(texture->asRenderTarget(), | 1342 return this->writeRenderTargetPixels(texture->asRenderTarget(), |
| 1343 left, top, width, height, | 1343 left, top, width, height, |
| 1344 config, buffer, rowBytes, flags
); | 1344 config, buffer, rowBytes, flags
); |
| 1345 } else { | 1345 } else { |
| 1346 return false; | 1346 return false; |
| 1347 } | 1347 } |
| 1348 } | 1348 } |
| 1349 | 1349 |
| 1350 if (!(kDontFlush_PixelOpsFlag & flags) && texture->hasPendingIO()) { | 1350 if (!(kDontFlush_PixelOpsFlag & flags)) { |
| 1351 this->flush(); | 1351 this->flush(); |
| 1352 } | 1352 } |
| 1353 | 1353 |
| 1354 return fGpu->writeTexturePixels(texture, left, top, width, height, | 1354 return fGpu->writeTexturePixels(texture, left, top, width, height, |
| 1355 config, buffer, rowBytes); | 1355 config, buffer, rowBytes); |
| 1356 } | 1356 } |
| 1357 | 1357 |
| 1358 bool GrContext::readTexturePixels(GrTexture* texture, | 1358 bool GrContext::readTexturePixels(GrTexture* texture, |
| 1359 int left, int top, int width, int height, | 1359 int left, int top, int width, int height, |
| 1360 GrPixelConfig config, void* buffer, size_t row
Bytes, | 1360 GrPixelConfig config, void* buffer, size_t row
Bytes, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1411 uint32_t flags) { | 1411 uint32_t flags) { |
| 1412 ASSERT_OWNED_RESOURCE(target); | 1412 ASSERT_OWNED_RESOURCE(target); |
| 1413 | 1413 |
| 1414 if (NULL == target) { | 1414 if (NULL == target) { |
| 1415 target = fRenderTarget.get(); | 1415 target = fRenderTarget.get(); |
| 1416 if (NULL == target) { | 1416 if (NULL == target) { |
| 1417 return false; | 1417 return false; |
| 1418 } | 1418 } |
| 1419 } | 1419 } |
| 1420 | 1420 |
| 1421 if (!(kDontFlush_PixelOpsFlag & flags) && target->hasPendingWrite()) { | 1421 if (!(kDontFlush_PixelOpsFlag & flags)) { |
| 1422 this->flush(); | 1422 this->flush(); |
| 1423 } | 1423 } |
| 1424 | 1424 |
| 1425 // Determine which conversions have to be applied: flipY, swapRAnd, and/or u
npremul. | 1425 // Determine which conversions have to be applied: flipY, swapRAnd, and/or u
npremul. |
| 1426 | 1426 |
| 1427 // If fGpu->readPixels would incur a y-flip cost then we will read the pixel
s upside down. We'll | 1427 // If fGpu->readPixels would incur a y-flip cost then we will read the pixel
s upside down. We'll |
| 1428 // either do the flipY by drawing into a scratch with a matrix or on the cpu
after the read. | 1428 // either do the flipY by drawing into a scratch with a matrix or on the cpu
after the read. |
| 1429 bool flipY = fGpu->readPixelsWillPayForYFlip(target, left, top, | 1429 bool flipY = fGpu->readPixelsWillPayForYFlip(target, left, top, |
| 1430 width, height, dstConfig, | 1430 width, height, dstConfig, |
| 1431 rowBytes); | 1431 rowBytes); |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1941 fResourceCache->printStats(); | 1941 fResourceCache->printStats(); |
| 1942 } | 1942 } |
| 1943 #endif | 1943 #endif |
| 1944 | 1944 |
| 1945 #if GR_GPU_STATS | 1945 #if GR_GPU_STATS |
| 1946 const GrContext::GPUStats* GrContext::gpuStats() const { | 1946 const GrContext::GPUStats* GrContext::gpuStats() const { |
| 1947 return fGpu->gpuStats(); | 1947 return fGpu->gpuStats(); |
| 1948 } | 1948 } |
| 1949 #endif | 1949 #endif |
| 1950 | 1950 |
| OLD | NEW |