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

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: Redo bilerp. 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 }
107 113
108 uint32_t flags = 0; 114 uint32_t flags = 0;
109 //if (kSRGB_SkColorProfileType == profile) { 115 //if (kSRGB_SkColorProfileType == profile) {
110 //flags |= SkXfermode::kDstIsSRGB_PM4fFlag; 116 //flags |= SkXfermode::kDstIsSRGB_PM4fFlag;
111 //} 117 //}
112 const SkXfermode::PM4fState state { nullptr, flags }; 118 const SkXfermode::PM4fState state { nullptr, flags };
113 auto procN = SkXfermode::GetPM4fProcN(SkXfermode::kSrcOver_Mode, flags); 119 auto procN = SkXfermode::GetPM4fProcN(SkXfermode::kSrcOver_Mode, flags);
114 120
115 SkLinearBitmapPipeline pipeline{ 121 SkLinearBitmapPipeline pipeline{
116 inv, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, info, pms rc.addr32()}; 122 inv, filterQuality,
117 123 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode,
124 info, pmsrc.addr32()};
118 125
119 for (int y = 0; y < ir.height(); y++) { 126 for (int y = 0; y < ir.height(); y++) {
120 pipeline.shadeSpan4f(0, y, dstBits, ir.width()); 127 pipeline.shadeSpan4f(0, y, dstBits, ir.width());
121 procN(state, pmdst.writable_addr32(0, y), dstBits, ir.width(), nullptr); 128 procN(state, pmdst.writable_addr32(0, y), dstBits, ir.width(), nullptr);
122 } 129 }
123 130
124 delete [] dstBits; 131 delete [] dstBits;
125 132
126 canvas->drawBitmap(bmdst, r.left(), r.top(), nullptr); 133 canvas->drawBitmap(bmdst, r.left(), r.top(), nullptr);
127 } 134 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 190 }
184 canvas->restore(); 191 canvas->restore();
185 canvas->translate(0, H + 20); 192 canvas->translate(0, H + 20);
186 } 193 }
187 canvas->restore(); 194 canvas->restore();
188 canvas->translate(0, (H + 20) * SK_ARRAY_COUNT(mats)); 195 canvas->translate(0, (H + 20) * SK_ARRAY_COUNT(mats));
189 if (useBilerp) break; 196 if (useBilerp) break;
190 useBilerp = true; 197 useBilerp = true;
191 } 198 }
192 } 199 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698