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

Side by Side Diff: gm/matrixconvolution.cpp

Issue 1497083005: Revert of Matrix convolution bounds fix; affectsTransparentBlack fixes. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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 | « no previous file | include/core/SkImageFilter.h » ('j') | 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 2012 Google Inc. 2 * Copyright 2012 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 "SkMatrixConvolutionImageFilter.h" 10 #include "SkMatrixConvolutionImageFilter.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 typedef SkMatrixConvolutionImageFilter MCIF; 80 typedef SkMatrixConvolutionImageFilter MCIF;
81 81
82 void onOnceBeforeDraw() override { 82 void onOnceBeforeDraw() override {
83 this->makeBitmap(); 83 this->makeBitmap();
84 } 84 }
85 85
86 void onDraw(SkCanvas* canvas) override { 86 void onDraw(SkCanvas* canvas) override {
87 canvas->clear(SK_ColorBLACK); 87 canvas->clear(SK_ColorBLACK);
88 SkIPoint kernelOffset = SkIPoint::Make(1, 0); 88 SkIPoint kernelOffset = SkIPoint::Make(1, 0);
89 SkImageFilter::CropRect rect(SkRect::Make(fBitmap.bounds()));
90 for (int x = 10; x < 310; x += 100) { 89 for (int x = 10; x < 310; x += 100) {
91 this->draw(canvas, x, 10, kernelOffset, MCIF::kClamp_TileMode, true, &rect); 90 this->draw(canvas, x, 10, kernelOffset, MCIF::kClamp_TileMode, true) ;
92 this->draw(canvas, x, 110, kernelOffset, MCIF::kClampToBlack_TileMod e, true, &rect); 91 this->draw(canvas, x, 110, kernelOffset, MCIF::kClampToBlack_TileMod e, true);
93 this->draw(canvas, x, 210, kernelOffset, MCIF::kRepeat_TileMode, tru e, &rect); 92 this->draw(canvas, x, 210, kernelOffset, MCIF::kRepeat_TileMode, tru e);
94 kernelOffset.fY++; 93 kernelOffset.fY++;
95 } 94 }
96 kernelOffset.fY = 1; 95 kernelOffset.fY = 1;
97 SkImageFilter::CropRect smallRect(SkRect::MakeXYWH(10, 5, 60, 60)); 96 SkImageFilter::CropRect rect(SkRect::MakeXYWH(10, 5, 60, 60));
98 this->draw(canvas, 310, 10, kernelOffset, MCIF::kClamp_TileMode, true, & smallRect); 97 this->draw(canvas, 310, 10, kernelOffset, MCIF::kClamp_TileMode, true, & rect);
99 this->draw(canvas, 310, 110, kernelOffset, MCIF::kClampToBlack_TileMode, true, &smallRect); 98 this->draw(canvas, 310, 110, kernelOffset, MCIF::kClampToBlack_TileMode, true, &rect);
100 this->draw(canvas, 310, 210, kernelOffset, MCIF::kRepeat_TileMode, true, &smallRect); 99 this->draw(canvas, 310, 210, kernelOffset, MCIF::kRepeat_TileMode, true, &rect);
101 100
102 this->draw(canvas, 410, 10, kernelOffset, MCIF::kClamp_TileMode, false, &rect); 101 this->draw(canvas, 410, 10, kernelOffset, MCIF::kClamp_TileMode, false);
103 this->draw(canvas, 410, 110, kernelOffset, MCIF::kClampToBlack_TileMode, false, &rect); 102 this->draw(canvas, 410, 110, kernelOffset, MCIF::kClampToBlack_TileMode, false);
104 this->draw(canvas, 410, 210, kernelOffset, MCIF::kRepeat_TileMode, false , &rect); 103 this->draw(canvas, 410, 210, kernelOffset, MCIF::kRepeat_TileMode, false );
105 } 104 }
106 105
107 private: 106 private:
108 SkBitmap fBitmap; 107 SkBitmap fBitmap;
109 108
110 typedef GM INHERITED; 109 typedef GM INHERITED;
111 }; 110 };
112 111
113 ////////////////////////////////////////////////////////////////////////////// 112 //////////////////////////////////////////////////////////////////////////////
114 113
115 DEF_GM(return new MatrixConvolutionGM;) 114 DEF_GM(return new MatrixConvolutionGM;)
116 115
117 } 116 }
OLDNEW
« no previous file with comments | « no previous file | include/core/SkImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698