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

Unified Diff: Source/platform/image-encoders/skia/PNGImageEncoder.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
Index: Source/platform/image-encoders/skia/PNGImageEncoder.cpp
diff --git a/Source/platform/image-encoders/skia/PNGImageEncoder.cpp b/Source/platform/image-encoders/skia/PNGImageEncoder.cpp
index 4b1d818a9edcc19845da32ba9994e3061b489c48..a50913912aa5125c3491f2509d87e140bfb7eaa0 100644
--- a/Source/platform/image-encoders/skia/PNGImageEncoder.cpp
+++ b/Source/platform/image-encoders/skia/PNGImageEncoder.cpp
@@ -68,7 +68,7 @@ static void preMultipliedBGRAtoRGBA(const void* pixels, int pixelCount, unsigned
}
}
-static bool encodePixels(IntSize imageSize, unsigned char* inputPixels, bool premultiplied, Vector<unsigned char>* output)
+static bool encodePixels(IntSize imageSize, const unsigned char* inputPixels, bool premultiplied, Vector<unsigned char>* output)
{
imageSize.clampNegativeToZero();
Vector<unsigned char> row;
@@ -97,7 +97,7 @@ static bool encodePixels(IntSize imageSize, unsigned char* inputPixels, bool pre
8, PNG_COLOR_TYPE_RGB_ALPHA, 0, 0, 0);
png_write_info(png, info);
- unsigned char* pixels = inputPixels;
+ unsigned char* pixels = const_cast<unsigned char*>(inputPixels);
row.resize(imageSize.width() * sizeof(SkPMColor));
const size_t pixelRowStride = imageSize.width() * 4;
for (int y = 0; y < imageSize.height(); ++y) {
@@ -126,7 +126,7 @@ bool PNGImageEncoder::encode(const SkBitmap& bitmap, Vector<unsigned char>* outp
bool PNGImageEncoder::encode(const ImageDataBuffer& imageData, Vector<unsigned char>* output)
{
- return encodePixels(imageData.size(), imageData.data(), false, output);
+ return encodePixels(IntSize(imageData.width(), imageData.height()), imageData.pixels(), false, output);
}
} // namespace blink
« no previous file with comments | « Source/platform/image-encoders/skia/PNGImageEncoder.h ('k') | Source/platform/image-encoders/skia/WEBPImageEncoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698