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

Unified Diff: src/codec/SkSwizzler.cpp

Issue 1671003004: Skip memcpy() swizzles in SkPngCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: First Approach Created 4 years, 10 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
« src/codec/SkPngCodec.cpp ('K') | « src/codec/SkPngCodec.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkSwizzler.cpp
diff --git a/src/codec/SkSwizzler.cpp b/src/codec/SkSwizzler.cpp
index debcd45c207048b5e96279a7ed5001e0695628cb..04560095bd0fd06936460cc3c48d6688874d4c18 100644
--- a/src/codec/SkSwizzler.cpp
+++ b/src/codec/SkSwizzler.cpp
@@ -11,13 +11,11 @@
#include "SkSwizzler.h"
#include "SkTemplates.h"
-static void copy(void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, int offset,
+static void noop(void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, int offset,
msarett 2016/02/05 20:48:18 This is broken as is. It works for PNG, but I woul
const SkPMColor ctable[]) {
// This function must not be called if we are sampling. If we are not
// sampling, deltaSrc should equal bpp.
SkASSERT(deltaSrc == bpp);
-
- memcpy(dst, src + offset, width * bpp);
}
static void sample1(void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, int offset,
@@ -400,7 +398,7 @@ static void fast_swizzle_bgra_to_n32_unpremul(
#ifdef SK_PMCOLOR_IS_RGBA
SkOpts::RGBA_to_BGRA((uint32_t*) dst, src + offset, width);
#else
- memcpy(dst, src + offset, width * bpp);
+ // Nothing needs to be done here.
#endif
}
@@ -525,7 +523,7 @@ static void fast_swizzle_rgba_to_n32_unpremul(
SkASSERT(deltaSrc == bpp);
#ifdef SK_PMCOLOR_IS_RGBA
- memcpy(dst, src + offset, width * bpp);
+ // Nothing needs to be done here.
#else
SkOpts::RGBA_to_BGRA((uint32_t*) dst, src + offset, width);
#endif
@@ -714,7 +712,7 @@ SkSwizzler* SkSwizzler::CreateSwizzler(SkSwizzler::SrcConfig sc,
break;
case kIndex_8_SkColorType:
proc = &sample1;
- fastProc = ©
+ fastProc = &noop;
break;
default:
break;
@@ -728,7 +726,7 @@ SkSwizzler* SkSwizzler::CreateSwizzler(SkSwizzler::SrcConfig sc,
break;
case kGray_8_SkColorType:
proc = &sample1;
- fastProc = ©
+ fastProc = &noop;
break;
case kRGB_565_SkColorType:
proc = &swizzle_gray_to_565;
@@ -854,15 +852,15 @@ SkSwizzler* SkSwizzler::CreateSwizzler(SkSwizzler::SrcConfig sc,
break;
case kNoOp8:
proc = &sample1;
- fastProc = ©
+ fastProc = &noop;
break;
case kNoOp16:
proc = sample2;
- fastProc = ©
+ fastProc = &noop;
break;
case kNoOp32:
proc = &sample4;
- fastProc = ©
+ fastProc = &noop;
break;
default:
break;
@@ -883,6 +881,7 @@ SkSwizzler* SkSwizzler::CreateSwizzler(SkSwizzler::SrcConfig sc,
srcOffset = options.fSubset->left();
srcWidth = options.fSubset->width();
dstWidth = srcWidth;
+ fastProc = nullptr;
msarett 2016/02/05 20:48:18 Problem: We need the swizzler to do a copy for us
} else if (frame) {
dstOffset = frame->left();
srcWidth = frame->width();
« src/codec/SkPngCodec.cpp ('K') | « src/codec/SkPngCodec.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698