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

Side by Side Diff: src/core/SkBitmapProcState.cpp

Issue 1775963002: Bilerp + mirror + perspective (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments. Created 4 years, 9 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
« no previous file with comments | « src/core/SkBitmapProcState.h ('k') | src/core/SkLinearBitmapPipeline.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 "SkBitmapCache.h" 8 #include "SkBitmapCache.h"
9 #include "SkBitmapController.h" 9 #include "SkBitmapController.h"
10 #include "SkBitmapProcState.h" 10 #include "SkBitmapProcState.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 SkDefaultBitmapController controller; 132 SkDefaultBitmapController controller;
133 fBMState = controller.requestBitmap(fProvider, inv, paint.getFilterQuality() , 133 fBMState = controller.requestBitmap(fProvider, inv, paint.getFilterQuality() ,
134 fBMStateStorage.get(), fBMStateStorage.s ize()); 134 fBMStateStorage.get(), fBMStateStorage.s ize());
135 // Note : we allow the controller to return an empty (zero-dimension) result . Should we? 135 // Note : we allow the controller to return an empty (zero-dimension) result . Should we?
136 if (nullptr == fBMState || fBMState->pixmap().info().isEmpty()) { 136 if (nullptr == fBMState || fBMState->pixmap().info().isEmpty()) {
137 return false; 137 return false;
138 } 138 }
139 fPixmap = fBMState->pixmap(); 139 fPixmap = fBMState->pixmap();
140 fInvMatrix = fBMState->invMatrix(); 140 fInvMatrix = fBMState->invMatrix();
141 fRealInvMatrix = fBMState->invMatrix();
141 fPaintColor = paint.getColor(); 142 fPaintColor = paint.getColor();
142 fFilterQuality = fBMState->quality(); 143 fFilterQuality = fBMState->quality();
143 SkASSERT(fPixmap.addr()); 144 SkASSERT(fPixmap.addr());
144 145
145 bool trivialMatrix = (fInvMatrix.getType() & ~SkMatrix::kTranslate_Mask) == 0; 146 bool trivialMatrix = (fInvMatrix.getType() & ~SkMatrix::kTranslate_Mask) == 0;
146 bool clampClamp = SkShader::kClamp_TileMode == fTileModeX && 147 bool clampClamp = SkShader::kClamp_TileMode == fTileModeX &&
147 SkShader::kClamp_TileMode == fTileModeY; 148 SkShader::kClamp_TileMode == fTileModeY;
148 149
149 // Most of the scanline procs deal with "unit" texture coordinates, as this 150 // Most of the scanline procs deal with "unit" texture coordinates, as this
150 // makes it easy to perform tiling modes (repeat = (x & 0xFFFF)). To generat e 151 // makes it easy to perform tiling modes (repeat = (x & 0xFFFF)). To generat e
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 if (kLow_SkFilterQuality == fFilterQuality && allow_ignore_fractional_transl ate) { 192 if (kLow_SkFilterQuality == fFilterQuality && allow_ignore_fractional_transl ate) {
192 // Only try bilerp if the matrix is "interesting" and 193 // Only try bilerp if the matrix is "interesting" and
193 // the image has a suitable size. 194 // the image has a suitable size.
194 195
195 if (fInvType <= SkMatrix::kTranslate_Mask || 196 if (fInvType <= SkMatrix::kTranslate_Mask ||
196 !valid_for_filtering(fPixmap.width() | fPixmap.height())) 197 !valid_for_filtering(fPixmap.width() | fPixmap.height()))
197 { 198 {
198 fFilterQuality = kNone_SkFilterQuality; 199 fFilterQuality = kNone_SkFilterQuality;
199 } 200 }
200 } 201 }
201 202
202 return true; 203 return true;
203 } 204 }
204 205
205 /* 206 /*
206 * Analyze filter-quality and matrix, and decide how to implement that. 207 * Analyze filter-quality and matrix, and decide how to implement that.
207 * 208 *
208 * In general, we cascade down the request level [ High ... None ] 209 * In general, we cascade down the request level [ High ... None ]
209 * - for a given level, if we can fulfill it, fine, else 210 * - for a given level, if we can fulfill it, fine, else
210 * - else we downgrade to the next lower level and try again. 211 * - else we downgrade to the next lower level and try again.
211 * We can always fulfill requests for Low and None 212 * We can always fulfill requests for Low and None
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 SI8_alpha_D32_filter_DX, 326 SI8_alpha_D32_filter_DX,
326 327
327 S4444_opaque_D32_nofilter_DXDY, 328 S4444_opaque_D32_nofilter_DXDY,
328 S4444_alpha_D32_nofilter_DXDY, 329 S4444_alpha_D32_nofilter_DXDY,
329 S4444_opaque_D32_nofilter_DX, 330 S4444_opaque_D32_nofilter_DX,
330 S4444_alpha_D32_nofilter_DX, 331 S4444_alpha_D32_nofilter_DX,
331 S4444_opaque_D32_filter_DXDY, 332 S4444_opaque_D32_filter_DXDY,
332 S4444_alpha_D32_filter_DXDY, 333 S4444_alpha_D32_filter_DXDY,
333 S4444_opaque_D32_filter_DX, 334 S4444_opaque_D32_filter_DX,
334 S4444_alpha_D32_filter_DX, 335 S4444_alpha_D32_filter_DX,
335 336
336 // A8 treats alpha/opaque the same (equally efficient) 337 // A8 treats alpha/opaque the same (equally efficient)
337 SA8_alpha_D32_nofilter_DXDY, 338 SA8_alpha_D32_nofilter_DXDY,
338 SA8_alpha_D32_nofilter_DXDY, 339 SA8_alpha_D32_nofilter_DXDY,
339 SA8_alpha_D32_nofilter_DX, 340 SA8_alpha_D32_nofilter_DX,
340 SA8_alpha_D32_nofilter_DX, 341 SA8_alpha_D32_nofilter_DX,
341 SA8_alpha_D32_filter_DXDY, 342 SA8_alpha_D32_filter_DXDY,
342 SA8_alpha_D32_filter_DXDY, 343 SA8_alpha_D32_filter_DXDY,
343 SA8_alpha_D32_filter_DX, 344 SA8_alpha_D32_filter_DX,
344 SA8_alpha_D32_filter_DX, 345 SA8_alpha_D32_filter_DX,
345 346
346 // todo: possibly specialize on opaqueness 347 // todo: possibly specialize on opaqueness
347 SG8_alpha_D32_nofilter_DXDY, 348 SG8_alpha_D32_nofilter_DXDY,
348 SG8_alpha_D32_nofilter_DXDY, 349 SG8_alpha_D32_nofilter_DXDY,
349 SG8_alpha_D32_nofilter_DX, 350 SG8_alpha_D32_nofilter_DX,
350 SG8_alpha_D32_nofilter_DX, 351 SG8_alpha_D32_nofilter_DX,
351 SG8_alpha_D32_filter_DXDY, 352 SG8_alpha_D32_filter_DXDY,
352 SG8_alpha_D32_filter_DXDY, 353 SG8_alpha_D32_filter_DXDY,
353 SG8_alpha_D32_filter_DX, 354 SG8_alpha_D32_filter_DX,
354 SG8_alpha_D32_filter_DX 355 SG8_alpha_D32_filter_DX
355 }; 356 };
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 fx += dx; 818 fx += dx;
818 } 819 }
819 } else { 820 } else {
820 for (int i = 0; i < count; ++i) { 821 for (int i = 0; i < count; ++i) {
821 dst[i] = src[SkClampMax(SkFractionalIntToInt(fx), maxX)]; 822 dst[i] = src[SkClampMax(SkFractionalIntToInt(fx), maxX)];
822 fx += dx; 823 fx += dx;
823 } 824 }
824 } 825 }
825 } 826 }
826 827
OLDNEW
« no previous file with comments | « src/core/SkBitmapProcState.h ('k') | src/core/SkLinearBitmapPipeline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698