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 "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 Loading... |
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 Loading... |
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 } |
OLD | NEW |