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

Side by Side Diff: gm/lighting.cpp

Issue 1842193002: Update SkOffsetImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 4 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
« no previous file with comments | « gm/imagefiltersstroked.cpp ('k') | gm/localmatriximagefilter.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 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 "SkLightingImageFilter.h" 9 #include "SkLightingImageFilter.h"
10 #include "SkOffsetImageFilter.h" 10 #include "SkOffsetImageFilter.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 SkScalar cutoffAngle = SkIntToScalar(15); 73 SkScalar cutoffAngle = SkIntToScalar(15);
74 SkScalar kd = SkIntToScalar(2); 74 SkScalar kd = SkIntToScalar(2);
75 SkScalar ks = SkIntToScalar(1); 75 SkScalar ks = SkIntToScalar(1);
76 SkScalar shininess = SkIntToScalar(8); 76 SkScalar shininess = SkIntToScalar(8);
77 SkScalar surfaceScale = SkIntToScalar(1); 77 SkScalar surfaceScale = SkIntToScalar(1);
78 SkColor white(0xFFFFFFFF); 78 SkColor white(0xFFFFFFFF);
79 SkPaint paint; 79 SkPaint paint;
80 80
81 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(20, 10, 60, 65)); 81 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(20, 10, 60, 65));
82 SkImageFilter::CropRect fullSizeCropRect(SkRect::MakeXYWH(0, 0, 100, 100 )); 82 SkImageFilter::CropRect fullSizeCropRect(SkRect::MakeXYWH(0, 0, 100, 100 ));
83 SkAutoTUnref<SkImageFilter> noopCropped(SkOffsetImageFilter::Create(0, 0 , nullptr, &cropRect)); 83 sk_sp<SkImageFilter> noopCropped(SkOffsetImageFilter::Make(0, 0, nullptr , &cropRect));
84 84
85 int y = 0; 85 int y = 0;
86 for (int i = 0; i < 3; i++) { 86 for (int i = 0; i < 3; i++) {
87 const SkImageFilter::CropRect* cr = (i == 1) ? &cropRect : (i == 2) ? &fullSizeCropRect : nullptr; 87 const SkImageFilter::CropRect* cr = (i == 1) ? &cropRect : (i == 2) ? &fullSizeCropRect : nullptr;
88 SkImageFilter* input = (i == 2) ? noopCropped.get() : nullptr; 88 SkImageFilter* input = (i == 2) ? noopCropped.get() : nullptr;
89 paint.setImageFilter(SkLightingImageFilter::CreatePointLitDiffuse(po intLocation, 89 paint.setImageFilter(SkLightingImageFilter::CreatePointLitDiffuse(po intLocation,
90 wh ite, 90 wh ite,
91 su rfaceScale, 91 su rfaceScale,
92 kd , 92 kd ,
93 in put, 93 in put,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 private: 152 private:
153 SkBitmap fBitmap; 153 SkBitmap fBitmap;
154 154
155 typedef GM INHERITED; 155 typedef GM INHERITED;
156 }; 156 };
157 157
158 ////////////////////////////////////////////////////////////////////////////// 158 //////////////////////////////////////////////////////////////////////////////
159 159
160 DEF_GM(return new ImageLightingGM;) 160 DEF_GM(return new ImageLightingGM;)
161 } 161 }
OLDNEW
« no previous file with comments | « gm/imagefiltersstroked.cpp ('k') | gm/localmatriximagefilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698