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

Side by Side Diff: gm/bitmaprect.cpp

Issue 1832223002: switch xfermodes over to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 8 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
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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkGradientShader.h" 10 #include "SkGradientShader.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 192
193 SkISize onISize() override { 193 SkISize onISize() override {
194 return SkISize::Make(640, 480); 194 return SkISize::Make(640, 480);
195 } 195 }
196 196
197 void onOnceBeforeDraw() override { 197 void onOnceBeforeDraw() override {
198 make_big_bitmap(&fBigBitmap); 198 make_big_bitmap(&fBigBitmap);
199 } 199 }
200 200
201 void onDraw(SkCanvas* canvas) override { 201 void onDraw(SkCanvas* canvas) override {
202
203 SkXfermode* mode = SkXfermode::Create(SkXfermode::kXor_Mode);
204
205 SkPaint paint; 202 SkPaint paint;
206 paint.setAlpha(128); 203 paint.setAlpha(128);
207 paint.setXfermode(mode)->unref(); 204 paint.setXfermode(SkXfermode::Make(SkXfermode::kXor_Mode));
208 205
209 SkRect srcR1 = { 0.0f, 0.0f, 4096.0f, 2040.0f }; 206 SkRect srcR1 = { 0.0f, 0.0f, 4096.0f, 2040.0f };
210 SkRect dstR1 = { 10.1f, 10.1f, 629.9f, 400.9f }; 207 SkRect dstR1 = { 10.1f, 10.1f, 629.9f, 400.9f };
211 208
212 SkRect srcR2 = { 4085.0f, 10.0f, 4087.0f, 12.0f }; 209 SkRect srcR2 = { 4085.0f, 10.0f, 4087.0f, 12.0f };
213 SkRect dstR2 = { 10, 410, 30, 430 }; 210 SkRect dstR2 = { 10, 410, 30, 430 };
214 211
215 if (!fUseIRect) { 212 if (!fUseIRect) {
216 canvas->drawBitmapRect(fBigBitmap, srcR1, dstR1, &paint, 213 canvas->drawBitmapRect(fBigBitmap, srcR1, dstR1, &paint,
217 SkCanvas::kStrict_SrcRectConstraint); 214 SkCanvas::kStrict_SrcRectConstraint);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 ////////////////////////////////////////////////////////////////////////////// 271 //////////////////////////////////////////////////////////////////////////////
275 272
276 DEF_GM( return new DrawBitmapRect2(false); ) 273 DEF_GM( return new DrawBitmapRect2(false); )
277 DEF_GM( return new DrawBitmapRect2(true); ) 274 DEF_GM( return new DrawBitmapRect2(true); )
278 DEF_GM( return new DrawBitmapRect3(); ) 275 DEF_GM( return new DrawBitmapRect3(); )
279 276
280 #ifndef SK_BUILD_FOR_ANDROID 277 #ifndef SK_BUILD_FOR_ANDROID
281 DEF_GM( return new DrawBitmapRect4(false); ) 278 DEF_GM( return new DrawBitmapRect4(false); )
282 DEF_GM( return new DrawBitmapRect4(true); ) 279 DEF_GM( return new DrawBitmapRect4(true); )
283 #endif 280 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698