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

Side by Side Diff: gm/colormatrix.cpp

Issue 2396953002: Revert[8] "replace SkXfermode obj with SkBlendMode enum in paints" (Closed)
Patch Set: add tmp virtual to unroll legacy arithmodes Created 4 years, 2 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/blurredclippedcircle.cpp ('k') | gm/colortypexfermode.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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 paint.setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, 2, 70 paint.setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, 2,
71 SkShader::kClamp_TileMode)) ; 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::MakeFromBitmap(bm); 73 return SkImage::MakeFromBitmap(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.setBlendMode(SkBlendMode::kSrc);
81 const SkImage* bmps[] = { fSolidImg.get(), fTransparentImg.get() }; 81 const SkImage* bmps[] = { fSolidImg.get(), fTransparentImg.get() };
82 82
83 for (size_t i = 0; i < SK_ARRAY_COUNT(bmps); ++i) { 83 for (size_t i = 0; i < SK_ARRAY_COUNT(bmps); ++i) {
84 matrix.setIdentity(); 84 matrix.setIdentity();
85 set_color_matrix(&paint, matrix); 85 set_color_matrix(&paint, matrix);
86 canvas->drawImage(bmps[i], 0, 0, &paint); 86 canvas->drawImage(bmps[i], 0, 0, &paint);
87 87
88 matrix.setRotate(SkColorMatrix::kR_Axis, 90); 88 matrix.setRotate(SkColorMatrix::kR_Axis, 90);
89 set_color_matrix(&paint, matrix); 89 set_color_matrix(&paint, matrix);
90 canvas->drawImage(bmps[i], 80, 0, &paint); 90 canvas->drawImage(bmps[i], 80, 0, &paint);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } 138 }
139 } 139 }
140 140
141 private: 141 private:
142 sk_sp<SkImage> fSolidImg; 142 sk_sp<SkImage> fSolidImg;
143 sk_sp<SkImage> fTransparentImg; 143 sk_sp<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; )
OLDNEW
« no previous file with comments | « gm/blurredclippedcircle.cpp ('k') | gm/colortypexfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698