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

Side by Side Diff: gm/matriximagefilter.cpp

Issue 211703002: Remove useless code from matriximagefilter GM. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkColor.h" 9 #include "SkColor.h"
10 #include "SkMatrixImageFilter.h" 10 #include "SkMatrixImageFilter.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 canvas.drawRect(SkRect::MakeXYWH(16, 0, 16, 16), lightPaint); 52 canvas.drawRect(SkRect::MakeXYWH(16, 0, 16, 16), lightPaint);
53 canvas.drawRect(SkRect::MakeXYWH(0, 16, 16, 16), lightPaint); 53 canvas.drawRect(SkRect::MakeXYWH(0, 16, 16, 16), lightPaint);
54 canvas.drawRect(SkRect::MakeXYWH(16, 16, 16, 16), darkPaint); 54 canvas.drawRect(SkRect::MakeXYWH(16, 16, 16, 16), darkPaint);
55 canvas.restore(); 55 canvas.restore();
56 } 56 }
57 } 57 }
58 } 58 }
59 59
60 virtual void onDraw(SkCanvas* canvas) { 60 virtual void onDraw(SkCanvas* canvas) {
61 canvas->clear(0x00000000); 61 canvas->clear(0x00000000);
62 SkPaint paint;
63 SkMatrix matrix; 62 SkMatrix matrix;
64 SkScalar margin = SkIntToScalar(10); 63 SkScalar margin = SkIntToScalar(10);
65 matrix.setSkew(SkDoubleToScalar(0.5), SkDoubleToScalar(0.2)); 64 matrix.setSkew(SkDoubleToScalar(0.5), SkDoubleToScalar(0.2));
66 SkRect srcBounds;
67 SkBitmap checkerboard; 65 SkBitmap checkerboard;
68 make_checkerboard(&checkerboard); 66 make_checkerboard(&checkerboard);
69 checkerboard.getBounds(&srcBounds);
70 // Outer paint does no filtering; leave it all for the filter
71 paint.setFilterLevel(SkPaint::kNone_FilterLevel);
72 67
73 SkRect srcRect = SkRect::MakeWH(96, 96); 68 SkRect srcRect = SkRect::MakeWH(96, 96);
74 69
75 canvas->translate(margin, margin); 70 canvas->translate(margin, margin);
76 draw(canvas, srcRect, checkerboard, matrix, SkPaint::kNone_FilterLevel); 71 draw(canvas, srcRect, checkerboard, matrix, SkPaint::kNone_FilterLevel);
77 72
78 canvas->translate(srcRect.width() + margin, 0); 73 canvas->translate(srcRect.width() + margin, 0);
79 draw(canvas, srcRect, checkerboard, matrix, SkPaint::kLow_FilterLevel); 74 draw(canvas, srcRect, checkerboard, matrix, SkPaint::kLow_FilterLevel);
80 75
81 canvas->translate(srcRect.width() + margin, 0); 76 canvas->translate(srcRect.width() + margin, 0);
82 draw(canvas, srcRect, checkerboard, matrix, SkPaint::kMedium_FilterLevel ); 77 draw(canvas, srcRect, checkerboard, matrix, SkPaint::kMedium_FilterLevel );
83 78
84 canvas->translate(srcRect.width() + margin, 0); 79 canvas->translate(srcRect.width() + margin, 0);
85 draw(canvas, srcRect, checkerboard, matrix, SkPaint::kHigh_FilterLevel); 80 draw(canvas, srcRect, checkerboard, matrix, SkPaint::kHigh_FilterLevel);
86 } 81 }
87 82
88 private: 83 private:
89 typedef GM INHERITED; 84 typedef GM INHERITED;
90 }; 85 };
91 86
92 ////////////////////////////////////////////////////////////////////////////// 87 //////////////////////////////////////////////////////////////////////////////
93 88
94 static GM* MyFactory(void*) { return new MatrixImageFilterGM; } 89 static GM* MyFactory(void*) { return new MatrixImageFilterGM; }
95 static GMRegistry reg(MyFactory); 90 static GMRegistry reg(MyFactory);
96 91
97 } 92 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698