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

Unified Diff: src/core/SkBlitRow_D32.cpp

Issue 959873002: Clean up ColorRectProc plumbing. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: simpler, platform procs specialize anyway Created 5 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
« no previous file with comments | « include/core/SkBlitRow.h ('k') | src/core/SkBlitter_ARGB32.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBlitRow_D32.cpp
diff --git a/src/core/SkBlitRow_D32.cpp b/src/core/SkBlitRow_D32.cpp
index f8cf9a34a9c31e9347f093007f65f3a2074126e0..509eeeb1a060bc5f5a1aadf3a87492a943c14929 100644
--- a/src/core/SkBlitRow_D32.cpp
+++ b/src/core/SkBlitRow_D32.cpp
@@ -12,8 +12,6 @@
#define UNROLL
-SkBlitRow::ColorRectProc PlatformColorRectProcFactory();
-
static void S32_Opaque_BlitRow32(SkPMColor* SK_RESTRICT dst,
const SkPMColor* SK_RESTRICT src,
int count, U8CPU alpha) {
@@ -166,84 +164,3 @@ void SkBlitRow::Color32(SkPMColor* SK_RESTRICT dst,
}
}
-template <size_t N> void assignLoop(SkPMColor* dst, SkPMColor color) {
- for (size_t i = 0; i < N; ++i) {
- *dst++ = color;
- }
-}
-
-static inline void assignLoop(SkPMColor dst[], SkPMColor color, int count) {
- while (count >= 4) {
- *dst++ = color;
- *dst++ = color;
- *dst++ = color;
- *dst++ = color;
- count -= 4;
- }
- if (count >= 2) {
- *dst++ = color;
- *dst++ = color;
- count -= 2;
- }
- if (count > 0) {
- *dst++ = color;
- }
-}
-
-void SkBlitRow::ColorRect32(SkPMColor* dst, int width, int height,
- size_t rowBytes, SkPMColor color) {
- if (width <= 0 || height <= 0 || 0 == color) {
- return;
- }
-
- // Just made up this value, since I saw it once in a SSE2 file.
- // We should consider writing some tests to find the optimimal break-point
- // (or query the Platform proc?)
- static const int MIN_WIDTH_FOR_SCANLINE_PROC = 32;
-
- bool isOpaque = (0xFF == SkGetPackedA32(color));
-
- if (!isOpaque || width >= MIN_WIDTH_FOR_SCANLINE_PROC) {
- SkBlitRow::ColorProc proc = SkBlitRow::ColorProcFactory();
- while (--height >= 0) {
- (*proc)(dst, dst, width, color);
- dst = (SkPMColor*) ((char*)dst + rowBytes);
- }
- } else {
- switch (width) {
- case 1:
- while (--height >= 0) {
- assignLoop<1>(dst, color);
- dst = (SkPMColor*) ((char*)dst + rowBytes);
- }
- break;
- case 2:
- while (--height >= 0) {
- assignLoop<2>(dst, color);
- dst = (SkPMColor*) ((char*)dst + rowBytes);
- }
- break;
- case 3:
- while (--height >= 0) {
- assignLoop<3>(dst, color);
- dst = (SkPMColor*) ((char*)dst + rowBytes);
- }
- break;
- default:
- while (--height >= 0) {
- assignLoop(dst, color, width);
- dst = (SkPMColor*) ((char*)dst + rowBytes);
- }
- break;
- }
- }
-}
-
-SkBlitRow::ColorRectProc SkBlitRow::ColorRectProcFactory() {
- SkBlitRow::ColorRectProc proc = PlatformColorRectProcFactory();
- if (NULL == proc) {
- proc = ColorRect32;
- }
- SkASSERT(proc);
- return proc;
-}
« no previous file with comments | « include/core/SkBlitRow.h ('k') | src/core/SkBlitter_ARGB32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698