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

Side by Side Diff: gm/colormatrix.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/colorfilters.cpp ('k') | gm/colortype.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 2011 Google Inc. 2 * Copyright 2011 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 "SkColorMatrixFilter.h" 9 #include "SkColorMatrixFilter.h"
10 #include "SkGradientShader.h" 10 #include "SkGradientShader.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // creates a bitmap with shades of transparent gray. 60 // creates a bitmap with shades of transparent gray.
61 static SkImage* CreateTransparentBitmap(int width, int height) { 61 static SkImage* CreateTransparentBitmap(int width, int height) {
62 SkBitmap bm; 62 SkBitmap bm;
63 bm.allocN32Pixels(width, height); 63 bm.allocN32Pixels(width, height);
64 SkCanvas canvas(bm); 64 SkCanvas canvas(bm);
65 canvas.clear(0x0); 65 canvas.clear(0x0);
66 66
67 SkPoint pts[] = {{0, 0}, {SkIntToScalar(width), SkIntToScalar(height)}}; 67 SkPoint pts[] = {{0, 0}, {SkIntToScalar(width), SkIntToScalar(height)}};
68 SkColor colors[] = {0x00000000, 0xFFFFFFFF}; 68 SkColor colors[] = {0x00000000, 0xFFFFFFFF};
69 SkPaint paint; 69 SkPaint paint;
70 paint.setShader(SkGradientShader::CreateLinear(pts, colors, nullptr, 2, 70 paint.setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, 2,
71 SkShader::kClamp_TileMode ))->unref(); 71 SkShader::kClamp_TileMode)) ;
72 canvas.drawRect(SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(heigh t)), paint); 72 canvas.drawRect(SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(heigh t)), paint);
73 return SkImage::NewFromBitmap(bm); 73 return SkImage::NewFromBitmap(bm);
74 } 74 }
75 75
76 void onDraw(SkCanvas* canvas) override { 76 void onDraw(SkCanvas* canvas) override {
77 SkPaint paint; 77 SkPaint paint;
78 SkColorMatrix matrix; 78 SkColorMatrix matrix;
79 79
80 paint.setXfermodeMode(SkXfermode::kSrc_Mode); 80 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
81 const SkImage* bmps[] = { fSolidImg, fTransparentImg }; 81 const SkImage* bmps[] = { fSolidImg, fTransparentImg };
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 } 139 }
140 140
141 private: 141 private:
142 SkAutoTUnref<SkImage> fSolidImg; 142 SkAutoTUnref<SkImage> fSolidImg;
143 SkAutoTUnref<SkImage> fTransparentImg; 143 SkAutoTUnref<SkImage> fTransparentImg;
144 144
145 typedef skiagm::GM INHERITED; 145 typedef skiagm::GM INHERITED;
146 }; 146 };
147 DEF_GM( return new ColorMatrixGM; ) 147 DEF_GM( return new ColorMatrixGM; )
148 148
OLDNEW
« no previous file with comments | « gm/colorfilters.cpp ('k') | gm/colortype.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698