diff options
author | 2016-02-17 07:15:29 -0800 | |
---|---|---|
committer | 2016-02-17 07:15:30 -0800 | |
commit | d96e7e503fd24825a6717d58e90a97f95e8ebbc6 (patch) | |
tree | 0450239b255fa7375f7c0e0ed8517258133398bf /src/core/SkConfig8888.cpp | |
parent | 34d26b965237de84ffc54eaf6213fd8bb07c10d1 (diff) |
misc fixes to make float buffers work a little better
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1703013002
TBR=fmalita
Review URL: https://codereview.chromium.org/1703013002
Diffstat (limited to 'src/core/SkConfig8888.cpp')
-rw-r--r-- | src/core/SkConfig8888.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/core/SkConfig8888.cpp b/src/core/SkConfig8888.cpp index 53f35c3737..e2dd1020de 100644 --- a/src/core/SkConfig8888.cpp +++ b/src/core/SkConfig8888.cpp @@ -173,9 +173,20 @@ bool SkPixelInfo::CopyPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t if (srcInfo.dimensions() != dstInfo.dimensions()) { return false; } - + const int width = srcInfo.width(); const int height = srcInfo.height(); + + // Do the easiest one first : both configs are equal + if ((srcInfo == dstInfo) && !ctable) { + size_t bytes = width * srcInfo.bytesPerPixel(); + for (int y = 0; y < height; ++y) { + memcpy(dstPixels, srcPixels, bytes); + srcPixels = (const char*)srcPixels + srcRB; + dstPixels = (char*)dstPixels + dstRB; + } + return true; + } // Handle fancy alpha swizzling if both are ARGB32 if (4 == srcInfo.bytesPerPixel() && 4 == dstInfo.bytesPerPixel()) { |