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

Side by Side Diff: gm/dropshadowimagefilter.cpp

Issue 646213004: Adding an option to render only the shadow in SkDropShadowImageFilter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Added dropshadowimagefilter to ignored-tests Created 6 years, 1 month 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 | « expectations/gm/ignored-tests.txt ('k') | gm/imagefiltersbase.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 #include "SkColorFilter.h" 9 #include "SkColorFilter.h"
10 10
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 class DropShadowImageFilterGM : public skiagm::GM { 95 class DropShadowImageFilterGM : public skiagm::GM {
96 public: 96 public:
97 DropShadowImageFilterGM () {} 97 DropShadowImageFilterGM () {}
98 98
99 protected: 99 protected:
100 100
101 virtual SkString onShortName() { 101 virtual SkString onShortName() {
102 return SkString("dropshadowimagefilter"); 102 return SkString("dropshadowimagefilter");
103 } 103 }
104 104
105 virtual SkISize onISize() { return SkISize::Make(400, 700); } 105 virtual SkISize onISize() { return SkISize::Make(400, 656); }
106 106
107 void draw_frame(SkCanvas* canvas, const SkRect& r) { 107 void draw_frame(SkCanvas* canvas, const SkRect& r) {
108 SkPaint paint; 108 SkPaint paint;
109 paint.setStyle(SkPaint::kStroke_Style); 109 paint.setStyle(SkPaint::kStroke_Style);
110 paint.setColor(SK_ColorRED); 110 paint.setColor(SK_ColorRED);
111 canvas->drawRect(r, paint); 111 canvas->drawRect(r, paint);
112 } 112 }
113 113
114 virtual uint32_t onGetFlags() const { 114 virtual uint32_t onGetFlags() const {
115 // Because of the use of drawSprite, this test is excluded 115 // Because of the use of drawSprite, this test is excluded
(...skipping 11 matching lines...) Expand all
127 SkAutoTUnref<SkColorFilter> cf( 127 SkAutoTUnref<SkColorFilter> cf(
128 SkColorFilter::CreateModeFilter(SK_ColorMAGENTA, SkXfermode::kSrcIn_ Mode)); 128 SkColorFilter::CreateModeFilter(SK_ColorMAGENTA, SkXfermode::kSrcIn_ Mode));
129 SkAutoTUnref<SkImageFilter> cfif(SkColorFilterImageFilter::Create(cf.get ())); 129 SkAutoTUnref<SkImageFilter> cfif(SkColorFilterImageFilter::Create(cf.get ()));
130 SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(10, 10, 44, 44)), 130 SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(10, 10, 44, 44)),
131 SkImageFilter::CropRect::kHasAll_CropEd ge); 131 SkImageFilter::CropRect::kHasAll_CropEd ge);
132 SkImageFilter::CropRect bogusRect(SkRect::Make(SkIRect::MakeXYWH(-100, - 100, 10, 10)), 132 SkImageFilter::CropRect bogusRect(SkRect::Make(SkIRect::MakeXYWH(-100, - 100, 10, 10)),
133 SkImageFilter::CropRect::kHasAll_CropE dge); 133 SkImageFilter::CropRect::kHasAll_CropE dge);
134 134
135 SkImageFilter* filters[] = { 135 SkImageFilter* filters[] = {
136 NULL, 136 NULL,
137 SkDropShadowImageFilter::Create(7.0f, 0.0f, 0.0f, 3.0f, SK_ColorBLUE ), 137 SkDropShadowImageFilter::Create(7.0f, 0.0f, 0.0f, 3.0f, SK_ColorBLUE ,
138 SkDropShadowImageFilter::Create(0.0f, 7.0f, 3.0f, 0.0f, SK_ColorBLUE ), 138 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode),
139 SkDropShadowImageFilter::Create(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE ), 139 SkDropShadowImageFilter::Create(0.0f, 7.0f, 3.0f, 0.0f, SK_ColorBLUE ,
140 SkDropShadowImageFilter::Create(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE , cfif), 140 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode),
141 SkDropShadowImageFilter::Create(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE , NULL, &cropRect), 141 SkDropShadowImageFilter::Create(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE ,
142 SkDropShadowImageFilter::Create(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE , NULL, &bogusRect), 142 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode),
143 SkDropShadowImageFilter::Create(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE ,
144 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, cf if, NULL, 0),
145 SkDropShadowImageFilter::Create(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE ,
146 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, NU LL, &cropRect, 0),
147 SkDropShadowImageFilter::Create(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE ,
148 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, NU LL, &bogusRect, 0),
149 SkDropShadowImageFilter::Create(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE ,
150 SkDropShadowImageFilter::kDrawShadowOnly_ShadowMode),
143 }; 151 };
144 152
145 SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64)); 153 SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64));
146 SkScalar MARGIN = SkIntToScalar(16); 154 SkScalar MARGIN = SkIntToScalar(16);
147 SkScalar DX = r.width() + MARGIN; 155 SkScalar DX = r.width() + MARGIN;
148 SkScalar DY = r.height() + MARGIN; 156 SkScalar DY = r.height() + MARGIN;
149 157
150 canvas->translate(MARGIN, MARGIN); 158 canvas->translate(MARGIN, MARGIN);
151 for (size_t j = 0; j < SK_ARRAY_COUNT(drawProc); ++j) { 159 for (size_t j = 0; j < SK_ARRAY_COUNT(drawProc); ++j) {
152 canvas->save(); 160 canvas->save();
(...skipping 11 matching lines...) Expand all
164 } 172 }
165 173
166 private: 174 private:
167 typedef GM INHERITED; 175 typedef GM INHERITED;
168 }; 176 };
169 177
170 /////////////////////////////////////////////////////////////////////////////// 178 ///////////////////////////////////////////////////////////////////////////////
171 179
172 static skiagm::GM* MyFactory(void*) { return new DropShadowImageFilterGM; } 180 static skiagm::GM* MyFactory(void*) { return new DropShadowImageFilterGM; }
173 static skiagm::GMRegistry reg(MyFactory); 181 static skiagm::GMRegistry reg(MyFactory);
OLDNEW
« no previous file with comments | « expectations/gm/ignored-tests.txt ('k') | gm/imagefiltersbase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698