Index: Source/platform/image-encoders/skia/JPEGImageEncoder.cpp |
diff --git a/Source/platform/image-encoders/skia/JPEGImageEncoder.cpp b/Source/platform/image-encoders/skia/JPEGImageEncoder.cpp |
index f12c1a67de55272b2279d340508b33b9135fb922..6e281e8427a25c392469c02d74497edb5d3d8f23 100644 |
--- a/Source/platform/image-encoders/skia/JPEGImageEncoder.cpp |
+++ b/Source/platform/image-encoders/skia/JPEGImageEncoder.cpp |
@@ -117,7 +117,7 @@ static void disableSubsamplingForHighQuality(jpeg_compress_struct* cinfo, int qu |
} |
} |
-static bool encodePixels(IntSize imageSize, unsigned char* inputPixels, bool premultiplied, int quality, Vector<unsigned char>* output) |
+static bool encodePixels(IntSize imageSize, const unsigned char* inputPixels, bool premultiplied, int quality, Vector<unsigned char>* output) |
{ |
JPEGOutputBuffer destination; |
destination.output = output; |
@@ -156,7 +156,7 @@ static bool encodePixels(IntSize imageSize, unsigned char* inputPixels, bool pre |
disableSubsamplingForHighQuality(&cinfo, quality); |
jpeg_start_compress(&cinfo, TRUE); |
- unsigned char* pixels = inputPixels; |
+ unsigned char* pixels = const_cast<unsigned char*>(inputPixels); |
const size_t pixelRowStride = cinfo.image_width * 4; |
while (cinfo.next_scanline < cinfo.image_height) { |
jpeg_write_scanlines(&cinfo, &pixels, 1); |
@@ -182,7 +182,7 @@ static bool encodePixels(IntSize imageSize, unsigned char* inputPixels, bool pre |
disableSubsamplingForHighQuality(&cinfo, quality); |
jpeg_start_compress(&cinfo, TRUE); |
- unsigned char* pixels = inputPixels; |
+ unsigned char* pixels = const_cast<unsigned char*>(inputPixels); |
row.resize(cinfo.image_width * cinfo.input_components); |
const size_t pixelRowStride = cinfo.image_width * 4; |
while (cinfo.next_scanline < cinfo.image_height) { |
@@ -209,7 +209,7 @@ bool JPEGImageEncoder::encode(const SkBitmap& bitmap, int quality, Vector<unsign |
bool JPEGImageEncoder::encode(const ImageDataBuffer& imageData, int quality, Vector<unsigned char>* output) |
{ |
- return encodePixels(imageData.size(), imageData.data(), false, quality, output); |
+ return encodePixels(IntSize(imageData.width(), imageData.height()), imageData.pixels(), false, quality, output); |
} |
} // namespace blink |