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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 SkPixmap pmsrc; | 49 SkPixmap pmsrc; |
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()); | 58 SkImageInfo info = SkImageInfo::MakeN32Premul(ir.width(), ir.height(), kLine
ar_SkColorProfileType); |
59 | 59 |
60 sk_sp<SkImage> image(SkImage::MakeRasterCopy(SkPixmap(info, pmsrc.addr32(),
pmsrc.rowBytes()))); | 60 sk_sp<SkImage> image(SkImage::MakeRasterCopy(SkPixmap(info, pmsrc.addr32(),
pmsrc.rowBytes()))); |
61 SkPaint paint; | 61 SkPaint paint; |
62 int32_t storage[kSkBlitterContextSize]; | 62 int32_t storage[kSkBlitterContextSize]; |
63 | 63 |
64 sk_sp<SkShader> shader = image->makeShader(SkShader::kRepeat_TileMode, | 64 sk_sp<SkShader> shader = image->makeShader(SkShader::kRepeat_TileMode, |
65 SkShader::kRepeat_TileMode); | 65 SkShader::kRepeat_TileMode); |
66 | 66 |
67 if (useBilerp) { | 67 if (useBilerp) { |
68 paint.setFilterQuality(SkFilterQuality::kLow_SkFilterQuality); | 68 paint.setFilterQuality(SkFilterQuality::kLow_SkFilterQuality); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 sk_ignore_unused_variable(trash); | 106 sk_ignore_unused_variable(trash); |
107 | 107 |
108 SkFilterQuality filterQuality; | 108 SkFilterQuality filterQuality; |
109 if (useBilerp) { | 109 if (useBilerp) { |
110 filterQuality = SkFilterQuality::kLow_SkFilterQuality; | 110 filterQuality = SkFilterQuality::kLow_SkFilterQuality; |
111 } else { | 111 } else { |
112 filterQuality = SkFilterQuality::kNone_SkFilterQuality; | 112 filterQuality = SkFilterQuality::kNone_SkFilterQuality; |
113 } | 113 } |
114 | 114 |
115 uint32_t flags = 0; | 115 uint32_t flags = 0; |
| 116 //if (kSRGB_SkColorProfileType == profile) { |
| 117 //flags |= SkXfermode::kDstIsSRGB_PM4fFlag; |
| 118 //} |
116 auto procN = SkXfermode::GetD32Proc(nullptr, flags); | 119 auto procN = SkXfermode::GetD32Proc(nullptr, flags); |
117 | 120 |
118 SkLinearBitmapPipeline pipeline{ | 121 SkLinearBitmapPipeline pipeline{ |
119 inv, filterQuality, | 122 inv, filterQuality, |
120 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, SK_ColorBLAC
K, pmsrc}; | 123 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, SK_ColorBLAC
K, pmsrc}; |
121 | 124 |
122 for (int y = 0; y < ir.height(); y++) { | 125 for (int y = 0; y < ir.height(); y++) { |
123 pipeline.shadeSpan4f(0, y, dstBits, ir.width()); | 126 pipeline.shadeSpan4f(0, y, dstBits, ir.width()); |
124 procN(nullptr, pmdst.writable_addr32(0, y), dstBits, ir.width(), nullptr
); | 127 procN(nullptr, pmdst.writable_addr32(0, y), dstBits, ir.width(), nullptr
); |
125 } | 128 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 } | 195 } |
193 canvas->restore(); | 196 canvas->restore(); |
194 canvas->translate(0, H + 20); | 197 canvas->translate(0, H + 20); |
195 } | 198 } |
196 canvas->restore(); | 199 canvas->restore(); |
197 canvas->translate(0, (H + 20) * SK_ARRAY_COUNT(mats)); | 200 canvas->translate(0, (H + 20) * SK_ARRAY_COUNT(mats)); |
198 if (useBilerp) break; | 201 if (useBilerp) break; |
199 useBilerp = true; | 202 useBilerp = true; |
200 } | 203 } |
201 } | 204 } |
OLD | NEW |