diff options
author | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-05-29 19:05:54 +0000 |
---|---|---|
committer | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-05-29 19:05:54 +0000 |
commit | 06e7424c70595cdfeee9a0ce8a2fb0f7f17eac41 (patch) | |
tree | 4c59f177ea61598be9a8b1f7a406663248d63ce2 /gm/arithmode.cpp | |
parent | 6b6c1dc34c299be87a3ff3ab41d3d4fd0f96a846 (diff) |
Revert "Provide a GPU implementation of SkArithmeticMode, using a custom GrEffect exposed via asNewEffectOrCoeff()."
This reverts commit b8ffe17b5c684f9cfff02285f27e6aa1f75c9b53.
TBR=robertphillips
Review URL: https://codereview.chromium.org/16115007
git-svn-id: http://skia.googlecode.com/svn/trunk@9325 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm/arithmode.cpp')
-rw-r--r-- | gm/arithmode.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/gm/arithmode.cpp b/gm/arithmode.cpp index 63be6c3871..2a97eca957 100644 --- a/gm/arithmode.cpp +++ b/gm/arithmode.cpp @@ -54,6 +54,18 @@ static SkBitmap make_dst() { return bm; } +static SkBitmap make_arith(const SkBitmap& src, const SkBitmap& dst, + const SkScalar k[]) { + SkBitmap bm = make_bm(); + SkCanvas canvas(bm); + SkPaint paint; + canvas.drawBitmap(dst, 0, 0, NULL); + SkXfermode* xfer = SkArithmeticMode::Create(k[0], k[1], k[2], k[3]); + paint.setXfermode(xfer)->unref(); + canvas.drawBitmap(src, 0, 0, &paint); + return bm; +} + static void show_k_text(SkCanvas* canvas, SkScalar x, SkScalar y, const SkScalar k[]) { SkPaint paint; paint.setTextSize(SkIntToScalar(24)); @@ -104,18 +116,12 @@ protected: SkScalar gap = SkIntToScalar(src.width() + 20); while (k < stop) { SkScalar x = 0; + SkBitmap res = make_arith(src, dst, k); canvas->drawBitmap(src, x, y, NULL); x += gap; canvas->drawBitmap(dst, x, y, NULL); x += gap; - SkRect rect = SkRect::MakeXYWH(x, y, SkIntToScalar(WW), SkIntToScalar(HH)); - canvas->saveLayer(&rect, NULL); - canvas->drawBitmap(dst, x, y, NULL); - SkXfermode* xfer = SkArithmeticMode::Create(k[0], k[1], k[2], k[3]); - SkPaint paint; - paint.setXfermode(xfer)->unref(); - canvas->drawBitmap(src, x, y, &paint); - canvas->restore(); + canvas->drawBitmap(res, x, y, NULL); x += gap; show_k_text(canvas, x, y, k); k += 4; |