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

Side by Side Diff: skia/ext/image_operations.h

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « skia/ext/analysis_canvas_unittest.cc ('k') | skia/ext/image_operations.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SKIA_EXT_IMAGE_OPERATIONS_H_ 5 #ifndef SKIA_EXT_IMAGE_OPERATIONS_H_
6 #define SKIA_EXT_IMAGE_OPERATIONS_H_ 6 #define SKIA_EXT_IMAGE_OPERATIONS_H_
7 7
8 #include "third_party/skia/include/core/SkBitmap.h" 8 #include "third_party/skia/include/core/SkBitmap.h"
9 #include "third_party/skia/include/core/SkTypes.h" 9 #include "third_party/skia/include/core/SkTypes.h"
10 10
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 // 2-cycle Lanczos filter. This is tall in the middle, goes negative on 73 // 2-cycle Lanczos filter. This is tall in the middle, goes negative on
74 // each side, then returns to zero. Does not provide as good a frequency 74 // each side, then returns to zero. Does not provide as good a frequency
75 // response as a 3-cycle Lanczos but is roughly 30% faster. 75 // response as a 3-cycle Lanczos but is roughly 30% faster.
76 RESIZE_LANCZOS2, 76 RESIZE_LANCZOS2,
77 77
78 // 3-cycle Lanczos filter. This is tall in the middle, goes negative on 78 // 3-cycle Lanczos filter. This is tall in the middle, goes negative on
79 // each side, then oscillates 2 more times. It gives nice sharp edges. 79 // each side, then oscillates 2 more times. It gives nice sharp edges.
80 RESIZE_LANCZOS3, 80 RESIZE_LANCZOS3,
81 81
82 // Lanczos filter + subpixel interpolation. If subpixel rendering is not
83 // appropriate we automatically fall back to Lanczos.
84 RESIZE_SUBPIXEL,
85
86 // enum aliases for first and last methods by algorithm or by quality. 82 // enum aliases for first and last methods by algorithm or by quality.
87 RESIZE_FIRST_QUALITY_METHOD = RESIZE_GOOD, 83 RESIZE_FIRST_QUALITY_METHOD = RESIZE_GOOD,
88 RESIZE_LAST_QUALITY_METHOD = RESIZE_BEST, 84 RESIZE_LAST_QUALITY_METHOD = RESIZE_BEST,
89 RESIZE_FIRST_ALGORITHM_METHOD = RESIZE_BOX, 85 RESIZE_FIRST_ALGORITHM_METHOD = RESIZE_BOX,
90 RESIZE_LAST_ALGORITHM_METHOD = RESIZE_SUBPIXEL, 86 RESIZE_LAST_ALGORITHM_METHOD = RESIZE_LANCZOS3,
91 }; 87 };
92 88
93 // Resizes the given source bitmap using the specified resize method, so that 89 // Resizes the given source bitmap using the specified resize method, so that
94 // the entire image is (dest_size) big. The dest_subset is the rectangle in 90 // the entire image is (dest_size) big. The dest_subset is the rectangle in
95 // this destination image that should actually be returned. 91 // this destination image that should actually be returned.
96 // 92 //
97 // The output image will be (dest_subset.width(), dest_subset.height()). This 93 // The output image will be (dest_subset.width(), dest_subset.height()). This
98 // will save work if you do not need the entire bitmap. 94 // will save work if you do not need the entire bitmap.
99 // 95 //
100 // The destination subset must be smaller than the destination image. 96 // The destination subset must be smaller than the destination image.
101 static SkBitmap Resize(const SkBitmap& source, 97 static SkBitmap Resize(const SkBitmap& source,
102 ResizeMethod method, 98 ResizeMethod method,
103 int dest_width, int dest_height, 99 int dest_width, int dest_height,
104 const SkIRect& dest_subset, 100 const SkIRect& dest_subset,
105 SkBitmap::Allocator* allocator = NULL); 101 SkBitmap::Allocator* allocator = NULL);
106 102
107 // Alternate version for resizing and returning the entire bitmap rather than 103 // Alternate version for resizing and returning the entire bitmap rather than
108 // a subset. 104 // a subset.
109 static SkBitmap Resize(const SkBitmap& source, 105 static SkBitmap Resize(const SkBitmap& source,
110 ResizeMethod method, 106 ResizeMethod method,
111 int dest_width, int dest_height, 107 int dest_width, int dest_height,
112 SkBitmap::Allocator* allocator = NULL); 108 SkBitmap::Allocator* allocator = NULL);
113 109
114 private: 110 private:
115 ImageOperations(); // Class for scoping only. 111 ImageOperations(); // Class for scoping only.
116
117 // Supports all methods except RESIZE_SUBPIXEL.
118 static SkBitmap ResizeBasic(const SkBitmap& source,
119 ResizeMethod method,
120 int dest_width, int dest_height,
121 const SkIRect& dest_subset,
122 SkBitmap::Allocator* allocator = NULL);
123
124 // Subpixel renderer.
125 static SkBitmap ResizeSubpixel(const SkBitmap& source,
126 int dest_width, int dest_height,
127 const SkIRect& dest_subset,
128 SkBitmap::Allocator* allocator = NULL);
129 }; 112 };
130 113
131 } // namespace skia 114 } // namespace skia
132 115
133 #endif // SKIA_EXT_IMAGE_OPERATIONS_H_ 116 #endif // SKIA_EXT_IMAGE_OPERATIONS_H_
OLDNEW
« no previous file with comments | « skia/ext/analysis_canvas_unittest.cc ('k') | skia/ext/image_operations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698