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

Side by Side Diff: gm/imagefilterscropexpand.cpp

Issue 1978363002: Image filters: fix filtering of transparent black in CFIF. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add GM Created 4 years, 7 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 | « no previous file | src/effects/SkColorFilterImageFilter.cpp » ('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 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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColorFilter.h" 10 #include "SkColorFilter.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 void onDraw(SkCanvas* canvas) override { 42 void onDraw(SkCanvas* canvas) override {
43 SkImageFilter::CropRect cropRect( 43 SkImageFilter::CropRect cropRect(
44 SkRect::Make(SkIRect::MakeXYWH(10, 10, 44, 44)), 44 SkRect::Make(SkIRect::MakeXYWH(10, 10, 44, 44)),
45 SkImageFilter::CropRect::kHasAll_CropEdge); 45 SkImageFilter::CropRect::kHasAll_CropEdge);
46 46
47 sk_sp<SkImage> gradientCircle(MakeGradientCircle(64, 64)); 47 sk_sp<SkImage> gradientCircle(MakeGradientCircle(64, 64));
48 SkBitmap checkerboard; 48 SkBitmap checkerboard;
49 MakeCheckerboard(&checkerboard); 49 MakeCheckerboard(&checkerboard);
50 50
51 sk_sp<SkImageFilter> gradientCircleSource(SkImageSource::Make(std::move( gradientCircle))); 51 sk_sp<SkImageFilter> gradientCircleSource(SkImageSource::Make(std::move( gradientCircle)));
52 sk_sp<SkImageFilter> noopCropped(SkOffsetImageFilter::Make(0, 0, nullptr , &cropRect)); 52 sk_sp<SkImageFilter> noopCropped(SkOffsetImageFilter::Make(0, 0, nullptr , &cropRect));
robertphillips 2016/05/18 12:36:00 // This color matrix saturates the green component
53 SkScalar sk255 = SkIntToScalar(255);
54 SkScalar matrix[20] = { 1, 0, 0, 0, 0, 53 SkScalar matrix[20] = { 1, 0, 0, 0, 0,
55 0, 1, 0, 0, sk255, 54 0, 1, 0, 0, 255,
56 0, 0, 1, 0, 0, 55 0, 0, 1, 0, 0,
57 0, 0, 0, 0, sk255 }; 56 0, 0, 0, 1, 32 };
58 sk_sp<SkColorFilter> cfAlphaTrans(SkColorFilter::MakeMatrixFilterRowMajo r255(matrix)); 57 sk_sp<SkColorFilter> cfAlphaTrans(SkColorFilter::MakeMatrixFilterRowMajo r255(matrix));
59 58
60 SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64)); 59 SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64));
61 SkScalar MARGIN = SkIntToScalar(12); 60 SkScalar MARGIN = SkIntToScalar(12);
62 61
63 SkPoint3 pointLocation = SkPoint3::Make(0, 0, SkIntToScalar(10)); 62 SkPoint3 pointLocation = SkPoint3::Make(0, 0, SkIntToScalar(10));
64 SkScalar kd = SkIntToScalar(2); 63 SkScalar kd = SkIntToScalar(2);
65 SkScalar surfaceScale = SkIntToScalar(1); 64 SkScalar surfaceScale = SkIntToScalar(1);
66 SkIRect bounds; 65 SkIRect bounds;
67 r.roundOut(&bounds); 66 r.roundOut(&bounds);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 186
188 canvas->translate(SkIntToScalar(80), 0); 187 canvas->translate(SkIntToScalar(80), 0);
189 } 188 }
190 189
191 typedef GM INHERITED; 190 typedef GM INHERITED;
192 }; 191 };
193 192
194 /////////////////////////////////////////////////////////////////////////////// 193 ///////////////////////////////////////////////////////////////////////////////
195 194
196 DEF_GM( return new ImageFiltersCropExpandGM; ) 195 DEF_GM( return new ImageFiltersCropExpandGM; )
OLDNEW
« no previous file with comments | « no previous file | src/effects/SkColorFilterImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698