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

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

Issue 1746093002: Fix overlooked bilerp fallback. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Simplify fallback. 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 | « no previous file | 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 #include "SkLinearBitmapPipeline.h" 8 #include "SkLinearBitmapPipeline.h"
9 #include "SkPM4f.h" 9 #include "SkPM4f.h"
10 10
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 const Sk4f kXOffsets{-0.5f, 0.5f, -0.5f, 0.5f}, 416 const Sk4f kXOffsets{-0.5f, 0.5f, -0.5f, 0.5f},
417 kYOffsets{-0.5f, -0.5f, 0.5f, 0.5f}; 417 kYOffsets{-0.5f, -0.5f, 0.5f, 0.5f};
418 fNext->bilerpList(Sk4s{xs[0]} + kXOffsets, Sk4s{ys[0]} + kYOffsets); 418 fNext->bilerpList(Sk4s{xs[0]} + kXOffsets, Sk4s{ys[0]} + kYOffsets);
419 fNext->bilerpList(Sk4s{xs[1]} + kXOffsets, Sk4s{ys[1]} + kYOffsets); 419 fNext->bilerpList(Sk4s{xs[1]} + kXOffsets, Sk4s{ys[1]} + kYOffsets);
420 fNext->bilerpList(Sk4s{xs[2]} + kXOffsets, Sk4s{ys[2]} + kYOffsets); 420 fNext->bilerpList(Sk4s{xs[2]} + kXOffsets, Sk4s{ys[2]} + kYOffsets);
421 fNext->bilerpList(Sk4s{xs[3]} + kXOffsets, Sk4s{ys[3]} + kYOffsets); 421 fNext->bilerpList(Sk4s{xs[3]} + kXOffsets, Sk4s{ys[3]} + kYOffsets);
422 } 422 }
423 423
424 void pointSpan(Span span) override { 424 void pointSpan(Span span) override {
425 SkASSERT(!span.isEmpty()); 425 SkASSERT(!span.isEmpty());
426 span_fallback(span, fNext); 426 SkPoint start; SkScalar length; int count;
427 std::tie(start, length, count) = span;
428 float dx = length / (count - 1);
429
430 Sk4f Xs = Sk4f{X(start)} + Sk4f{-0.5f, 0.5f, -0.5f, 0.5f};
431 Sk4f Ys = Sk4f{Y(start)} + Sk4f{-0.5f, -0.5f, 0.5f, 0.5f};
432
433 Sk4f dXs{dx};
434 while (count > 0) {
435 fNext->bilerpList(Xs, Ys);
436 Xs = Xs + dXs;
mtklein_C 2016/02/29 20:19:45 Xs = Xs + dx
herb_g 2016/02/29 20:57:40 Acknowledged.
437 count -= 1;
438 }
427 } 439 }
428 440
429 private: 441 private:
430 Next* const fNext; 442 Next* const fNext;
431 }; 443 };
432 444
433 static SkLinearBitmapPipeline::PointProcessorInterface* choose_filter( 445 static SkLinearBitmapPipeline::PointProcessorInterface* choose_filter(
434 SkLinearBitmapPipeline::BilerpProcessorInterface* next, 446 SkLinearBitmapPipeline::BilerpProcessorInterface* next,
435 SkFilterQuality filterQuailty, 447 SkFilterQuality filterQuailty,
436 SkLinearBitmapPipeline::FilterStage* filterProc) { 448 SkLinearBitmapPipeline::FilterStage* filterProc) {
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 946
935 void SkLinearBitmapPipeline::shadeSpan4f(int x, int y, SkPM4f* dst, int count) { 947 void SkLinearBitmapPipeline::shadeSpan4f(int x, int y, SkPM4f* dst, int count) {
936 SkASSERT(count > 0); 948 SkASSERT(count > 0);
937 fPixelStage->setDestination(dst); 949 fPixelStage->setDestination(dst);
938 // The count and length arguments start out in a precise relation in order t o keep the 950 // The count and length arguments start out in a precise relation in order t o keep the
939 // math correct through the different stages. Count is the number of pixel t o produce. 951 // math correct through the different stages. Count is the number of pixel t o produce.
940 // Since the code samples at pixel centers, length is the distance from the center of the 952 // Since the code samples at pixel centers, length is the distance from the center of the
941 // first pixel to the center of the last pixel. This implies that length is count-1. 953 // first pixel to the center of the last pixel. This implies that length is count-1.
942 fFirstStage->pointSpan(Span{SkPoint{x + 0.5f, y + 0.5f}, count - 1.0f, count }); 954 fFirstStage->pointSpan(Span{SkPoint{x + 0.5f, y + 0.5f}, count - 1.0f, count });
943 } 955 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698