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

Side by Side Diff: gm/constcolorprocessor.cpp

Issue 1776973003: partial switch over to sp usage of shaders (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: move into lua container Created 4 years, 9 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/composeshader.cpp ('k') | gm/convexpolyclip.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
2 /* 1 /*
3 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
4 * 3 *
5 * 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
6 * found in the LICENSE file. 5 * found in the LICENSE file.
7 */ 6 */
8 7
9 // This test only works with the GPU backend. 8 // This test only works with the GPU backend.
10 9
11 #include "gm.h" 10 #include "gm.h"
(...skipping 24 matching lines...) Expand all
36 return SkString("const_color_processor"); 35 return SkString("const_color_processor");
37 } 36 }
38 37
39 SkISize onISize() override { 38 SkISize onISize() override {
40 return SkISize::Make(kWidth, kHeight); 39 return SkISize::Make(kWidth, kHeight);
41 } 40 }
42 41
43 void onOnceBeforeDraw() override { 42 void onOnceBeforeDraw() override {
44 SkColor colors[] = { 0xFFFF0000, 0x2000FF00, 0xFF0000FF}; 43 SkColor colors[] = { 0xFFFF0000, 0x2000FF00, 0xFF0000FF};
45 SkPoint pts[] = { SkPoint::Make(0, 0), SkPoint::Make(kRectSize, kRectSiz e) }; 44 SkPoint pts[] = { SkPoint::Make(0, 0), SkPoint::Make(kRectSize, kRectSiz e) };
46 fShader.reset(SkGradientShader::CreateLinear(pts, colors, nullptr, SK_AR RAY_COUNT(colors), 45 fShader = SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_CO UNT(colors),
47 SkShader::kClamp_TileMode)); 46 SkShader::kClamp_TileMode);
48 } 47 }
49 48
50 void onDraw(SkCanvas* canvas) override { 49 void onDraw(SkCanvas* canvas) override {
51 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget (); 50 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget ();
52 if (nullptr == rt) { 51 if (nullptr == rt) {
53 return; 52 return;
54 } 53 }
55 GrContext* context = rt->getContext(); 54 GrContext* context = rt->getContext();
56 if (nullptr == context) { 55 if (nullptr == context) {
57 skiagm::GM::DrawGpuOnlyMessage(canvas); 56 skiagm::GM::DrawGpuOnlyMessage(canvas);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 x += maxW + kPad; 171 x += maxW + kPad;
173 maxW = 0; 172 maxW = 0;
174 } 173 }
175 } 174 }
176 } 175 }
177 } 176 }
178 } 177 }
179 178
180 private: 179 private:
181 // Use this as a way of generating and input FP 180 // Use this as a way of generating and input FP
182 SkAutoTUnref<SkShader> fShader; 181 sk_sp<SkShader> fShader;
183 182
184 static const SkScalar kPad; 183 static const SkScalar kPad;
185 static const SkScalar kRectSize; 184 static const SkScalar kRectSize;
186 static const int kWidth = 820; 185 static const int kWidth = 820;
187 static const int kHeight = 500; 186 static const int kHeight = 500;
188 187
189 typedef GM INHERITED; 188 typedef GM INHERITED;
190 }; 189 };
191 190
192 const SkScalar ConstColorProcessor::kPad = 10.f; 191 const SkScalar ConstColorProcessor::kPad = 10.f;
193 const SkScalar ConstColorProcessor::kRectSize = 20.f; 192 const SkScalar ConstColorProcessor::kRectSize = 20.f;
194 193
195 DEF_GM(return new ConstColorProcessor;) 194 DEF_GM(return new ConstColorProcessor;)
196 } 195 }
197 196
198 #endif 197 #endif
OLDNEW
« no previous file with comments | « gm/composeshader.cpp ('k') | gm/convexpolyclip.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698