Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1717)

Unified Diff: Source/platform/image-encoders/skia/JPEGImageEncoder.cpp

Issue 837643002: Remove Uint8ClampedArray use from ImageBuffer.h ImageDataBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/graphics/ImageBuffer.cpp ('k') | Source/platform/image-encoders/skia/PNGImageEncoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/platform/graphics/ImageBuffer.cpp ('k') | Source/platform/image-encoders/skia/PNGImageEncoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698