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

Side by Side Diff: gm/SkLinearBitmapPipelineGM.cpp

Issue 1705203002: Add bilerp filtering. (Closed) Base URL: https://skia.googlesource.com/skia.git@fp-simple-linear-20160217
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
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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColor.h" 10 #include "SkColor.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 SkPixmap pmdst; 97 SkPixmap pmdst;
98 bmdst.peekPixels(&pmdst); 98 bmdst.peekPixels(&pmdst);
99 99
100 SkPM4f* dstBits = new SkPM4f[ir.width()]; 100 SkPM4f* dstBits = new SkPM4f[ir.width()];
101 SkImageInfo info = SkImageInfo::MakeN32(ir.width(), ir.height(), kPremul_SkA lphaType); 101 SkImageInfo info = SkImageInfo::MakeN32(ir.width(), ir.height(), kPremul_SkA lphaType);
102 102
103 SkMatrix inv; 103 SkMatrix inv;
104 bool trash = mat->invert(&inv); 104 bool trash = mat->invert(&inv);
105 sk_ignore_unused_variable(trash); 105 sk_ignore_unused_variable(trash);
106 106
107 SkFilterQuality filterQuality;
108 if (useBilerp) {
109 filterQuality = SkFilterQuality::kLow_SkFilterQuality;
110 } else {
111 filterQuality = SkFilterQuality::kNone_SkFilterQuality;
112 }
113
107 uint32_t flags = 0; 114 uint32_t flags = 0;
108 //if (kSRGB_SkColorProfileType == profile) { 115 //if (kSRGB_SkColorProfileType == profile) {
109 //flags |= SkXfermode::kDstIsSRGB_PM4fFlag; 116 //flags |= SkXfermode::kDstIsSRGB_PM4fFlag;
110 //} 117 //}
111 const SkXfermode::PM4fState state { nullptr, flags }; 118 const SkXfermode::PM4fState state { nullptr, flags };
112 auto procN = SkXfermode::GetPM4fProcN(SkXfermode::kSrcOver_Mode, flags); 119 auto procN = SkXfermode::GetPM4fProcN(SkXfermode::kSrcOver_Mode, flags);
113 120
114 SkLinearBitmapPipeline pipeline{ 121 SkLinearBitmapPipeline pipeline{
115 inv, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, info, pms rc.addr32()}; 122 inv, filterQuality,
116 123 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode,
124 info, pmsrc.addr32()};
117 125
118 for (int y = 0; y < ir.height(); y++) { 126 for (int y = 0; y < ir.height(); y++) {
119 pipeline.shadeSpan4f(0, y, dstBits, ir.width()); 127 pipeline.shadeSpan4f(0, y, dstBits, ir.width());
120 procN(state, pmdst.writable_addr32(0, y), dstBits, ir.width(), nullptr); 128 procN(state, pmdst.writable_addr32(0, y), dstBits, ir.width(), nullptr);
121 } 129 }
122 130
123 delete [] dstBits; 131 delete [] dstBits;
124 132
125 canvas->drawBitmap(bmdst, r.left(), r.top(), nullptr); 133 canvas->drawBitmap(bmdst, r.left(), r.top(), nullptr);
126 } 134 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 } 190 }
183 canvas->restore(); 191 canvas->restore();
184 canvas->translate(0, H + 20); 192 canvas->translate(0, H + 20);
185 } 193 }
186 canvas->restore(); 194 canvas->restore();
187 canvas->translate(0, (H + 20) * SK_ARRAY_COUNT(mats)); 195 canvas->translate(0, (H + 20) * SK_ARRAY_COUNT(mats));
188 if (useBilerp) break; 196 if (useBilerp) break;
189 useBilerp = true; 197 useBilerp = true;
190 } 198 }
191 } 199 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698