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

Unified Diff: third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp

Issue 2812853002: don't call deprecated copyPixelsTo (Closed)
Patch Set: compute exact bytes per row Created 3 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp b/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp
index 3c788f230534e71da3a4d2468261bf70729d53c6..d047d1207e703f19b47cb95713a2257a131738e7 100644
--- a/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp
+++ b/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp
@@ -35,6 +35,19 @@
namespace blink {
+static void CopyPixels(void* dst_addr,
+ size_t dst_row_bytes,
+ const void* src_addr,
+ size_t src_row_bytes,
+ const SkImageInfo& info) {
+ size_t row_bytes = info.bytesPerPixel() * info.width();
+ for (int y = 0; y < info.height(); ++y) {
+ memcpy(dst_addr, src_addr, row_bytes);
+ src_addr = static_cast<const char*>(src_addr) + src_row_bytes;
+ dst_addr = static_cast<char*>(dst_addr) + dst_row_bytes;
+ }
+}
+
static bool CompatibleInfo(const SkImageInfo& src, const SkImageInfo& dst) {
if (src == dst)
return true;
@@ -151,7 +164,7 @@ bool ImageFrameGenerator::DecodeAndScale(SegmentReader* data,
ASSERT(bitmap.height() == scaled_size.height());
SkAutoLockPixels bitmap_lock(bitmap);
if (bitmap.getPixels() != pixels)
- return bitmap.copyPixelsTo(pixels, row_bytes * info.height(), row_bytes);
+ CopyPixels(pixels, row_bytes, bitmap.getPixels(), bitmap.rowBytes(), info);
return true;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698