swap_src_dst -> move_src_dst
authorMike Klein <mtklein@chromium.org>
Fri, 4 Nov 2016 20:36:39 +0000 (16:36 -0400)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Fri, 4 Nov 2016 21:11:01 +0000 (21:11 +0000)
We thought it'd be handy to have swap_src_dst so that it could be used
either to move dst into src or src into dst.  Turns out, we already have
a stage that moves dst into src (called "dst", the dst blend mode), so
there's really no reason to have swap_src_dst over the strictly more
efficient move_src_dst.

swap_src_dst is typically 12 register moves, where move_src_dst is 4.

BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4461

Change-Id: Ib453775f854e313f823851978eaadc3995872312
Reviewed-on: https://skia-review.googlesource.com/4461
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>

src/core/SkModeColorFilter.cpp
src/core/SkRasterPipeline.h
src/opts/SkRasterPipeline_opts.h

index 176c92b..b9ad76f 100644 (file)
@@ -88,7 +88,7 @@ sk_sp<SkFlattenable> SkModeColorFilter::CreateProc(SkReadBuffer& buffer) {
 bool SkModeColorFilter::onAppendStages(SkRasterPipeline* p, bool shaderIsOpaque) const {
     // TODO: For some modes we can cut a stage by loading the fPM4f into dr,dg,db,da
     // and applying the opposite xfermode, e.g. dst-in instead of src-in.
-    p->append(SkRasterPipeline::swap_src_dst);
+    p->append(SkRasterPipeline::move_src_dst);
     p->append(SkRasterPipeline::constant_color, &fPM4f);
     auto mode = (SkBlendMode)fMode;
     if (!SkBlendMode_AppendStages(mode, p)) {
index bf886cf..9193de5 100644 (file)
@@ -55,7 +55,7 @@
 // the Stage*.  This mostly matters on 64-bit Windows where every register is precious.
 
 #define SK_RASTER_PIPELINE_STAGES(M)                             \
-    M(swap_src_dst) M(clamp_0) M(clamp_a) M(unpremul) M(premul)  \
+    M(move_src_dst) M(clamp_0) M(clamp_a) M(unpremul) M(premul)  \
     M(constant_color) M(store_f32)                               \
     M(load_s_565)  M(load_d_565)  M(store_565)                   \
     M(load_s_srgb) M(load_d_srgb) M(store_srgb)                  \
index ef09023..97cd64a 100644 (file)
@@ -221,11 +221,11 @@ STAGE(premul, true) {
     b *= a;
 }
 
-STAGE(swap_src_dst, true) {
-    SkTSwap(r,dr);
-    SkTSwap(g,dg);
-    SkTSwap(b,db);
-    SkTSwap(a,da);
+STAGE(move_src_dst, true) {
+    dr = r;
+    dg = g;
+    db = b;
+    da = a;
 }
 
 // The default shader produces a constant color (from the SkPaint).