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

Side by Side Diff: src/core/SkLinearBitmapPipeline_tile.h

Issue 1886233006: Add 8888 fast SrcOver mode. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Addresss mtk's review. Created 4 years, 7 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/SkLinearBitmapPipeline_core.h ('k') | no next file » | 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 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 #ifndef SkLinearBitmapPipeline_tile_DEFINED 8 #ifndef SkLinearBitmapPipeline_tile_DEFINED
9 #define SkLinearBitmapPipeline_tile_DEFINED 9 #define SkLinearBitmapPipeline_tile_DEFINED
10 10
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 // Note: The span length has an unintuitive relation to the tile width. The tile width is 291 // Note: The span length has an unintuitive relation to the tile width. The tile width is
292 // a half open interval [tb, te), but the span is a closed interval [sb, se]. In order to 292 // a half open interval [tb, te), but the span is a closed interval [sb, se]. In order to
293 // compare the two, you need to convert the span to a half open interval . This is done by 293 // compare the two, you need to convert the span to a half open interval . This is done by
294 // adding dx to se. So, the span becomes: [sb, se + dx). Hence the + 1.0 f below. 294 // adding dx to se. So, the span becomes: [sb, se + dx). Hence the + 1.0 f below.
295 SkScalar div = (span.length() + 1.0f) / fXMax; 295 SkScalar div = (span.length() + 1.0f) / fXMax;
296 int32_t repeatCount = SkScalarFloorToInt(div); 296 int32_t repeatCount = SkScalarFloorToInt(div);
297 Span repeatableSpan{{0.0f, y}, fXMax - 1.0f, SkScalarFloorToInt(fXMax)}; 297 Span repeatableSpan{{0.0f, y}, fXMax - 1.0f, SkScalarFloorToInt(fXMax)};
298 298
299 // Repeat the center section. 299 // Repeat the center section.
300 SkASSERT(0.0f <= repeatableSpan.startX() && repeatableSpan.endX() < fXMa x); 300 SkASSERT(0.0f <= repeatableSpan.startX() && repeatableSpan.endX() < fXMa x);
301 next->repeatSpan(repeatableSpan, repeatCount); 301 if (repeatCount > 0) {
302 next->repeatSpan(repeatableSpan, repeatCount);
303 }
302 304
303 // Calculate the advance past the center portion. 305 // Calculate the advance past the center portion.
304 SkScalar advance = SkScalar(repeatCount) * fXMax; 306 SkScalar advance = SkScalar(repeatCount) * fXMax;
305 307
306 // There may be some of the span left over. 308 // There may be some of the span left over.
307 span.breakAt(advance, 1.0f); 309 span.breakAt(advance, 1.0f);
308 310
309 // All on a single tile. 311 // All on a single tile.
310 if (!span.isEmpty()) { 312 if (!span.isEmpty()) {
311 span.offset(-advance); 313 span.offset(-advance);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 415
414 private: 416 private:
415 SkScalar fYMax; 417 SkScalar fYMax;
416 Sk4f fYsMax; 418 Sk4f fYsMax;
417 Sk4f fYsCap; 419 Sk4f fYsCap;
418 Sk4f fYsDoubleInvMax; 420 Sk4f fYsDoubleInvMax;
419 }; 421 };
420 422
421 } // namespace 423 } // namespace
422 #endif // SkLinearBitmapPipeline_tile_DEFINED 424 #endif // SkLinearBitmapPipeline_tile_DEFINED
OLDNEW
« no previous file with comments | « src/core/SkLinearBitmapPipeline_core.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698