summaryrefslogtreecommitdiffstats
path: root/gfx/2d/image_operations.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-08-05 11:35:53 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-08-05 11:35:53 +0200
commit6bd66b1728eeddb058066edda740aaeb2ceaec23 (patch)
tree985faf01c526763515731569fa01a99f4dbef36e /gfx/2d/image_operations.cpp
parente0a8dcfed131ffa58a5e2cb1d30fe48c745c2fdc (diff)
parent559824514dc95e02fbe81f1786e6ac13ee8e9d55 (diff)
downloadUXP-6bd66b1728eeddb058066edda740aaeb2ceaec23.tar
UXP-6bd66b1728eeddb058066edda740aaeb2ceaec23.tar.gz
UXP-6bd66b1728eeddb058066edda740aaeb2ceaec23.tar.lz
UXP-6bd66b1728eeddb058066edda740aaeb2ceaec23.tar.xz
UXP-6bd66b1728eeddb058066edda740aaeb2ceaec23.zip
Merge branch 'master' into js-modules
Diffstat (limited to 'gfx/2d/image_operations.cpp')
-rw-r--r--gfx/2d/image_operations.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/gfx/2d/image_operations.cpp b/gfx/2d/image_operations.cpp
index 62215f007..79fa879d9 100644
--- a/gfx/2d/image_operations.cpp
+++ b/gfx/2d/image_operations.cpp
@@ -1,4 +1,5 @@
// Copyright (c) 2006-2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2018 Mark Straver BASc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
@@ -107,7 +108,7 @@ void ComputeFilters(ImageOperations::ResizeMethod method,
// Compute the unnormalized filter value at each location of the source
// it covers.
- float filter_sum = 0.0f; // Sub of the filter values for normalizing.
+ float filter_sum = 0.0f; // Sum of the filter values for normalizing.
for (int cur_filter_pixel = src_begin; cur_filter_pixel <= src_end;
cur_filter_pixel++) {
// Distance from the center of the filter, this is the filter coordinate
@@ -158,28 +159,22 @@ void ComputeFilters(ImageOperations::ResizeMethod method,
ImageOperations::ResizeMethod ResizeMethodToAlgorithmMethod(
ImageOperations::ResizeMethod method) {
- // Convert any "Quality Method" into an "Algorithm Method"
+ // If we already have an "Algorithm Method", just return that.
if (method >= ImageOperations::RESIZE_FIRST_ALGORITHM_METHOD &&
method <= ImageOperations::RESIZE_LAST_ALGORITHM_METHOD) {
return method;
}
- // The call to ImageOperationsGtv::Resize() above took care of
- // GPU-acceleration in the cases where it is possible. So now we just
- // pick the appropriate software method for each resize quality.
+ // Convert any "Quality Method" into an "Algorithm Method"
switch (method) {
- // Users of RESIZE_GOOD are willing to trade a lot of quality to
- // get speed, allowing the use of linear resampling to get hardware
- // acceleration (SRB). Hence any of our "good" software filters
- // will be acceptable, and we use the fastest one, Hamming-1.
case ImageOperations::RESIZE_GOOD:
- // Users of RESIZE_BETTER are willing to trade some quality in order
- // to improve performance, but are guaranteed not to devolve to a linear
- // resampling. In visual tests we see that Hamming-1 is not as good as
- // Lanczos-2, however it is about 40% faster and Lanczos-2 itself is
+ // Users of RESIZE_GOOD are willing to trade quality to get speed.
+ // In visual tests we see that Hamming-1 is not as good as
+ // Lanczos-2, however it is about 40% faster, and Lanczos-2 itself is
// about 30% faster than Lanczos-3. The use of Hamming-1 has been deemed
- // an acceptable trade-off between quality and speed.
+ // an unacceptable trade-off between quality and speed due to the limited
+ // pixel space it operates in, so we pick Lanczos-2 here.
case ImageOperations::RESIZE_BETTER:
- return ImageOperations::RESIZE_HAMMING1;
+ return ImageOperations::RESIZE_LANCZOS2;
default:
return ImageOperations::RESIZE_LANCZOS3;
}