OLD | NEW |
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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkColor.h" | 10 #include "SkColor.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 info, pmsrc.addr32(), pmsrc.rowBytes())}; | 60 info, pmsrc.addr32(), pmsrc.rowBytes())}; |
61 SkPaint paint; | 61 SkPaint paint; |
62 int32_t storage[200]; | 62 int32_t storage[200]; |
63 SkShader* shader = image->newShader(SkShader::kClamp_TileMode, SkShader::kCl
amp_TileMode); | 63 SkShader* shader = image->newShader(SkShader::kClamp_TileMode, SkShader::kCl
amp_TileMode); |
64 if (useBilerp) { | 64 if (useBilerp) { |
65 paint.setFilterQuality(SkFilterQuality::kLow_SkFilterQuality); | 65 paint.setFilterQuality(SkFilterQuality::kLow_SkFilterQuality); |
66 } else { | 66 } else { |
67 paint.setFilterQuality(SkFilterQuality::kNone_SkFilterQuality); | 67 paint.setFilterQuality(SkFilterQuality::kNone_SkFilterQuality); |
68 } | 68 } |
69 paint.setShader(shader)->unref(); | 69 paint.setShader(shader)->unref(); |
70 SkASSERT(paint.getShader()->contextSize() <= sizeof(storage)); | 70 const SkShader::ContextRec rec(paint, *mat, nullptr); |
| 71 SkASSERT(paint.getShader()->contextSize(rec) <= sizeof(storage)); |
71 | 72 |
72 SkShader::Context* ctx = paint.getShader()->createContext( | 73 SkShader::Context* ctx = paint.getShader()->createContext(rec, storage); |
73 {paint, *mat, nullptr}, | |
74 storage); | |
75 | 74 |
76 for (int y = 0; y < ir.height(); y++) { | 75 for (int y = 0; y < ir.height(); y++) { |
77 ctx->shadeSpan(0, y, pmdst.writable_addr32(0, y), ir.width()); | 76 ctx->shadeSpan(0, y, pmdst.writable_addr32(0, y), ir.width()); |
78 } | 77 } |
79 | 78 |
80 canvas->drawBitmap(bmdst, r.left(), r.top(), nullptr); | 79 canvas->drawBitmap(bmdst, r.left(), r.top(), nullptr); |
81 | 80 |
82 ctx->~Context(); | 81 ctx->~Context(); |
83 | 82 |
84 } | 83 } |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 } | 187 } |
189 canvas->restore(); | 188 canvas->restore(); |
190 canvas->translate(0, H + 20); | 189 canvas->translate(0, H + 20); |
191 } | 190 } |
192 canvas->restore(); | 191 canvas->restore(); |
193 canvas->translate(0, (H + 20) * SK_ARRAY_COUNT(mats)); | 192 canvas->translate(0, (H + 20) * SK_ARRAY_COUNT(mats)); |
194 if (useBilerp) break; | 193 if (useBilerp) break; |
195 useBilerp = true; | 194 useBilerp = true; |
196 } | 195 } |
197 } | 196 } |
OLD | NEW |