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

Side by Side Diff: gm/shallowgradient.cpp

Issue 321253002: Simple GPU based dithering (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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 | gyp/gpu.gypi » ('j') | src/gpu/SkGr.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 "SkGradientShader.h" 9 #include "SkGradientShader.h"
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 60 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
61 const SkColor colors[] = { 0xFF555555, 0xFF444444 }; 61 const SkColor colors[] = { 0xFF555555, 0xFF444444 };
62 const int colorCount = SK_ARRAY_COUNT(colors); 62 const int colorCount = SK_ARRAY_COUNT(colors);
63 63
64 SkRect r = { 0, 0, this->width(), this->height() }; 64 SkRect r = { 0, 0, this->width(), this->height() };
65 SkSize size = SkSize::Make(r.width(), r.height()); 65 SkSize size = SkSize::Make(r.width(), r.height());
66 66
67 SkPaint paint; 67 SkPaint paint;
68 paint.setShader(fProc(colors, colorCount, size))->unref(); 68 paint.setShader(fProc(colors, colorCount, size))->unref();
69 paint.setDither(true);
egdaniel 2014/06/11 14:05:10 You may want to consider adding this gm to the gm
69 canvas->drawRect(r, paint); 70 canvas->drawRect(r, paint);
70 } 71 }
71 72
72 private: 73 private:
73 MakeShaderProc fProc; 74 MakeShaderProc fProc;
74 SkString fName; 75 SkString fName;
75 76
76 typedef skiagm::GM INHERITED; 77 typedef skiagm::GM INHERITED;
77 }; 78 };
78 79
79 /////////////////////////////////////////////////////////////////////////////// 80 ///////////////////////////////////////////////////////////////////////////////
80 81
81 DEF_GM( return new ShallowGradientGM(shader_linear, "linear"); ) 82 DEF_GM( return new ShallowGradientGM(shader_linear, "linear"); )
82 DEF_GM( return new ShallowGradientGM(shader_radial, "radial"); ) 83 DEF_GM( return new ShallowGradientGM(shader_radial, "radial"); )
83 DEF_GM( return new ShallowGradientGM(shader_conical, "conical"); ) 84 DEF_GM( return new ShallowGradientGM(shader_conical, "conical"); )
84 DEF_GM( return new ShallowGradientGM(shader_sweep, "sweep"); ) 85 DEF_GM( return new ShallowGradientGM(shader_sweep, "sweep"); )
OLDNEW
« no previous file with comments | « no previous file | gyp/gpu.gypi » ('j') | src/gpu/SkGr.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698