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

Side by Side Diff: gm/bitmapsource.cpp

Issue 1074513002: Use opaque black not transparent black as imagefilter GM background. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Make pictureimagefilter clear the canvas as well as the picture to opaque black Created 5 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
« no previous file with comments | « no previous file | gm/pictureimagefilter.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 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 9
10 #include "SkBitmapSource.h" 10 #include "SkBitmapSource.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 static void fillRectFiltered(SkCanvas* canvas, const SkRect& clipRect, SkIma geFilter* filter) { 43 static void fillRectFiltered(SkCanvas* canvas, const SkRect& clipRect, SkIma geFilter* filter) {
44 SkPaint paint; 44 SkPaint paint;
45 paint.setImageFilter(filter); 45 paint.setImageFilter(filter);
46 canvas->save(); 46 canvas->save();
47 canvas->clipRect(clipRect); 47 canvas->clipRect(clipRect);
48 canvas->drawPaint(paint); 48 canvas->drawPaint(paint);
49 canvas->restore(); 49 canvas->restore();
50 } 50 }
51 51
52 void onDraw(SkCanvas* canvas) override { 52 void onDraw(SkCanvas* canvas) override {
53 canvas->clear(0x00000000); 53 canvas->clear(SK_ColorBLACK);
54 { 54 {
55 SkRect srcRect = SkRect::MakeXYWH(20, 20, 30, 30); 55 SkRect srcRect = SkRect::MakeXYWH(20, 20, 30, 30);
56 SkRect dstRect = SkRect::MakeXYWH(0, 10, 60, 60); 56 SkRect dstRect = SkRect::MakeXYWH(0, 10, 60, 60);
57 SkRect clipRect = SkRect::MakeXYWH(0, 0, 100, 100); 57 SkRect clipRect = SkRect::MakeXYWH(0, 0, 100, 100);
58 SkRect bounds; 58 SkRect bounds;
59 fBitmap.getBounds(&bounds); 59 fBitmap.getBounds(&bounds);
60 SkAutoTUnref<SkImageFilter> bitmapSource(SkBitmapSource::Create(fBit map)); 60 SkAutoTUnref<SkImageFilter> bitmapSource(SkBitmapSource::Create(fBit map));
61 SkAutoTUnref<SkImageFilter> bitmapSourceSrcRect(SkBitmapSource::Crea te(fBitmap, srcRect, srcRect)); 61 SkAutoTUnref<SkImageFilter> bitmapSourceSrcRect(SkBitmapSource::Crea te(fBitmap, srcRect, srcRect));
62 SkAutoTUnref<SkImageFilter> bitmapSourceSrcRectDstRect(SkBitmapSourc e::Create(fBitmap, srcRect, dstRect)); 62 SkAutoTUnref<SkImageFilter> bitmapSourceSrcRectDstRect(SkBitmapSourc e::Create(fBitmap, srcRect, dstRect));
63 SkAutoTUnref<SkImageFilter> bitmapSourceDstRectOnly(SkBitmapSource:: Create(fBitmap, bounds, dstRect)); 63 SkAutoTUnref<SkImageFilter> bitmapSourceDstRectOnly(SkBitmapSource:: Create(fBitmap, bounds, dstRect));
(...skipping 17 matching lines...) Expand all
81 } 81 }
82 82
83 private: 83 private:
84 SkBitmap fBitmap; 84 SkBitmap fBitmap;
85 typedef GM INHERITED; 85 typedef GM INHERITED;
86 }; 86 };
87 87
88 /////////////////////////////////////////////////////////////////////////////// 88 ///////////////////////////////////////////////////////////////////////////////
89 89
90 DEF_GM( return new BitmapSourceGM; ) 90 DEF_GM( return new BitmapSourceGM; )
OLDNEW
« no previous file with comments | « no previous file | gm/pictureimagefilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698