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 "SkBlitter.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 bmsrc.peekPixels(&pmsrc); | 50 bmsrc.peekPixels(&pmsrc); |
51 | 51 |
52 SkBitmap bmdst; | 52 SkBitmap bmdst; |
53 bmdst.allocN32Pixels(ir.width(), ir.height()); | 53 bmdst.allocN32Pixels(ir.width(), ir.height()); |
54 bmdst.eraseColor(0xFFFFFFFF); | 54 bmdst.eraseColor(0xFFFFFFFF); |
55 SkPixmap pmdst; | 55 SkPixmap pmdst; |
56 bmdst.peekPixels(&pmdst); | 56 bmdst.peekPixels(&pmdst); |
57 | 57 |
58 SkImageInfo info = SkImageInfo::MakeN32Premul(ir.width(), ir.height(), kLine
ar_SkColorProfileType); | 58 SkImageInfo info = SkImageInfo::MakeN32Premul(ir.width(), ir.height(), kLine
ar_SkColorProfileType); |
59 | 59 |
60 SkAutoTUnref<SkImage> image{SkImage::NewRasterCopy( | 60 sk_sp<SkImage> image(SkImage::MakeRasterCopy(SkPixmap(info, pmsrc.addr32(),
pmsrc.rowBytes()))); |
61 info, pmsrc.addr32(), pmsrc.rowBytes())}; | |
62 SkPaint paint; | 61 SkPaint paint; |
63 int32_t storage[300]; | 62 int32_t storage[300]; |
64 paint.setShader(image->makeShader(SkShader::kClamp_TileMode, SkShader::kClam
p_TileMode)); | 63 paint.setShader(image->makeShader(SkShader::kClamp_TileMode, SkShader::kClam
p_TileMode)); |
65 if (useBilerp) { | 64 if (useBilerp) { |
66 paint.setFilterQuality(SkFilterQuality::kLow_SkFilterQuality); | 65 paint.setFilterQuality(SkFilterQuality::kLow_SkFilterQuality); |
67 } else { | 66 } else { |
68 paint.setFilterQuality(SkFilterQuality::kNone_SkFilterQuality); | 67 paint.setFilterQuality(SkFilterQuality::kNone_SkFilterQuality); |
69 } | 68 } |
70 const SkShader::ContextRec rec(paint, *mat, nullptr, | 69 const SkShader::ContextRec rec(paint, *mat, nullptr, |
71 SkBlitter::PreferredShaderDest(pmsrc.info()))
; | 70 SkBlitter::PreferredShaderDest(pmsrc.info()))
; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 } | 192 } |
194 canvas->restore(); | 193 canvas->restore(); |
195 canvas->translate(0, H + 20); | 194 canvas->translate(0, H + 20); |
196 } | 195 } |
197 canvas->restore(); | 196 canvas->restore(); |
198 canvas->translate(0, (H + 20) * SK_ARRAY_COUNT(mats)); | 197 canvas->translate(0, (H + 20) * SK_ARRAY_COUNT(mats)); |
199 if (useBilerp) break; | 198 if (useBilerp) break; |
200 useBilerp = true; | 199 useBilerp = true; |
201 } | 200 } |
202 } | 201 } |
OLD | NEW |