Chromium Code Reviews| Index: src/gpu/GrSurface.cpp |
| diff --git a/src/gpu/GrSurface.cpp b/src/gpu/GrSurface.cpp |
| index a7be0f47d96cdb890c159623843e6c861a9face5..9ba89831498e578e6ab1e19d1a40202db4e88e79 100644 |
| --- a/src/gpu/GrSurface.cpp |
| +++ b/src/gpu/GrSurface.cpp |
| @@ -92,17 +92,34 @@ bool GrSurfacePriv::AdjustWritePixelParams(int surfaceWidth, |
| ////////////////////////////////////////////////////////////////////////////// |
| bool GrSurface::writePixels(int left, int top, int width, int height, |
| - GrPixelConfig config, const void* buffer, size_t rowBytes, |
| + GrPixelConfig config, const SkTArray<SkMipMapLevel>& texels, |
| uint32_t pixelOpsFlags) { |
| // go through context so that all necessary flushing occurs |
| GrContext* context = this->getContext(); |
| if (nullptr == context) { |
| return false; |
| } |
| - return context->writeSurfacePixels(this, left, top, width, height, config, buffer, rowBytes, |
| + return context->writeSurfacePixels(this, left, top, width, height, config, texels, |
| pixelOpsFlags); |
| } |
| +bool GrSurface::writePixels(int left, int top, int width, int height, |
| + GrPixelConfig config, const void* buffer, size_t rowBytes, |
| + uint32_t pixelOpsFlags) { |
| + if (width < 0 || height < 0) { |
|
bsalomon
2015/09/30 18:01:29
<= 0?
cblume
2015/10/08 09:27:57
Done.
|
| + return nullptr; |
|
bsalomon
2015/09/30 18:01:29
false rather than nullptr
cblume
2015/10/08 09:27:57
Done.
|
| + } |
| + const uint32_t baseLevelWidth = width; |
| + const uint32_t baseLevelHeight = height; |
| + |
| + SkMipMapLevel level(buffer, rowBytes, baseLevelWidth, baseLevelHeight); |
|
bsalomon
2015/09/30 18:01:29
This doesn't copy the buffer, right?
cblume
2015/10/08 09:27:57
Correct. SkMipMapLevel only does a shallow copy of
|
| + const int levelCount = 1; |
| + SkTArray<SkMipMapLevel> texels(levelCount); |
| + texels.push_back(level); |
| + |
| + return this->writePixels(left, top, width, height, config, texels, pixelOpsFlags); |
| +} |
| + |
| bool GrSurface::readPixels(int left, int top, int width, int height, |
| GrPixelConfig config, void* buffer, size_t rowBytes, |
| uint32_t pixelOpsFlags) { |