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

Side by Side Diff: tests/BlitRowTest.cpp

Issue 1790353002: Revert of more shader-->sp conversions (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « tests/BitmapHeapTest.cpp ('k') | tests/CanvasTest.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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 struct Mesh { 159 struct Mesh {
160 SkPoint fPts[4]; 160 SkPoint fPts[4];
161 161
162 Mesh(const SkBitmap& bm, SkPaint* paint) { 162 Mesh(const SkBitmap& bm, SkPaint* paint) {
163 const SkScalar w = SkIntToScalar(bm.width()); 163 const SkScalar w = SkIntToScalar(bm.width());
164 const SkScalar h = SkIntToScalar(bm.height()); 164 const SkScalar h = SkIntToScalar(bm.height());
165 fPts[0].set(0, 0); 165 fPts[0].set(0, 0);
166 fPts[1].set(w, 0); 166 fPts[1].set(w, 0);
167 fPts[2].set(w, h); 167 fPts[2].set(w, h);
168 fPts[3].set(0, h); 168 fPts[3].set(0, h);
169 paint->setShader(SkShader::MakeBitmapShader(bm, SkShader::kClamp_TileMod e, 169 SkShader* s = SkShader::CreateBitmapShader(bm, SkShader::kClamp_TileMode ,
170 SkShader::kClamp_TileMode)); 170 SkShader::kClamp_TileMode);
171 paint->setShader(s)->unref();
172
171 } 173 }
172 174
173 void draw(SkCanvas* canvas, SkPaint* paint) { 175 void draw(SkCanvas* canvas, SkPaint* paint) {
174 canvas->drawVertices(SkCanvas::kTriangleFan_VertexMode, 4, fPts, fPts, 176 canvas->drawVertices(SkCanvas::kTriangleFan_VertexMode, 4, fPts, fPts,
175 nullptr, nullptr, nullptr, 0, *paint); 177 nullptr, nullptr, nullptr, 0, *paint);
176 } 178 }
177 }; 179 };
178 180
179 #include "SkImageEncoder.h" 181 #include "SkImageEncoder.h"
180 static void save_bm(const SkBitmap& bm, const char name[]) { 182 static void save_bm(const SkBitmap& bm, const char name[]) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } 255 }
254 } 256 }
255 } 257 }
256 } 258 }
257 } 259 }
258 260
259 DEF_TEST(BlitRow, reporter) { 261 DEF_TEST(BlitRow, reporter) {
260 test_00_FF(reporter); 262 test_00_FF(reporter);
261 test_diagonal(reporter); 263 test_diagonal(reporter);
262 } 264 }
OLDNEW
« no previous file with comments | « tests/BitmapHeapTest.cpp ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698