SkPixelInfo::CopyPixels() refactor part 0: only one memcpy() case
I envision this eventually looking like the following:
Fast Path 1: memcpy
Fast Path 2: Legacy RGBA/BGRA unpremul/premul
Fast Path 3: SkColorSpaceXform
Fallback: Raster pipeline
BUG=skia:6021
Change-Id: I3f0e36b08b051ab4ba3949f04474f20d0c20a963
Reviewed-on: https://skia-review.googlesource.com/7435
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Matt Sarett <msarett@google.com>
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index 9bb4c57..b6b8a5d 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -477,13 +477,8 @@
dstRow -= layout.rowPitch;
}
} else {
- // If there is no padding on the src (rowBytes) or dst (layout.rowPitch) we can memcpy
- if (trimRowBytes == rowBytes && trimRowBytes == layout.rowPitch) {
- memcpy(mapPtr, data, trimRowBytes * height);
- } else {
- SkRectMemcpy(mapPtr, static_cast<size_t>(layout.rowPitch), data, rowBytes, trimRowBytes,
- height);
- }
+ SkRectMemcpy(mapPtr, static_cast<size_t>(layout.rowPitch), data, rowBytes, trimRowBytes,
+ height);
}
GrVkMemory::FlushMappedAlloc(this, alloc);
@@ -580,8 +575,6 @@
src -= rowBytes;
dst += trimRowBytes;
}
- } else if (trimRowBytes == rowBytes) {
- memcpy(dst, src, trimRowBytes * currentHeight);
} else {
SkRectMemcpy(dst, trimRowBytes, src, rowBytes, trimRowBytes, currentHeight);
}
@@ -966,12 +959,7 @@
// If there is no padding on dst we can do a single memcopy.
// This assumes the srcData comes in with no padding.
- if (srcRowBytes == dstRowBytes) {
- memcpy(mapPtr, srcData, srcRowBytes * h);
- } else {
- SkRectMemcpy(mapPtr, static_cast<size_t>(dstRowBytes), srcData, srcRowBytes,
- srcRowBytes, h);
- }
+ SkRectMemcpy(mapPtr, static_cast<size_t>(dstRowBytes), srcData, srcRowBytes, srcRowBytes, h);
GrVkMemory::FlushMappedAlloc(gpu, alloc);
GR_VK_CALL(gpu->vkInterface(), UnmapMemory(gpu->device(), alloc.fMemory));
return true;
@@ -1756,12 +1744,7 @@
dstRow -= rowBytes;
}
} else {
- if (transBufferRowBytes == rowBytes) {
- memcpy(buffer, mappedMemory, rowBytes*height);
- } else {
- SkRectMemcpy(buffer, rowBytes, mappedMemory, transBufferRowBytes, tightRowBytes,
- height);
- }
+ SkRectMemcpy(buffer, rowBytes, mappedMemory, transBufferRowBytes, tightRowBytes, height);
}
transferBuffer->unmap();