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

Side by Side Diff: gm/bicubicfilter.cpp

Issue 357793002: Remove SkBicubicImageFilter, and all related tests. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove all expected results for now-deleted GM Created 6 years, 5 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 unified diff | Download patch
« no previous file with comments | « experimental/webtry/templates/template.cpp ('k') | gyp/bench.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "gm.h"
9 #include "SkColor.h"
10 #include "SkBicubicImageFilter.h"
11
12 namespace skiagm {
13
14 class BicubicGM : public GM {
15 public:
16 BicubicGM() : fInitialized(false) {
17 this->setBGColor(0x00000000);
18 }
19
20 protected:
21 virtual uint32_t onGetFlags() const SK_OVERRIDE {
22 return kSkipTiled_Flag;
23 }
24
25 virtual SkString onShortName() {
26 return SkString("bicubicfilter");
27 }
28
29 void make_checkerboard(int width, int height) {
30 SkASSERT(width % 2 == 0);
31 SkASSERT(height % 2 == 0);
32 fCheckerboard.allocN32Pixels(width, height);
33 for (int y = 0; y < height; y += 2) {
34 SkPMColor* s = fCheckerboard.getAddr32(0, y);
35 for (int x = 0; x < width; x += 2) {
36 *s++ = 0xFFFFFFFF;
37 *s++ = 0xFF000000;
38 }
39 s = fCheckerboard.getAddr32(0, y + 1);
40 for (int x = 0; x < width; x += 2) {
41 *s++ = 0xFF000000;
42 *s++ = 0xFFFFFFFF;
43 }
44 }
45 }
46
47 virtual SkISize onISize() {
48 return SkISize::Make(400, 300);
49 }
50
51 virtual void onDraw(SkCanvas* canvas) {
52 if (!fInitialized) {
53 make_checkerboard(4, 4);
54 fInitialized = true;
55 }
56 SkScalar sk32 = SkIntToScalar(32);
57 canvas->clear(0x00000000);
58 SkPaint bilinearPaint, bicubicPaint;
59 SkSize scale = SkSize::Make(sk32, sk32);
60 canvas->save();
61 canvas->scale(sk32, sk32);
62 bilinearPaint.setFilterLevel(SkPaint::kLow_FilterLevel);
63 canvas->drawBitmap(fCheckerboard, 0, 0, &bilinearPaint);
64 canvas->restore();
65 SkAutoTUnref<SkImageFilter> bicubic(SkBicubicImageFilter::CreateMitchell (scale));
66 bicubicPaint.setImageFilter(bicubic);
67 SkRect srcBounds;
68 fCheckerboard.getBounds(&srcBounds);
69 canvas->translate(SkIntToScalar(140), 0);
70 canvas->saveLayer(&srcBounds, &bicubicPaint);
71 canvas->drawBitmap(fCheckerboard, 0, 0);
72 canvas->restore();
73 }
74
75 private:
76 typedef GM INHERITED;
77 SkBitmap fCheckerboard;
78 bool fInitialized;
79 };
80
81 //////////////////////////////////////////////////////////////////////////////
82
83 static GM* MyFactory(void*) { return new BicubicGM; }
84 static GMRegistry reg(MyFactory);
85
86 }
OLDNEW
« no previous file with comments | « experimental/webtry/templates/template.cpp ('k') | gyp/bench.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698