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

Side by Side Diff: gm/SkLinearBitmapPipelineGM.cpp

Issue 1724503002: Add dest type hint to SkShader::ContextRec (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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 | « bench/SkLinearBitmapPipelineBench.cpp ('k') | include/core/SkShader.h » ('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 2016 Google Inc. 2 * Copyright 2016 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 "SkBlitter.h"
9 #include "SkCanvas.h" 10 #include "SkCanvas.h"
10 #include "SkColor.h" 11 #include "SkColor.h"
11 #include "SkImage.h" 12 #include "SkImage.h"
12 #include "SkImageInfo.h" 13 #include "SkImageInfo.h"
13 #include "SkLinearBitmapPipeline.h" 14 #include "SkLinearBitmapPipeline.h"
14 #include "SkXfermode.h" 15 #include "SkXfermode.h"
15 #include "SkPM4fPriv.h" 16 #include "SkPM4fPriv.h"
16 #include "SkShader.h" 17 #include "SkShader.h"
17 18
18 static void fill_in_bits(SkBitmap& bm, SkIRect ir, SkColor c, bool premul) { 19 static void fill_in_bits(SkBitmap& bm, SkIRect ir, SkColor c, bool premul) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 info, pmsrc.addr32(), pmsrc.rowBytes())}; 61 info, pmsrc.addr32(), pmsrc.rowBytes())};
61 SkPaint paint; 62 SkPaint paint;
62 int32_t storage[200]; 63 int32_t storage[200];
63 SkShader* shader = image->newShader(SkShader::kClamp_TileMode, SkShader::kCl amp_TileMode); 64 SkShader* shader = image->newShader(SkShader::kClamp_TileMode, SkShader::kCl amp_TileMode);
64 if (useBilerp) { 65 if (useBilerp) {
65 paint.setFilterQuality(SkFilterQuality::kLow_SkFilterQuality); 66 paint.setFilterQuality(SkFilterQuality::kLow_SkFilterQuality);
66 } else { 67 } else {
67 paint.setFilterQuality(SkFilterQuality::kNone_SkFilterQuality); 68 paint.setFilterQuality(SkFilterQuality::kNone_SkFilterQuality);
68 } 69 }
69 paint.setShader(shader)->unref(); 70 paint.setShader(shader)->unref();
70 const SkShader::ContextRec rec(paint, *mat, nullptr); 71 const SkShader::ContextRec rec(paint, *mat, nullptr,
72 SkBlitter::PreferredShaderDest(pmsrc.info())) ;
71 SkASSERT(paint.getShader()->contextSize(rec) <= sizeof(storage)); 73 SkASSERT(paint.getShader()->contextSize(rec) <= sizeof(storage));
72 74
73 SkShader::Context* ctx = paint.getShader()->createContext(rec, storage); 75 SkShader::Context* ctx = paint.getShader()->createContext(rec, storage);
74 76
75 for (int y = 0; y < ir.height(); y++) { 77 for (int y = 0; y < ir.height(); y++) {
76 ctx->shadeSpan(0, y, pmdst.writable_addr32(0, y), ir.width()); 78 ctx->shadeSpan(0, y, pmdst.writable_addr32(0, y), ir.width());
77 } 79 }
78 80
79 canvas->drawBitmap(bmdst, r.left(), r.top(), nullptr); 81 canvas->drawBitmap(bmdst, r.left(), r.top(), nullptr);
80 82
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 } 189 }
188 canvas->restore(); 190 canvas->restore();
189 canvas->translate(0, H + 20); 191 canvas->translate(0, H + 20);
190 } 192 }
191 canvas->restore(); 193 canvas->restore();
192 canvas->translate(0, (H + 20) * SK_ARRAY_COUNT(mats)); 194 canvas->translate(0, (H + 20) * SK_ARRAY_COUNT(mats));
193 if (useBilerp) break; 195 if (useBilerp) break;
194 useBilerp = true; 196 useBilerp = true;
195 } 197 }
196 } 198 }
OLDNEW
« no previous file with comments | « bench/SkLinearBitmapPipelineBench.cpp ('k') | include/core/SkShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698