diff options
-rw-r--r-- | chrome/browser/fav_icon_helper.cc | 6 | ||||
-rw-r--r-- | chrome/browser/importer/importer.cc | 5 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_renderer.cc | 6 | ||||
-rw-r--r-- | chrome/common/gfx/icon_util.cc | 6 | ||||
-rw-r--r-- | chrome/renderer/render_view.cc | 4 | ||||
-rw-r--r-- | chrome/views/button.cc | 2 | ||||
-rw-r--r-- | skia/ext/convolver.cc | 57 | ||||
-rw-r--r-- | skia/ext/convolver.h | 24 | ||||
-rw-r--r-- | skia/ext/convolver_unittest.cc | 4 | ||||
-rw-r--r-- | skia/ext/image_operations.cc | 63 | ||||
-rw-r--r-- | skia/ext/image_operations.h | 12 | ||||
-rw-r--r-- | skia/ext/image_operations_unittest.cc | 14 | ||||
-rw-r--r-- | webkit/port/platform/graphics/skia/ImageSkia.cpp | 14 | ||||
-rw-r--r-- | webkit/port/platform/graphics/skia/NativeImageSkia.cpp | 4 |
14 files changed, 112 insertions, 109 deletions
diff --git a/chrome/browser/fav_icon_helper.cc b/chrome/browser/fav_icon_helper.cc index a2c23e4..63f39e3 100644 --- a/chrome/browser/fav_icon_helper.cc +++ b/chrome/browser/fav_icon_helper.cc @@ -257,9 +257,9 @@ SkBitmap FavIconHelper::ConvertToFavIconSize(const SkBitmap& image) { int height = image.height(); if (width > 0 && height > 0) { calc_favicon_target_size(&width, &height); - return gfx::ImageOperations::Resize( - image, gfx::ImageOperations::RESIZE_LANCZOS3, - gfx::Size(width, height)); + return skia::ImageOperations::Resize( + image, skia::ImageOperations::RESIZE_LANCZOS3, + width, height); } return image; } diff --git a/chrome/browser/importer/importer.cc b/chrome/browser/importer/importer.cc index f29b292..dcc1438 100644 --- a/chrome/browser/importer/importer.cc +++ b/chrome/browser/importer/importer.cc @@ -384,9 +384,8 @@ bool Importer::ReencodeFavicon(const unsigned char* src_data, size_t src_len, int new_width = decoded.width(); int new_height = decoded.height(); calc_favicon_target_size(&new_width, &new_height); - decoded = gfx::ImageOperations::Resize( - decoded, gfx::ImageOperations::RESIZE_LANCZOS3, - gfx::Size(new_width, new_height)); + decoded = skia::ImageOperations::Resize( + decoded, skia::ImageOperations::RESIZE_LANCZOS3, new_width, new_height); } // Encode our bitmap as a PNG. diff --git a/chrome/browser/views/tabs/tab_renderer.cc b/chrome/browser/views/tabs/tab_renderer.cc index 6026b9e..4581f6d 100644 --- a/chrome/browser/views/tabs/tab_renderer.cc +++ b/chrome/browser/views/tabs/tab_renderer.cc @@ -586,13 +586,13 @@ void TabRenderer::PaintActiveTabBackground(ChromeCanvas* canvas) { void TabRenderer::PaintHoverTabBackground(ChromeCanvas* canvas, double opacity) { bool is_otr = data_.off_the_record; - SkBitmap left = gfx::ImageOperations::CreateBlendedBitmap( + SkBitmap left = skia::ImageOperations::CreateBlendedBitmap( (is_otr ? *tab_inactive_otr_l : *tab_inactive_l), *tab_hover_l, opacity); - SkBitmap center = gfx::ImageOperations::CreateBlendedBitmap( + SkBitmap center = skia::ImageOperations::CreateBlendedBitmap( (is_otr ? *tab_inactive_otr_c : *tab_inactive_c), *tab_hover_c, opacity); - SkBitmap right = gfx::ImageOperations::CreateBlendedBitmap( + SkBitmap right = skia::ImageOperations::CreateBlendedBitmap( (is_otr ? *tab_inactive_otr_r : *tab_inactive_r), *tab_hover_r, opacity); diff --git a/chrome/common/gfx/icon_util.cc b/chrome/common/gfx/icon_util.cc index 58c8020..b3b56a2 100644 --- a/chrome/common/gfx/icon_util.cc +++ b/chrome/common/gfx/icon_util.cc @@ -403,9 +403,9 @@ void IconUtil::CreateResizedBitmapSet(const SkBitmap& bitmap_to_resize, inserted_original_bitmap = true; } } - bitmaps->push_back(gfx::ImageOperations::Resize( - bitmap_to_resize, gfx::ImageOperations::RESIZE_LANCZOS3, - gfx::Size(icon_dimensions_[i], icon_dimensions_[i]))); + bitmaps->push_back(skia::ImageOperations::Resize( + bitmap_to_resize, skia::ImageOperations::RESIZE_LANCZOS3, + icon_dimensions_[i], icon_dimensions_[i])); } if (!inserted_original_bitmap) { diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index ec4fec0..4b00d9b 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -798,8 +798,8 @@ bool RenderView::CaptureThumbnail(WebFrame* frame, device->accessBitmap(false).extractSubset(&subset, src_rect); // Resample the subset that we want to get it the right size. - *thumbnail = gfx::ImageOperations::Resize( - subset, gfx::ImageOperations::RESIZE_LANCZOS3, gfx::Size(w, h)); + *thumbnail = skia::ImageOperations::Resize( + subset, skia::ImageOperations::RESIZE_LANCZOS3, w, h); score->boring_score = CalculateBoringScore(thumbnail); diff --git a/chrome/views/button.cc b/chrome/views/button.cc index 11dad29..36c228a 100644 --- a/chrome/views/button.cc +++ b/chrome/views/button.cc @@ -105,7 +105,7 @@ SkBitmap Button::GetImageToPaint() { SkBitmap img; if (!images_[BS_HOT].isNull() && hover_animation_->IsAnimating()) { - img = gfx::ImageOperations::CreateBlendedBitmap(images_[BS_NORMAL], + img = skia::ImageOperations::CreateBlendedBitmap(images_[BS_NORMAL], images_[BS_HOT], hover_animation_->GetCurrentValue()); } else { img = images_[GetState()]; diff --git a/skia/ext/convolver.cc b/skia/ext/convolver.cc index f5a429a..930f9e5 100644 --- a/skia/ext/convolver.cc +++ b/skia/ext/convolver.cc @@ -4,18 +4,17 @@ #include <algorithm> -#include "base/basictypes.h" -#include "base/logging.h" #include "skia/ext/convolver.h" +#include "SkTypes.h" -namespace gfx { +namespace skia { namespace { // Converts the argument to an 8-bit unsigned value by clamping to the range // 0-255. -inline uint8 ClampTo8(int32 a) { - if (static_cast<uint32>(a) < 256) +inline unsigned char ClampTo8(int a) { + if (static_cast<unsigned>(a) < 256) return a; // Avoid the extra check in the common case. if (a < 0) return 0; @@ -45,8 +44,8 @@ class CircularRowBuffer { // Moves to the next row in the buffer, returning a pointer to the beginning // of it. - uint8* AdvanceRow() { - uint8* row = &buffer_[next_row_ * row_byte_width_]; + unsigned char* AdvanceRow() { + unsigned char* row = &buffer_[next_row_ * row_byte_width_]; next_row_coordinate_++; // Set the pointer to the next row to use, wrapping around if necessary. @@ -62,7 +61,7 @@ class CircularRowBuffer { // // The |first_row_index_| may be negative. This means the circular buffer // starts before the top of the image (it hasn't been filled yet). - uint8* const* GetRowAddresses(int* first_row_index) { + unsigned char* const* GetRowAddresses(int* first_row_index) { // Example for a 4-element circular buffer holding coords 6-9. // Row 0 Coord 8 // Row 1 Coord 9 @@ -89,7 +88,7 @@ class CircularRowBuffer { private: // The buffer storing the rows. They are packed, each one row_byte_width_. - std::vector<uint8> buffer_; + std::vector<unsigned char> buffer_; // Number of bytes per row in the |buffer_|. int row_byte_width_; @@ -106,13 +105,13 @@ class CircularRowBuffer { int next_row_coordinate_; // Buffer used by GetRowAddresses(). - std::vector<uint8*> row_addresses_; + std::vector<unsigned char*> row_addresses_; }; // Convolves horizontally along a single row. The row data is given in // |src_data| and continues for the num_values() of the filter. template<bool has_alpha> -void ConvolveHorizontally(const uint8* src_data, +void ConvolveHorizontally(const unsigned char* src_data, const ConvolusionFilter1D& filter, unsigned char* out_row) { // Loop over each pixel on this row in the output image. @@ -120,17 +119,17 @@ void ConvolveHorizontally(const uint8* src_data, for (int out_x = 0; out_x < num_values; out_x++) { // Get the filter that determines the current output pixel. int filter_offset, filter_length; - const int16* filter_values = + const ConvolusionFilter1D::Fixed* filter_values = filter.FilterForValue(out_x, &filter_offset, &filter_length); // Compute the first pixel in this row that the filter affects. It will // touch |filter_length| pixels (4 bytes each) after this. - const uint8* row_to_filter = &src_data[filter_offset * 4]; + const unsigned char* row_to_filter = &src_data[filter_offset * 4]; // Apply the filter to the row to get the destination pixel in |accum|. int32 accum[4] = {0}; for (int filter_x = 0; filter_x < filter_length; filter_x++) { - int16 cur_filter = filter_values[filter_x]; + ConvolusionFilter1D::Fixed cur_filter = filter_values[filter_x]; accum[0] += cur_filter * row_to_filter[filter_x * 4 + 0]; accum[1] += cur_filter * row_to_filter[filter_x * 4 + 1]; accum[2] += cur_filter * row_to_filter[filter_x * 4 + 2]; @@ -162,11 +161,11 @@ void ConvolveHorizontally(const uint8* src_data, // // The output must have room for |pixel_width * 4| bytes. template<bool has_alpha> -void ConvolveVertically(const int16* filter_values, +void ConvolveVertically(const ConvolusionFilter1D::Fixed* filter_values, int filter_length, - uint8* const* source_data_rows, + unsigned char* const* source_data_rows, int pixel_width, - uint8* out_row) { + unsigned char* out_row) { // We go through each column in the output and do a vertical convolusion, // generating one output pixel each time. for (int out_x = 0; out_x < pixel_width; out_x++) { @@ -177,7 +176,7 @@ void ConvolveVertically(const int16* filter_values, // Apply the filter to one column of pixels. int32 accum[4] = {0}; for (int filter_y = 0; filter_y < filter_length; filter_y++) { - int16 cur_filter = filter_values[filter_y]; + ConvolusionFilter1D::Fixed cur_filter = filter_values[filter_y]; accum[0] += cur_filter * source_data_rows[filter_y][byte_offset + 0]; accum[1] += cur_filter * source_data_rows[filter_y][byte_offset + 1]; accum[2] += cur_filter * source_data_rows[filter_y][byte_offset + 2]; @@ -198,7 +197,7 @@ void ConvolveVertically(const int16* filter_values, out_row[byte_offset + 1] = ClampTo8(accum[1]); out_row[byte_offset + 2] = ClampTo8(accum[2]); if (has_alpha) { - uint8 alpha = ClampTo8(accum[3]); + unsigned char alpha = ClampTo8(accum[3]); // Make sure the alpha channel doesn't come out larger than any of the // color channels. We use premultipled alpha channels, so this should @@ -233,7 +232,7 @@ void ConvolusionFilter1D::AddFilter(int filter_offset, instance.length = filter_length; filters_.push_back(instance); - DCHECK(filter_length > 0); + SkASSERT(filter_length > 0); for (int i = 0; i < filter_length; i++) filter_values_.push_back(FloatToFixed(filter_values[i])); @@ -241,7 +240,7 @@ void ConvolusionFilter1D::AddFilter(int filter_offset, } void ConvolusionFilter1D::AddFilter(int filter_offset, - const int16* filter_values, + const Fixed* filter_values, int filter_length) { FilterInstance instance; instance.data_location = static_cast<int>(filter_values_.size()); @@ -249,7 +248,7 @@ void ConvolusionFilter1D::AddFilter(int filter_offset, instance.length = filter_length; filters_.push_back(instance); - DCHECK(filter_length > 0); + SkASSERT(filter_length > 0); for (int i = 0; i < filter_length; i++) filter_values_.push_back(filter_values[i]); @@ -258,12 +257,12 @@ void ConvolusionFilter1D::AddFilter(int filter_offset, // BGRAConvolve2D ------------------------------------------------------------- -void BGRAConvolve2D(const uint8* source_data, +void BGRAConvolve2D(const unsigned char* source_data, int source_byte_row_stride, bool source_has_alpha, const ConvolusionFilter1D& filter_x, const ConvolusionFilter1D& filter_y, - uint8* output) { + unsigned char* output) { int max_y_filter_size = filter_y.max_filter(); // The next row in the input that we will generate a horizontally @@ -272,7 +271,7 @@ void BGRAConvolve2D(const uint8* source_data, // don't want to generate any output rows before that. Compute the starting // row for convolusion as the first pixel for the first vertical filter. int filter_offset, filter_length; - const int16* filter_values = + const ConvolusionFilter1D::Fixed* filter_values = filter_y.FilterForValue(0, &filter_offset, &filter_length); int next_x_row = filter_offset; @@ -307,16 +306,16 @@ void BGRAConvolve2D(const uint8* source_data, } // Compute where in the output image this row of final data will go. - uint8* cur_output_row = &output[out_y * output_row_byte_width]; + unsigned char* cur_output_row = &output[out_y * output_row_byte_width]; // Get the list of rows that the circular buffer has, in order. int first_row_in_circular_buffer; - uint8* const* rows_to_convolve = + unsigned char* const* rows_to_convolve = row_buffer.GetRowAddresses(&first_row_in_circular_buffer); // Now compute the start of the subset of those rows that the filter // needs. - uint8* const* first_row_for_filter = + unsigned char* const* first_row_for_filter = &rows_to_convolve[filter_offset - first_row_in_circular_buffer]; if (source_has_alpha) { @@ -331,5 +330,5 @@ void BGRAConvolve2D(const uint8* source_data, } } -} // namespace gfx +} // namespace skia diff --git a/skia/ext/convolver.h b/skia/ext/convolver.h index 3ae84cd..225a17d 100644 --- a/skia/ext/convolver.h +++ b/skia/ext/convolver.h @@ -10,11 +10,11 @@ #include "base/basictypes.h" // avoid confusion with Mac OS X's math library (Carbon) -#if defined(OS_MACOSX) +#if defined(__APPLE__) #undef FloatToFixed #endif -namespace gfx { +namespace skia { // Represents a filter in one dimension. Each output pixel has one entry in this // object for the filter values contributing to it. You build up the filter @@ -29,14 +29,16 @@ class ConvolusionFilter1D { // The number of bits that fixed point values are shifted by. enum { kShiftBits = 14 }; + typedef short Fixed; + ConvolusionFilter1D() : max_filter_(0) { } // Convert between floating point and our fixed point representation. - static inline int16 FloatToFixed(float f) { - return static_cast<int16>(f * (1 << kShiftBits)); + static Fixed FloatToFixed(float f) { + return static_cast<Fixed>(f * (1 << kShiftBits)); } - static inline unsigned char FixedToChar(int16 x) { + static unsigned char FixedToChar(Fixed x) { return static_cast<unsigned char>(x >> kShiftBits); } @@ -65,7 +67,7 @@ class ConvolusionFilter1D { // Same as the above version, but the input is already fixed point. void AddFilter(int filter_offset, - const int16* filter_values, + const Fixed* filter_values, int filter_length); // Retrieves a filter for the given |value_offset|, a position in the output @@ -73,7 +75,7 @@ class ConvolusionFilter1D { // filter values are put into the corresponding out arguments (see AddFilter // above for what these mean), and a pointer to the first scaling factor is // returned. There will be |filter_length| values in this array. - inline const int16* FilterForValue(int value_offset, + inline const Fixed* FilterForValue(int value_offset, int* filter_offset, int* filter_length) const { const FilterInstance& filter = filters_[value_offset]; @@ -100,7 +102,7 @@ class ConvolusionFilter1D { // We store all the filter values in this flat list, indexed by // |FilterInstance.data_location| to avoid the mallocs required for storing // each one separately. - std::vector<int16> filter_values_; + std::vector<Fixed> filter_values_; // The maximum size of any filter we've added. int max_filter_; @@ -124,14 +126,14 @@ class ConvolusionFilter1D { // // The layout in memory is assumed to be 4-bytes per pixel in B-G-R-A order // (this is ARGB when loaded into 32-bit words on a little-endian machine). -void BGRAConvolve2D(const uint8* source_data, +void BGRAConvolve2D(const unsigned char* source_data, int source_byte_row_stride, bool source_has_alpha, const ConvolusionFilter1D& xfilter, const ConvolusionFilter1D& yfilter, - uint8* output); + unsigned char* output); -} // namespace gfx +} // namespace skia #endif // SKIA_EXT_CONVOLVER_H_ diff --git a/skia/ext/convolver_unittest.cc b/skia/ext/convolver_unittest.cc index 6f85552..f93b2e5 100644 --- a/skia/ext/convolver_unittest.cc +++ b/skia/ext/convolver_unittest.cc @@ -9,12 +9,12 @@ #include "skia/ext/convolver.h" #include "testing/gtest/include/gtest/gtest.h" -namespace gfx { +namespace skia { namespace { // Fills the given filter with impulse functions for the range 0->num_entries. - void FillImpulseFilter(int num_entries, ConvolusionFilter1D* filter) { +void FillImpulseFilter(int num_entries, ConvolusionFilter1D* filter) { float one = 1.0f; for (int i = 0; i < num_entries; i++) filter->AddFilter(i, &one, 1); diff --git a/skia/ext/image_operations.cc b/skia/ext/image_operations.cc index 5e6c3ab..4a1438b 100644 --- a/skia/ext/image_operations.cc +++ b/skia/ext/image_operations.cc @@ -16,7 +16,10 @@ #include "SkBitmap.h" #include "skia/ext/convolver.h" -namespace gfx { +namespace skia { + +// TODO(brettw) remove this and put this file in the skia namespace. +using namespace gfx; namespace { @@ -62,13 +65,13 @@ float EvalLanczos(int filter_size, float x) { class ResizeFilter { public: ResizeFilter(ImageOperations::ResizeMethod method, - const Size& src_full_size, - const Size& dest_size, - const Rect& dest_subset); + int src_full_width, int src_full_height, + int dest_width, int dest_height, + const gfx::Rect& dest_subset); // Returns the bounds in the input bitmap of data that is used in the output. // The filter offsets are within this rectangle. - const Rect& src_depend() { return src_depend_; } + const gfx::Rect& src_depend() { return src_depend_; } // Returns the filled filter values. const ConvolusionFilter1D& x_filter() { return x_filter_; } @@ -123,7 +126,7 @@ class ResizeFilter { ImageOperations::ResizeMethod method_; // Subset of source the filters will touch. - Rect src_depend_; + gfx::Rect src_depend_; // Size of the filter support on one side only in the destination space. // See GetFilterSupport. @@ -131,7 +134,7 @@ class ResizeFilter { float y_filter_support_; // Subset of scaled destination bitmap to compute. - Rect out_bounds_; + gfx::Rect out_bounds_; ConvolusionFilter1D x_filter_; ConvolusionFilter1D y_filter_; @@ -140,31 +143,31 @@ class ResizeFilter { }; ResizeFilter::ResizeFilter(ImageOperations::ResizeMethod method, - const Size& src_full_size, - const Size& dest_size, - const Rect& dest_subset) + int src_full_width, int src_full_height, + int dest_width, int dest_height, + const gfx::Rect& dest_subset) : method_(method), out_bounds_(dest_subset) { - float scale_x = static_cast<float>(dest_size.width()) / - static_cast<float>(src_full_size.width()); - float scale_y = static_cast<float>(dest_size.height()) / - static_cast<float>(src_full_size.height()); + float scale_x = static_cast<float>(dest_width) / + static_cast<float>(src_full_width); + float scale_y = static_cast<float>(dest_height) / + static_cast<float>(src_full_height); x_filter_support_ = GetFilterSupport(scale_x); y_filter_support_ = GetFilterSupport(scale_y); - gfx::Rect src_full(0, 0, src_full_size.width(), src_full_size.height()); + gfx::Rect src_full(0, 0, src_full_width, src_full_height); gfx::Rect dest_full(0, 0, - static_cast<int>(src_full_size.width() * scale_x + 0.5), - static_cast<int>(src_full_size.height() * scale_y + 0.5)); + static_cast<int>(src_full_width * scale_x + 0.5), + static_cast<int>(src_full_height * scale_y + 0.5)); // Support of the filter in source space. float src_x_support = x_filter_support_ / scale_x; float src_y_support = y_filter_support_ / scale_y; - ComputeFilters(src_full_size.width(), dest_subset.x(), dest_subset.width(), + ComputeFilters(src_full_width, dest_subset.x(), dest_subset.width(), scale_x, src_x_support, &x_filter_); - ComputeFilters(src_full_size.height(), dest_subset.y(), dest_subset.height(), + ComputeFilters(src_full_height, dest_subset.y(), dest_subset.height(), scale_y, src_y_support, &y_filter_); } @@ -254,21 +257,21 @@ void ResizeFilter::ComputeFilters(int src_size, // static SkBitmap ImageOperations::Resize(const SkBitmap& source, ResizeMethod method, - const Size& dest_size, - const Rect& dest_subset) { - DCHECK(Rect(dest_size.width(), dest_size.height()).Contains(dest_subset)) << + int dest_width, int dest_height, + const gfx::Rect& dest_subset) { + DCHECK(gfx::Rect(dest_width, dest_height).Contains(dest_subset)) << "The supplied subset does not fall within the destination image."; // If the size of source or destination is 0, i.e. 0x0, 0xN or Nx0, just // return empty if (source.width() < 1 || source.height() < 1 || - dest_size.width() < 1 || dest_size.height() < 1) - return SkBitmap(); + dest_width < 1 || dest_height < 1) + return SkBitmap(); SkAutoLockPixels locker(source); - ResizeFilter filter(method, Size(source.width(), source.height()), - dest_size, dest_subset); + ResizeFilter filter(method, source.width(), source.height(), + dest_width, dest_height, dest_subset); // Get a source bitmap encompassing this touched area. We construct the // offsets and row strides such that it looks like a new bitmap, while @@ -294,9 +297,9 @@ SkBitmap ImageOperations::Resize(const SkBitmap& source, // static SkBitmap ImageOperations::Resize(const SkBitmap& source, ResizeMethod method, - const Size& dest_size) { - Rect dest_subset(0, 0, dest_size.width(), dest_size.height()); - return Resize(source, method, dest_size, dest_subset); + int dest_width, int dest_height) { + gfx::Rect dest_subset(0, 0, dest_width, dest_height); + return Resize(source, method, dest_width, dest_height, dest_subset); } // static @@ -358,5 +361,5 @@ SkBitmap ImageOperations::CreateBlendedBitmap(const SkBitmap& first, return blended; } -} // namespace gfx +} // namespace skia diff --git a/skia/ext/image_operations.h b/skia/ext/image_operations.h index 73c6b53..5188dba 100644 --- a/skia/ext/image_operations.h +++ b/skia/ext/image_operations.h @@ -10,7 +10,7 @@ class SkBitmap; -namespace gfx { +namespace skia { class ImageOperations { public: @@ -37,14 +37,14 @@ class ImageOperations { // The destination subset must be smaller than the destination image. static SkBitmap Resize(const SkBitmap& source, ResizeMethod method, - const Size& dest_size, - const Rect& dest_subset); + int dest_width, int dest_height, + const gfx::Rect& dest_subset); // Alternate version for resizing and returning the entire bitmap rather than // a subset. static SkBitmap Resize(const SkBitmap& source, ResizeMethod method, - const Size& dest_size); + int dest_width, int dest_height); // Create a bitmap that is a blend of two others. The alpha argument @@ -57,7 +57,7 @@ class ImageOperations { ImageOperations(); // Class for scoping only. }; -} // namespace gfx +} // namespace skia -#endif // SKIA_EXT_IMAGE_OPERATIONS_H__ +#endif // SKIA_EXT_IMAGE_OPERATIONS_H_ diff --git a/skia/ext/image_operations_unittest.cc b/skia/ext/image_operations_unittest.cc index e6ecda9..1a32bfd 100644 --- a/skia/ext/image_operations_unittest.cc +++ b/skia/ext/image_operations_unittest.cc @@ -67,8 +67,8 @@ TEST(ImageOperations, Halve) { FillDataToBitmap(src_w, src_h, &src); // Do a halving of the full bitmap. - SkBitmap actual_results = gfx::ImageOperations::Resize( - src, gfx::ImageOperations::RESIZE_BOX, gfx::Size(src_w / 2, src_h / 2)); + SkBitmap actual_results = skia::ImageOperations::Resize( + src, skia::ImageOperations::RESIZE_BOX, src_w / 2, src_h / 2); ASSERT_EQ(src_w / 2, actual_results.width()); ASSERT_EQ(src_h / 2, actual_results.height()); @@ -96,17 +96,17 @@ TEST(ImageOperations, HalveSubset) { FillDataToBitmap(src_w, src_h, &src); // Do a halving of the full bitmap. - SkBitmap full_results = gfx::ImageOperations::Resize( - src, gfx::ImageOperations::RESIZE_BOX, gfx::Size(src_w / 2, src_h / 2)); + SkBitmap full_results = skia::ImageOperations::Resize( + src, skia::ImageOperations::RESIZE_BOX, src_w / 2, src_h / 2); ASSERT_EQ(src_w / 2, full_results.width()); ASSERT_EQ(src_h / 2, full_results.height()); // Now do a halving of a a subset, recall the destination subset is in the // destination coordinate system (max = half of the original image size). gfx::Rect subset_rect(2, 3, 3, 6); - SkBitmap subset_results = gfx::ImageOperations::Resize( - src, gfx::ImageOperations::RESIZE_BOX, - gfx::Size(src_w / 2, src_h / 2), subset_rect); + SkBitmap subset_results = skia::ImageOperations::Resize( + src, skia::ImageOperations::RESIZE_BOX, + src_w / 2, src_h / 2, subset_rect); ASSERT_EQ(subset_rect.width(), subset_results.width()); ASSERT_EQ(subset_rect.height(), subset_results.height()); diff --git a/webkit/port/platform/graphics/skia/ImageSkia.cpp b/webkit/port/platform/graphics/skia/ImageSkia.cpp index 4936502..4d3ee12 100644 --- a/webkit/port/platform/graphics/skia/ImageSkia.cpp +++ b/webkit/port/platform/graphics/skia/ImageSkia.cpp @@ -217,9 +217,9 @@ void drawResampledBitmap(SkCanvas& canvas, destBitmapSubsetSkI.height()); // Resample the needed part of the image. - SkBitmap resampled = gfx::ImageOperations::Resize(subset, - gfx::ImageOperations::RESIZE_LANCZOS3, - gfx::Size(destRectRounded.width(), destRectRounded.height()), + SkBitmap resampled = skia::ImageOperations::Resize(subset, + skia::ImageOperations::RESIZE_LANCZOS3, + destRectRounded.width(), destRectRounded.height(), destBitmapSubset); // Compute where the new bitmap should be drawn. Since our new bitmap @@ -350,10 +350,10 @@ void Image::drawPattern(GraphicsContext* context, if (resampling == RESAMPLE_AWESOME) { // Do nice resampling. - SkBitmap resampled = gfx::ImageOperations::Resize(src_subset, - gfx::ImageOperations::RESIZE_LANCZOS3, - gfx::Size(static_cast<int>(dest_bitmap_width), - static_cast<int>(dest_bitmap_height))); + SkBitmap resampled = skia::ImageOperations::Resize(src_subset, + skia::ImageOperations::RESIZE_LANCZOS3, + static_cast<int>(dest_bitmap_width), + static_cast<int>(dest_bitmap_height)); shader = SkShader::CreateBitmapShader( resampled, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode); diff --git a/webkit/port/platform/graphics/skia/NativeImageSkia.cpp b/webkit/port/platform/graphics/skia/NativeImageSkia.cpp index 72bbcc4..fa4ce86 100644 --- a/webkit/port/platform/graphics/skia/NativeImageSkia.cpp +++ b/webkit/port/platform/graphics/skia/NativeImageSkia.cpp @@ -61,8 +61,8 @@ bool NativeImageSkia::hasResizedBitmap(int w, int h) const { SkBitmap NativeImageSkia::resizedBitmap(int w, int h) const { if (m_resizedImage.width() != w || m_resizedImage.height() != h) { - m_resizedImage = gfx::ImageOperations::Resize(*this, - gfx::ImageOperations::RESIZE_LANCZOS3, gfx::Size(w, h)); + m_resizedImage = skia::ImageOperations::Resize(*this, + skia::ImageOperations::RESIZE_LANCZOS3, w, h); } return m_resizedImage; } |