diff options
author | bsalomon <bsalomon@google.com> | 2015-07-01 11:02:50 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-01 11:02:50 -0700 |
commit | ebaf6a69bf604c85185e23aca3fb93308e747ff5 (patch) | |
tree | 14f27fb728a4c13781790b4ae90a03d5e5c41428 /gm | |
parent | 4417c7f8bb85aa1eae536cc50c70c0cc87f31171 (diff) |
Revert of Fix SkTileImageFilter clipping/cropRect interaction issue (patchset #2 id:30001 of https://codereview.chromium.org/1210053003/)
Reason for revert:
Perf regression: https://code.google.com/p/chromium/issues/detail?id=505564
Original issue's description:
> Fix SkTileImageFilter clipping/cropRect interaction issue
>
> BUG=499499
>
> Committed: https://skia.googlesource.com/skia/+/157bcd0840b578060dbc3365daafffc6837da391
TBR=reed@google.com,senorblanco@google.com,senorblanco@chromium.org,robertphillips@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=499499
Review URL: https://codereview.chromium.org/1219193002
Diffstat (limited to 'gm')
-rw-r--r-- | gm/cropdisp.cpp | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/gm/cropdisp.cpp b/gm/cropdisp.cpp deleted file mode 100644 index 6cc0d5fe96..0000000000 --- a/gm/cropdisp.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - -#include "SkBitmapSource.h" -#include "SkColorFilter.h" -#include "SkColorFilterImageFilter.h" -#include "SkDisplacementMapEffect.h" -#include "SkTileImageFilter.h" -#include "SkXfermode.h" -#include "gm.h" - -namespace skiagm { - -// This tests the image filter graph: -// -// BitmapSource1 -- all red 512x512 -// | -// ColorFilterImageFilter -- with a 64x64 crop rect - makes the pixels green -// | -// TileImageFilter -- which tiles the 64x64 green pixels across 512x512 -// | -// | BitmapSource1 -- all red 512x512 -// | displacement | color -// | | -// DisplacementMapEffect -- this is only necessary to preserve the clip in the computed bounds -// TileImageFilter by itself bloats the bounds to include the src -// It has the TileImageFilter as the offset input. -// -// What was going on was that the clipRect being applied to the draw (64, 64, 512, 512) -// was eliminating the "displacement" chain due to the crop rect. -// This reproduces crbug/499499 -class CroppedDisplacementGM : public GM { -public: - CroppedDisplacementGM() { } - -protected: - - SkString onShortName() override { - return SkString("cropped-displacement"); - } - - SkISize onISize() override { - return SkISize::Make(kWidth, kHeight); - } - - void onOnceBeforeDraw() override { - fRedBitmap.allocN32Pixels(kWidth, kHeight); - SkCanvas canvas(fRedBitmap); - canvas.clear(SK_ColorRED); - } - - void onDraw(SkCanvas* canvas) override { - - SkPaint p; - - const SkRect smRect = SkRect::MakeWH(SkIntToScalar(kSmallSize), SkIntToScalar(kSmallSize)); - SkImageFilter::CropRect cr(smRect); - - SkAutoTUnref<SkBitmapSource> bms(SkBitmapSource::Create(fRedBitmap)); - SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(SK_ColorGREEN, - SkXfermode::kSrc_Mode)); - SkAutoTUnref<SkColorFilterImageFilter> cfif(SkColorFilterImageFilter::Create(cf, bms, &cr)); - - SkAutoTUnref<SkTileImageFilter> tif(SkTileImageFilter::Create( - SkRect::MakeWH(SkIntToScalar(kSmallSize), SkIntToScalar(kSmallSize)), - SkRect::MakeWH(SkIntToScalar(kWidth), SkIntToScalar(kHeight)), - cfif)); - - static const SkScalar kScale = 20.0f; - - SkAutoTUnref<SkDisplacementMapEffect> dif(SkDisplacementMapEffect::Create( - SkDisplacementMapEffect::kB_ChannelSelectorType, - SkDisplacementMapEffect::kB_ChannelSelectorType, - kScale, - tif, bms)); - - p.setImageFilter(dif); - - canvas->clipRect(SkRect::MakeLTRB(kSmallSize+kScale/2.0f, - kSmallSize+kScale/2.0f, - SkIntToScalar(kWidth), SkIntToScalar(kHeight))); - canvas->saveLayer(NULL, &p); - canvas->restore(); - } - -private: - static const int kWidth = 512; - static const int kHeight = 512; - static const int kSmallSize = 64; - - SkBitmap fRedBitmap; - - typedef GM INHERITED; -}; - -////////////////////////////////////////////////////////////////////////////// - -DEF_GM( return SkNEW(CroppedDisplacementGM); ) - -} |