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

Side by Side Diff: tests/BlitRowTest.cpp

Issue 1793303002: Reland of "more shader-->sp conversions (patchset #5 id:80001 of https://codereview.chromium… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: make pictureRef a value, so its clearer what's going on 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 SkShader* s = SkShader::CreateBitmapShader(bm, SkShader::kClamp_TileMode , 169 paint->setShader(SkShader::MakeBitmapShader(bm, SkShader::kClamp_TileMod e,
170 SkShader::kClamp_TileMode); 170 SkShader::kClamp_TileMode));
171 paint->setShader(s)->unref();
172
173 } 171 }
174 172
175 void draw(SkCanvas* canvas, SkPaint* paint) { 173 void draw(SkCanvas* canvas, SkPaint* paint) {
176 canvas->drawVertices(SkCanvas::kTriangleFan_VertexMode, 4, fPts, fPts, 174 canvas->drawVertices(SkCanvas::kTriangleFan_VertexMode, 4, fPts, fPts,
177 nullptr, nullptr, nullptr, 0, *paint); 175 nullptr, nullptr, nullptr, 0, *paint);
178 } 176 }
179 }; 177 };
180 178
181 #include "SkImageEncoder.h" 179 #include "SkImageEncoder.h"
182 static void save_bm(const SkBitmap& bm, const char name[]) { 180 static void save_bm(const SkBitmap& bm, const char name[]) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 } 253 }
256 } 254 }
257 } 255 }
258 } 256 }
259 } 257 }
260 258
261 DEF_TEST(BlitRow, reporter) { 259 DEF_TEST(BlitRow, reporter) {
262 test_00_FF(reporter); 260 test_00_FF(reporter);
263 test_diagonal(reporter); 261 test_diagonal(reporter);
264 } 262 }
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