diff options
author | Mike Klein <mtklein@chromium.org> | 2017-07-18 18:15:13 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-07-20 19:50:32 +0000 |
commit | 45c16fa82cd2fec010d4cb7763b654a413cabd0c (patch) | |
tree | 2c6e4376e11dca4b4c3ae479b7835096124016f5 /dm | |
parent | 3f4671871fac8e5439440ce756d0666bc2a96f46 (diff) |
convert over to 2d-mode
[√] convert all stages to use SkJumper_MemoryCtx / be 2d-compatible
[√] convert compile to 2d also, remove 1d run/compile
[√] convert all call sites
[√] no diffs
Change-Id: I3b806eb8fe0c3ec043359616409f7cd1211a1e43
Reviewed-on: https://skia-review.googlesource.com/24263
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'dm')
-rw-r--r-- | dm/DMSrcSink.cpp | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index cf8d4ba577..a299369f0a 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -44,6 +44,7 @@ #include "SkTLogic.h" #include <cmath> #include <functional> +#include "../src/jumper/SkJumper.h" #if defined(SK_BUILD_FOR_WIN) #include "SkAutoCoInitialize.h" @@ -324,15 +325,14 @@ static void premultiply_if_necessary(SkBitmap& bitmap) { } switch (bitmap.colorType()) { - case kRGBA_F16_SkColorType: - for (int y = 0; y < bitmap.height(); y++) { - void* row = bitmap.getAddr(0, y); - SkRasterPipeline_<256> p; - p.append(SkRasterPipeline::load_f16, &row); - p.append(SkRasterPipeline::premul); - p.append(SkRasterPipeline::store_f16, &row); - p.run(0,y, bitmap.width()); - } + case kRGBA_F16_SkColorType: { + SkJumper_MemoryCtx ctx = { bitmap.getAddr(0,0), bitmap.rowBytesAsPixels() }; + SkRasterPipeline_<256> p; + p.append(SkRasterPipeline::load_f16, &ctx); + p.append(SkRasterPipeline::premul); + p.append(SkRasterPipeline::store_f16, &ctx); + p.run(0,0, bitmap.width(), bitmap.height()); + } break; case kN32_SkColorType: for (int y = 0; y < bitmap.height(); y++) { @@ -1020,7 +1020,8 @@ void clamp_if_necessary(const SkBitmap& bitmap, SkColorType dstCT) { return; } - void* ptr = bitmap.getAddr(0, 0); + SkJumper_MemoryCtx ptr = { bitmap.getAddr(0,0), bitmap.rowBytesAsPixels() }; + SkRasterPipeline_<256> p; p.append(SkRasterPipeline::load_f16, &ptr); p.append(SkRasterPipeline::clamp_0); @@ -1031,11 +1032,7 @@ void clamp_if_necessary(const SkBitmap& bitmap, SkColorType dstCT) { } p.append(SkRasterPipeline::store_f16, &ptr); - auto run = p.compile(); - for (int y = 0; y < bitmap.height(); y++) { - run(0, y, bitmap.width()); - ptr = SkTAddOffset<void>(ptr, bitmap.rowBytes()); - } + p.run(0,0, bitmap.width(), bitmap.height()); } Error ColorCodecSrc::draw(SkCanvas* canvas) const { |