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

Side by Side Diff: gm/texturedomaineffect.cpp

Issue 1790353002: Revert of more shader-->sp conversions (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/textblobshader.cpp ('k') | gm/tiledscaledbitmap.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 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 // This test only works with the GPU backend. 9 // This test only works with the GPU backend.
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 return SkISize::Make(SkScalarCeilToInt(canvasWidth), 800); 43 return SkISize::Make(SkScalarCeilToInt(canvasWidth), 800);
44 } 44 }
45 45
46 void onOnceBeforeDraw() override { 46 void onOnceBeforeDraw() override {
47 fBmp.allocN32Pixels(kTargetWidth, kTargetHeight); 47 fBmp.allocN32Pixels(kTargetWidth, kTargetHeight);
48 SkCanvas canvas(fBmp); 48 SkCanvas canvas(fBmp);
49 canvas.clear(0x00000000); 49 canvas.clear(0x00000000);
50 SkPaint paint; 50 SkPaint paint;
51 51
52 SkColor colors1[] = { SK_ColorCYAN, SK_ColorLTGRAY, SK_ColorGRAY }; 52 SkColor colors1[] = { SK_ColorCYAN, SK_ColorLTGRAY, SK_ColorGRAY };
53 paint.setShader(SkGradientShader::MakeSweep(65.f, 75.f, colors1, nullptr , 53 paint.setShader(SkGradientShader::CreateSweep(65.f, 75.f, colors1,
54 SK_ARRAY_COUNT(colors1))); 54 nullptr, SK_ARRAY_COUNT(co lors1)))->unref();
55 canvas.drawOval(SkRect::MakeXYWH(-5.f, -5.f, fBmp.width() + 10.f, fBmp.h eight() + 10.f), 55 canvas.drawOval(SkRect::MakeXYWH(-5.f, -5.f,
56 paint); 56 fBmp.width() + 10.f, fBmp.height() + 10 .f), paint);
57 57
58 SkColor colors2[] = { SK_ColorMAGENTA, SK_ColorLTGRAY, SK_ColorYELLOW }; 58 SkColor colors2[] = { SK_ColorMAGENTA, SK_ColorLTGRAY, SK_ColorYELLOW };
59 paint.setShader(SkGradientShader::MakeSweep(45.f, 55.f, colors2, nullptr , 59 paint.setShader(SkGradientShader::CreateSweep(45.f, 55.f, colors2, nullp tr,
60 SK_ARRAY_COUNT(colors2))); 60 SK_ARRAY_COUNT(colors2)))- >unref();
61 paint.setXfermodeMode(SkXfermode::kDarken_Mode); 61 paint.setXfermodeMode(SkXfermode::kDarken_Mode);
62 canvas.drawOval(SkRect::MakeXYWH(-5.f, -5.f, fBmp.width() + 10.f, fBmp.h eight() + 10.f), 62 canvas.drawOval(SkRect::MakeXYWH(-5.f, -5.f,
63 paint); 63 fBmp.width() + 10.f, fBmp.height() + 10 .f), paint);
64 64
65 SkColor colors3[] = { SK_ColorBLUE, SK_ColorLTGRAY, SK_ColorGREEN }; 65 SkColor colors3[] = { SK_ColorBLUE, SK_ColorLTGRAY, SK_ColorGREEN };
66 paint.setShader(SkGradientShader::MakeSweep(25.f, 35.f, colors3, nullptr , 66 paint.setShader(SkGradientShader::CreateSweep(25.f, 35.f, colors3, nullp tr,
67 SK_ARRAY_COUNT(colors3))); 67 SK_ARRAY_COUNT(colors3)))- >unref();
68 paint.setXfermodeMode(SkXfermode::kLighten_Mode); 68 paint.setXfermodeMode(SkXfermode::kLighten_Mode);
69 canvas.drawOval(SkRect::MakeXYWH(-5.f, -5.f, fBmp.width() + 10.f, fBmp.h eight() + 10.f), 69 canvas.drawOval(SkRect::MakeXYWH(-5.f, -5.f,
70 paint); 70 fBmp.width() + 10.f, fBmp.height() + 10 .f), paint);
71 } 71 }
72 72
73 void onDraw(SkCanvas* canvas) override { 73 void onDraw(SkCanvas* canvas) override {
74 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget (); 74 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget ();
75 if (nullptr == rt) { 75 if (nullptr == rt) {
76 return; 76 return;
77 } 77 }
78 GrContext* context = rt->getContext(); 78 GrContext* context = rt->getContext();
79 if (nullptr == context) { 79 if (nullptr == context) {
80 skiagm::GM::DrawGpuOnlyMessage(canvas); 80 skiagm::GM::DrawGpuOnlyMessage(canvas);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 }; 154 };
155 155
156 // Windows builds did not like SkScalar initialization in class :( 156 // Windows builds did not like SkScalar initialization in class :(
157 const SkScalar TextureDomainEffect::kDrawPad = 10.f; 157 const SkScalar TextureDomainEffect::kDrawPad = 10.f;
158 const SkScalar TextureDomainEffect::kTestPad = 10.f; 158 const SkScalar TextureDomainEffect::kTestPad = 10.f;
159 159
160 DEF_GM(return new TextureDomainEffect;) 160 DEF_GM(return new TextureDomainEffect;)
161 } 161 }
162 162
163 #endif 163 #endif
OLDNEW
« no previous file with comments | « gm/textblobshader.cpp ('k') | gm/tiledscaledbitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698