Index: src/gpu/GrSurface.cpp |
diff --git a/src/gpu/GrSurface.cpp b/src/gpu/GrSurface.cpp |
index 382550e41fc43f512600a844758002984ab76fbf..f266915058a4341d0a837fbaf5d463c5f6376160 100644 |
--- a/src/gpu/GrSurface.cpp |
+++ b/src/gpu/GrSurface.cpp |
@@ -93,17 +93,35 @@ 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) { |
+ // make sure the size's range fits within the texelmap's size range |
+ if (width <= 0 || height <= 0) { |
+ return false; |
+ } |
+ const uint32_t baseLevelWidth = width; |
+ const uint32_t baseLevelHeight = height; |
+ |
+ SkMipMapLevel level(buffer, rowBytes, baseLevelWidth, baseLevelHeight); |
+ 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) { |