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>
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)) {
// 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) \
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).