Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Unified Diff: gm/bitmapsource2.cpp

Issue 1343123002: Convert unit tests, GMs from SkBitmapSource to SkImagesource (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: review comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « bench/MergeBench.cpp ('k') | gm/displacement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/bitmapsource2.cpp
diff --git a/gm/bitmapsource2.cpp b/gm/bitmapsource2.cpp
deleted file mode 100644
index f65bafd2bc46169bfd4b4fdd1db6752a145f86f4..0000000000000000000000000000000000000000
--- a/gm/bitmapsource2.cpp
+++ /dev/null
@@ -1,89 +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 "gm.h"
-#include "SkBitmapSource.h"
-
-namespace skiagm {
-
-// This GM reproduces the issue in crbug.com/472795. The SkBitmapSource image
-// is shifted for high quality mode between cpu and gpu.
-class BitmapSourceGM : public GM {
-public:
- BitmapSourceGM(const char* suffix, SkFilterQuality filter) : fSuffix(suffix), fFilter(filter) {
- this->setBGColor(0xFFFFFFFF);
- }
-
-protected:
- SkString onShortName() override {
- SkString name("bitmapsrc2_");
- name.append(fSuffix);
- return name;
- }
-
- SkISize onISize() override { return SkISize::Make(256, 256); }
-
- // Create a bitmap with high frequency vertical stripes
- void onOnceBeforeDraw() override {
- static const SkPMColor gColors[] = {
- SK_ColorRED, SK_ColorGRAY,
- SK_ColorGREEN, SK_ColorGRAY,
- SK_ColorBLUE, SK_ColorGRAY,
- SK_ColorCYAN, SK_ColorGRAY,
- SK_ColorMAGENTA, SK_ColorGRAY,
- SK_ColorYELLOW, SK_ColorGRAY,
- SK_ColorWHITE, SK_ColorGRAY,
- };
-
- fBM.allocN32Pixels(kImageSize, kImageSize, true);
-
- SkCanvas canvas(fBM);
-
- int curColor = 0;
-
- for (int x = 0; x < kImageSize; x += 3) {
- SkRect r = SkRect::MakeXYWH(SkIntToScalar(x), SkIntToScalar(0),
- SkIntToScalar(3), SkIntToScalar(kImageSize));
- SkPaint p;
- p.setColor(gColors[curColor]);
- canvas.drawRect(r, p);
-
- curColor = (curColor+1) % SK_ARRAY_COUNT(gColors);
- }
- }
-
- void onDraw(SkCanvas* canvas) override {
- SkRect srcRect = SkRect::MakeLTRB(0, 0,
- SkIntToScalar(kImageSize), SkIntToScalar(kImageSize));
- SkRect dstRect = SkRect::MakeLTRB(0.75f, 0.75f, 225.75f, 225.75f);
-
- SkAutoTUnref<SkImageFilter> filter(SkBitmapSource::Create(fBM, srcRect, dstRect, fFilter));
-
- SkPaint p;
- p.setImageFilter(filter);
-
- canvas->saveLayer(nullptr, &p);
- canvas->restore();
- }
-
-private:
- static const int kImageSize = 503;
-
- SkString fSuffix;
- SkFilterQuality fFilter;
- SkBitmap fBM;
-
- typedef GM INHERITED;
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-DEF_GM(return new BitmapSourceGM("none", kNone_SkFilterQuality);)
-DEF_GM(return new BitmapSourceGM("low", kLow_SkFilterQuality);)
-DEF_GM(return new BitmapSourceGM("med", kMedium_SkFilterQuality);)
-DEF_GM(return new BitmapSourceGM("high", kHigh_SkFilterQuality);)
-}
« no previous file with comments | « bench/MergeBench.cpp ('k') | gm/displacement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698