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

Side by Side Diff: samplecode/SampleShaders.cpp

Issue 1153193014: delete (unused) TransparentShader (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 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 | « samplecode/SampleAll.cpp ('k') | src/animator/SkDisplayType.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
11 #include "SkGradientShader.h" 11 #include "SkGradientShader.h"
12 #include "SkGraphics.h" 12 #include "SkGraphics.h"
13 #include "SkImageDecoder.h" 13 #include "SkImageDecoder.h"
14 #include "SkPath.h" 14 #include "SkPath.h"
15 #include "SkRegion.h" 15 #include "SkRegion.h"
16 #include "SkShader.h" 16 #include "SkShader.h"
17 #include "SkUtils.h" 17 #include "SkUtils.h"
18 #include "SkXfermode.h" 18 #include "SkXfermode.h"
19 #include "SkComposeShader.h" 19 #include "SkComposeShader.h"
20 #include "SkColorPriv.h" 20 #include "SkColorPriv.h"
21 #include "SkColorFilter.h" 21 #include "SkColorFilter.h"
22 #include "SkTime.h" 22 #include "SkTime.h"
23 #include "SkTransparentShader.h"
24 #include "SkTypeface.h" 23 #include "SkTypeface.h"
25 24
26 static SkShader* make_bitmapfade(const SkBitmap& bm) 25 static SkShader* make_bitmapfade(const SkBitmap& bm)
27 { 26 {
28 SkPoint pts[2]; 27 SkPoint pts[2];
29 SkColor colors[2]; 28 SkColor colors[2];
30 29
31 pts[0].set(0, 0); 30 pts[0].set(0, 0);
32 pts[1].set(0, SkIntToScalar(bm.height())); 31 pts[1].set(0, SkIntToScalar(bm.height()));
33 colors[0] = SK_ColorBLACK; 32 colors[0] = SK_ColorBLACK;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 int w = fBitmap.width(); 108 int w = fBitmap.width();
110 int h = fBitmap.height(); 109 int h = fBitmap.height();
111 w = 120; 110 w = 120;
112 h = 80; 111 h = 80;
113 r.set(0, 0, SkIntToScalar(w), SkIntToScalar(h)); 112 r.set(0, 0, SkIntToScalar(w), SkIntToScalar(h));
114 113
115 paint.setShader(NULL); 114 paint.setShader(NULL);
116 canvas->drawRect(r, paint); 115 canvas->drawRect(r, paint);
117 paint.setShader(make_bitmapfade(fBitmap))->unref(); 116 paint.setShader(make_bitmapfade(fBitmap))->unref();
118 canvas->drawRect(r, paint); 117 canvas->drawRect(r, paint);
119
120 paint.setShader(new SkTransparentShader)->unref();
121 canvas->drawRect(r, paint);
122 } 118 }
123 119
124 virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, 120 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) ove rride {
125 unsigned modi) override {
126 this->inval(NULL); 121 this->inval(NULL);
127 return this->INHERITED::onFindClickHandler(x, y, modi); 122 return this->INHERITED::onFindClickHandler(x, y, modi);
128 } 123 }
129 124
130 bool onClick(Click* click) override { 125 bool onClick(Click* click) override {
131 return this->INHERITED::onClick(click); 126 return this->INHERITED::onClick(click);
132 } 127 }
133 128
134 private: 129 private:
135 typedef SampleView INHERITED; 130 typedef SampleView INHERITED;
136 }; 131 };
137 132
138 ////////////////////////////////////////////////////////////////////////////// 133 //////////////////////////////////////////////////////////////////////////////
139 134
140 static SkView* MyFactory() { return new ShaderView; } 135 static SkView* MyFactory() { return new ShaderView; }
141 static SkViewRegister reg(MyFactory); 136 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleAll.cpp ('k') | src/animator/SkDisplayType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698