diff options
55 files changed, 331 insertions, 301 deletions
diff --git a/base/base.xcodeproj/project.pbxproj b/base/base.xcodeproj/project.pbxproj index ad7a0dd..1663719 100644 --- a/base/base.xcodeproj/project.pbxproj +++ b/base/base.xcodeproj/project.pbxproj @@ -82,6 +82,7 @@ 7B836E180E55CE5B00F6AD31 /* libicudata.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B836D970E55CE4700F6AD31 /* libicudata.a */; }; 7B8505B30E5B432200730B43 /* size.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7B8505A40E5B3FBE00730B43 /* size.cc */; }; 7B8505D30E5B43EE00730B43 /* rect_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = E45629E40E27C058005E4685 /* rect_unittest.cc */; }; + 7B8505D40E5B43FE00730B43 /* convolver_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = E48A06790E3F714300172919 /* convolver_unittest.cc */; }; 7B8505D50E5B441000730B43 /* png_codec_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = E4562A200E27C8C1005E4685 /* png_codec_unittest.cc */; }; 7B8505D90E5B445100730B43 /* libbase_gfx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 825403B10D92D2E50006B936 /* libbase_gfx.a */; }; 7B85062A0E5B556900730B43 /* libpng.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B165D5E0E55081400185273 /* libpng.a */; }; @@ -149,7 +150,10 @@ A5A0270B0E4A630D00498DA9 /* file_util_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5A0270A0E4A630D00498DA9 /* file_util_mac.mm */; }; A5CE1D2B0E55F4D800AD0606 /* file_util_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = A5A0282D0E4CFA8500498DA9 /* file_util_unittest.cc */; }; AB4C147D0EC0E3F600655FED /* time_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7BEB81490D9B0F33009BA8DD /* time_mac.cc */; }; + AB956E030E5DDB7A00BBE9D8 /* image_operations.cc in Sources */ = {isa = PBXBuildFile; fileRef = E48A06370E3F6C1F00172919 /* image_operations.cc */; }; + AB956E0A0E5DDC0900BBE9D8 /* image_operations_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = E48A063B0E3F6C3000172919 /* image_operations_unittest.cc */; }; ABE1BA2A0E7574D1009041DA /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ABE1BA290E7574D1009041DA /* ApplicationServices.framework */; }; + ABE1BA610E75757C009041DA /* skia_utils_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = ABE1BA600E75757C009041DA /* skia_utils_mac.cc */; }; ABF4B98F0DC2BA6900A6E319 /* base_paths_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABF4B98E0DC2BA6900A6E319 /* base_paths_mac.mm */; }; ABF4B99E0DC2BB6000A6E319 /* clipboard_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABF4B99D0DC2BB6000A6E319 /* clipboard_mac.mm */; }; ABF4B9AF0DC2BC6200A6E319 /* json_reader.cc in Sources */ = {isa = PBXBuildFile; fileRef = 8254031B0D92D1F40006B936 /* json_reader.cc */; }; @@ -175,6 +179,7 @@ BA73AA330E5F614B00A20026 /* condition_variable_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = BA73AA320E5F614B00A20026 /* condition_variable_unittest.cc */; }; E45062A60E40A9BE0025A81A /* base_switches.cc in Sources */ = {isa = PBXBuildFile; fileRef = 825402CB0D92D1390006B936 /* base_switches.cc */; }; E48A05F70E3F61B300172919 /* command_line.cc in Sources */ = {isa = PBXBuildFile; fileRef = E4A133490E37A41D00110AA2 /* command_line.cc */; }; + E48A06710E3F70E200172919 /* convolver.cc in Sources */ = {isa = PBXBuildFile; fileRef = E48A06680E3F70B500172919 /* convolver.cc */; }; E48FB9990EC4ED850052B72B /* process_posix.cc in Sources */ = {isa = PBXBuildFile; fileRef = E48FB9980EC4ED850052B72B /* process_posix.cc */; }; E48FB9EA0EC4F53B0052B72B /* process_util_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E48FB9E90EC4F53B0052B72B /* process_util_mac.mm */; }; E49115EF0E47B461001EE8C3 /* at_exit.cc in Sources */ = {isa = PBXBuildFile; fileRef = E49115EC0E47B461001EE8C3 /* at_exit.cc */; }; @@ -1428,11 +1433,14 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + E48A06710E3F70E200172919 /* convolver.cc in Sources */, + AB956E030E5DDB7A00BBE9D8 /* image_operations.cc in Sources */, 825403EE0D92D31D0006B936 /* png_decoder.cc in Sources */, 825403F00D92D31D0006B936 /* png_encoder.cc in Sources */, 825403F20D92D31D0006B936 /* point.cc in Sources */, 825403F50D92D31D0006B936 /* rect.cc in Sources */, 7B8505B30E5B432200730B43 /* size.cc in Sources */, + ABE1BA610E75757C009041DA /* skia_utils_mac.cc in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1445,6 +1453,7 @@ B52C916C0E9428F500208D01 /* clipboard_unittest.cc in Sources */, 7B78D38F0E54FE0100609465 /* command_line_unittest.cc in Sources */, BA73AA330E5F614B00A20026 /* condition_variable_unittest.cc in Sources */, + 7B8505D40E5B43FE00730B43 /* convolver_unittest.cc in Sources */, ABF68B2B0EB0F93E00E72835 /* field_trial_unittest.cc in Sources */, 4D11B89F0E929F0700EF7617 /* file_path_unittest.cc in Sources */, A5CE1D2B0E55F4D800AD0606 /* file_util_unittest.cc in Sources */, @@ -1452,6 +1461,7 @@ 93611B1A0E5A878400F9405D /* histogram_unittest.cc in Sources */, 7BAE392B0E6F4EF200C3F750 /* hmac_unittest.cc in Sources */, B57E4D780E9C26340090055D /* idletimer_unittest.cc in Sources */, + AB956E0A0E5DDC0900BBE9D8 /* image_operations_unittest.cc in Sources */, 7B78D3920E54FE0100609465 /* json_reader_unittest.cc in Sources */, 7B78D3930E54FE0100609465 /* json_writer_unittest.cc in Sources */, 7BF892E00E758883000BAF8A /* lazy_instance_unittest.cc in Sources */, diff --git a/base/base_unittests.scons b/base/base_unittests.scons index 1ba4ec6..d913bc8 100644 --- a/base/base_unittests.scons +++ b/base/base_unittests.scons @@ -93,6 +93,8 @@ input_files = [ 'word_iterator_unittest.cc', 'worker_pool_unittest.cc', + 'gfx/convolver_unittest.cc', + 'gfx/image_operations_unittest.cc', 'gfx/native_theme_unittest.cc', 'gfx/png_codec_unittest.cc', 'gfx/rect_unittest.cc', diff --git a/base/build/base_gfx.vcproj b/base/build/base_gfx.vcproj index 70875a9..ef4b5de 100644 --- a/base/build/base_gfx.vcproj +++ b/base/build/base_gfx.vcproj @@ -122,6 +122,14 @@ </References> <Files> <File + RelativePath="..\gfx\convolver.cc" + > + </File> + <File + RelativePath="..\gfx\convolver.h" + > + </File> + <File RelativePath="..\gfx\gdi_util.cc" > </File> @@ -130,6 +138,14 @@ > </File> <File + RelativePath="..\gfx\image_operations.cc" + > + </File> + <File + RelativePath="..\gfx\image_operations.h" + > + </File> + <File RelativePath="..\gfx\native_theme.cc" > </File> @@ -177,6 +193,14 @@ RelativePath="..\gfx\size.h" > </File> + <File + RelativePath="..\gfx\skia_utils.cc" + > + </File> + <File + RelativePath="..\gfx\skia_utils.h" + > + </File> </Files> <Globals> </Globals> diff --git a/base/build/base_unittests.vcproj b/base/build/base_unittests.vcproj index e822992..3c75166 100644 --- a/base/build/base_unittests.vcproj +++ b/base/build/base_unittests.vcproj @@ -396,6 +396,14 @@ Name="gfx_tests" > <File + RelativePath="..\gfx\convolver_unittest.cc" + > + </File> + <File + RelativePath="..\gfx\image_operations_unittest.cc" + > + </File> + <File RelativePath="..\gfx\png_codec_unittest.cc" > </File> diff --git a/base/gfx/base_gfx.scons b/base/gfx/base_gfx.scons index a69206b..7173340 100644 --- a/base/gfx/base_gfx.scons +++ b/base/gfx/base_gfx.scons @@ -25,13 +25,16 @@ if env['PLATFORM'] == 'win32': ) input_files = [ + 'convolver.cc', 'gdi_util.cc', + 'image_operations.cc', 'native_theme.cc', 'png_decoder.cc', 'png_encoder.cc', 'point.cc', 'rect.cc', 'size.cc', + 'skia_utils.cc', ] if env['PLATFORM'] in ('posix', 'darwin'): @@ -40,6 +43,7 @@ if env['PLATFORM'] in ('posix', 'darwin'): to_be_ported_files = [ 'gdi_util.cc', 'native_theme.cc', + 'skia_utils.cc', ] for remove in to_be_ported_files: input_files.remove(remove) diff --git a/skia/ext/convolver.cc b/base/gfx/convolver.cc index c854019..fd3503f 100644 --- a/skia/ext/convolver.cc +++ b/base/gfx/convolver.cc @@ -4,12 +4,11 @@ #include <algorithm> -#include "skia/ext/convolver.h" - #include "base/basictypes.h" +#include "base/gfx/convolver.h" #include "base/logging.h" -namespace skia { +namespace gfx { namespace { @@ -332,5 +331,5 @@ void BGRAConvolve2D(const uint8* source_data, } } -} // namespace skia +} // namespace gfx diff --git a/skia/ext/convolver.h b/base/gfx/convolver.h index 62c1e30..12c9228 100644 --- a/skia/ext/convolver.h +++ b/base/gfx/convolver.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef SKIA_EXT_CONVOLVER_H_ -#define SKIA_EXT_CONVOLVER_H_ +#ifndef BASE_GFX_CONVOLVER_H__ +#define BASE_GFX_CONVOLVER_H__ #include <vector> @@ -14,7 +14,7 @@ #undef FloatToFixed #endif -namespace skia { +namespace gfx { // 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 @@ -131,7 +131,7 @@ void BGRAConvolve2D(const uint8* source_data, const ConvolusionFilter1D& yfilter, uint8* output); -} // namespace skia +} // namespace gfx -#endif // SKIA_EXT_CONVOLVER_H_ +#endif // BASE_GFX_CONVOLVER_H__ diff --git a/skia/ext/convolver_unittest.cc b/base/gfx/convolver_unittest.cc index c0ae734..0a30a6b 100644 --- a/skia/ext/convolver_unittest.cc +++ b/base/gfx/convolver_unittest.cc @@ -6,11 +6,10 @@ #include <time.h> #include <vector> -#include "skia/ext/convolver.h" - +#include "base/gfx/convolver.h" #include "testing/gtest/include/gtest/gtest.h" -namespace skia { +namespace gfx { namespace { @@ -124,5 +123,5 @@ TEST(Convolver, Halve) { } } -} // namespace skia +} // namespace gfx diff --git a/skia/ext/image_operations.cc b/base/gfx/image_operations.cc index 9eab6e5..a60d19e 100644 --- a/skia/ext/image_operations.cc +++ b/base/gfx/image_operations.cc @@ -7,20 +7,16 @@ #include <limits> #include <vector> -#include "skia/ext/image_operations.h" +#include "base/gfx/image_operations.h" +#include "base/gfx/convolver.h" #include "base/gfx/rect.h" #include "base/gfx/size.h" #include "base/logging.h" #include "base/stack_container.h" -#include "skia/ext/convolver.h" #include "SkBitmap.h" -// TODO(brettw) this should be removed when the base/gfx dependencies are -// removed. -using namespace gfx; - -namespace skia { +namespace gfx { namespace { @@ -117,7 +113,7 @@ class ResizeFilter { case ImageOperations::RESIZE_BOX: return EvalBox(pos); case ImageOperations::RESIZE_LANCZOS3: - return EvalLanczos(2, pos); + return EvalLanczos(3, pos); default: NOTREACHED(); return 0; @@ -362,5 +358,5 @@ SkBitmap ImageOperations::CreateBlendedBitmap(const SkBitmap& first, return blended; } -} // namespace skia +} // namespace gfx diff --git a/skia/ext/image_operations.h b/base/gfx/image_operations.h index 60a8da7c..826e651 100644 --- a/skia/ext/image_operations.h +++ b/base/gfx/image_operations.h @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef SKIA_EXT_IMAGE_OPERATIONS_H_ -#define SKIA_EXT_IMAGE_OPERATIONS_H_ +#ifndef BASE_GFX_IMAGE_OPERATIONS_H__ +#define BASE_GFX_IMAGE_OPERATIONS_H__ #include "base/basictypes.h" #include "base/gfx/rect.h" class SkBitmap; -namespace skia { +namespace gfx { 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 gfx::Size& dest_size, - const gfx::Rect& dest_subset); + const Size& dest_size, + const 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 gfx::Size& dest_size); + const Size& dest_size); // 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 skia +} // namespace gfx -#endif // SKIA_EXT_IMAGE_OPERATIONS_H_ +#endif // BASE_GFX_IMAGE_OPERATIONS_H__ diff --git a/skia/ext/image_operations_unittest.cc b/base/gfx/image_operations_unittest.cc index 7a52d1f..a15e648 100644 --- a/skia/ext/image_operations_unittest.cc +++ b/base/gfx/image_operations_unittest.cc @@ -4,8 +4,7 @@ #include <stdlib.h> -#include "skia/ext/image_operations.h" - +#include "base/gfx/image_operations.h" #include "testing/gtest/include/gtest/gtest.h" #include "SkBitmap.h" @@ -68,8 +67,8 @@ TEST(ImageOperations, Halve) { FillDataToBitmap(src_w, src_h, &src); // Do a halving of the full bitmap. - SkBitmap actual_results = skia::ImageOperations::Resize( - src, skia::ImageOperations::RESIZE_BOX, gfx::Size(src_w / 2, src_h / 2)); + SkBitmap actual_results = gfx::ImageOperations::Resize( + src, gfx::ImageOperations::RESIZE_BOX, gfx::Size(src_w / 2, src_h / 2)); ASSERT_EQ(src_w / 2, actual_results.width()); ASSERT_EQ(src_h / 2, actual_results.height()); @@ -97,16 +96,16 @@ TEST(ImageOperations, HalveSubset) { FillDataToBitmap(src_w, src_h, &src); // Do a halving of the full bitmap. - SkBitmap full_results = skia::ImageOperations::Resize( - src, skia::ImageOperations::RESIZE_BOX, gfx::Size(src_w / 2, src_h / 2)); + SkBitmap full_results = gfx::ImageOperations::Resize( + src, gfx::ImageOperations::RESIZE_BOX, gfx::Size(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 = skia::ImageOperations::Resize( - src, skia::ImageOperations::RESIZE_BOX, + SkBitmap subset_results = gfx::ImageOperations::Resize( + src, gfx::ImageOperations::RESIZE_BOX, gfx::Size(src_w / 2, src_h / 2), subset_rect); ASSERT_EQ(subset_rect.width(), subset_results.width()); ASSERT_EQ(subset_rect.height(), subset_results.height()); @@ -133,8 +132,8 @@ TEST(ImageOperations, ResampleToSame) { // Do a resize of the full bitmap to the same size. The lanczos filter is good // enough that we should get exactly the same image for output. - SkBitmap results = skia::ImageOperations::Resize( - src, skia::ImageOperations::RESIZE_LANCZOS3, gfx::Size(src_w, src_h)); + SkBitmap results = gfx::ImageOperations::Resize( + src, gfx::ImageOperations::RESIZE_LANCZOS3, gfx::Size(src_w, src_h)); ASSERT_EQ(src_w, results.width()); ASSERT_EQ(src_h, results.height()); diff --git a/base/gfx/img_resize_perftest.cc b/base/gfx/img_resize_perftest.cc new file mode 100644 index 0000000..6a4b070 --- /dev/null +++ b/base/gfx/img_resize_perftest.cc @@ -0,0 +1,70 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <stdlib.h> +#include <time.h> + +#include "base/perftimer.h" +#include "base/gfx/convolver.h" +#include "base/gfx/image_operations.h" +#include "base/gfx/image_resizer.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace { + +void FillRandomData(char* dest, int byte_count) { + srand(static_cast<unsigned>(time(NULL))); + for (int i = 0; i < byte_count; i++) + dest[i] = rand() * 255 / RAND_MAX; +} + +} // namespace + +// Old code gives [1521, 1519]ms for this, 4000x4000 -> 2100x2100 lanczos8 + +TEST(ImageResizePerf, BigFilter) { + static const int kSrcWidth = 4000; + static const int kSrcHeight = 4000; + static const int kSrcByteSize = kSrcWidth * kSrcHeight * 4; + + SkBitmap src_bmp; + src_bmp.setConfig(SkBitmap::kARGB_8888_Config, kSrcWidth, kSrcHeight); + src_bmp.allocPixels(); + FillRandomData(reinterpret_cast<char*>(src_bmp.getAddr32(0, 0)), + kSrcByteSize); + + // Make the dest size > 1/2 so the 50% optimization doesn't kick in. + static const int kDestWidth = 1400; + static const int kDestHeight = 1400; + + PerfTimeLogger resize_timer("resize"); + gfx::ImageResizer resizer(gfx::ImageResizer::LANCZOS3); + SkBitmap dest = resizer.Resize(src_bmp, kDestWidth, kDestHeight); +} + +// The original image filter we were using took 523ms for this test, while this +// one takes 857ms. +// TODO(brettw) make this at least 64% faster. +TEST(ImageOperationPerf, BigFilter) { + static const int kSrcWidth = 4000; + static const int kSrcHeight = 4000; + static const int kSrcByteSize = kSrcWidth * kSrcHeight * 4; + + SkBitmap src_bmp; + src_bmp.setConfig(SkBitmap::kARGB_8888_Config, kSrcWidth, kSrcHeight); + src_bmp.allocPixels(); + src_bmp.setIsOpaque(true); + FillRandomData(reinterpret_cast<char*>(src_bmp.getAddr32(0, 0)), + kSrcByteSize); + + // Make the dest size > 1/2 so the 50% optimization doesn't kick in. + static const int kDestWidth = 1400; + static const int kDestHeight = 1400; + + PerfTimeLogger resize_timer("resize"); + SkBitmap dest = gfx::ImageOperations::Resize(src_bmp, + gfx::ImageOperations::RESIZE_LANCZOS3, (float)kDestWidth / (float)kSrcWidth, + (float)kDestHeight / (float)kSrcHeight); +} + diff --git a/base/gfx/native_theme.cc b/base/gfx/native_theme.cc index 8c7914d..71289d8 100644 --- a/base/gfx/native_theme.cc +++ b/base/gfx/native_theme.cc @@ -10,11 +10,11 @@ #include <vssym32.h> #include "base/gfx/gdi_util.h" +#include "base/gfx/skia_utils.h" #include "base/gfx/rect.h" #include "base/logging.h" #include "base/scoped_handle.h" #include "skia/ext/platform_canvas.h" -#include "skia/ext/skia_utils_win.h" #include "skia/include/SkShader.h" namespace gfx { @@ -213,8 +213,8 @@ HRESULT NativeTheme::PaintScrollbarTrack(HDC hdc, } else { // Create a 2x2 checkerboard pattern using the 3D face and highlight // colors. - SkColor face = skia::COLORREFToSkColor(color3DFace); - SkColor highlight = skia::COLORREFToSkColor(GetSysColor(COLOR_3DHILIGHT)); + SkColor face = COLORREFToSkColor(color3DFace); + SkColor highlight = COLORREFToSkColor(GetSysColor(COLOR_3DHILIGHT)); SkColor buffer[] = { face, highlight, highlight, face }; SkBitmap bitmap; bitmap.setConfig(SkBitmap::kARGB_8888_Config, 2, 2); @@ -232,7 +232,7 @@ HRESULT NativeTheme::PaintScrollbarTrack(HDC hdc, shader->setLocalMatrix(matrix); SkPaint paint; paint.setShader(shader)->unref(); - canvas->drawIRect(skia::RECTToSkIRect(*target_rect), paint); + canvas->drawIRect(RECTToSkIRect(*target_rect), paint); } if (classic_state & DFCS_PUSHED) InvertRect(hdc, target_rect); @@ -466,7 +466,7 @@ HRESULT NativeTheme::GetThemeColor(ThemeName theme, COLORREF color_ref; if (get_theme_color_(handle, part_id, state_id, prop_id, &color_ref) == S_OK) { - *color = skia::COLORREFToSkColor(color_ref); + *color = gfx::COLORREFToSkColor(color_ref); return S_OK; } } @@ -480,7 +480,7 @@ SkColor NativeTheme::GetThemeColorWithDefault(ThemeName theme, int default_sys_color) const { SkColor color; if (GetThemeColor(theme, part_id, state_id, prop_id, &color) != S_OK) - color = skia::COLORREFToSkColor(GetSysColor(default_sys_color)); + color = gfx::COLORREFToSkColor(GetSysColor(default_sys_color)); return color; } diff --git a/base/gfx/skia_utils.cc b/base/gfx/skia_utils.cc new file mode 100644 index 0000000..7b70056 --- /dev/null +++ b/base/gfx/skia_utils.cc @@ -0,0 +1,75 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/gfx/skia_utils.h" + +#include "base/logging.h" +#include "SkRect.h" +#include "SkGradientShader.h" + +namespace { + +COMPILE_ASSERT(offsetof(RECT, left) == offsetof(SkIRect, fLeft), o1); +COMPILE_ASSERT(offsetof(RECT, top) == offsetof(SkIRect, fTop), o2); +COMPILE_ASSERT(offsetof(RECT, right) == offsetof(SkIRect, fRight), o3); +COMPILE_ASSERT(offsetof(RECT, bottom) == offsetof(SkIRect, fBottom), o4); +COMPILE_ASSERT(sizeof(RECT().left) == sizeof(SkIRect().fLeft), o5); +COMPILE_ASSERT(sizeof(RECT().top) == sizeof(SkIRect().fTop), o6); +COMPILE_ASSERT(sizeof(RECT().right) == sizeof(SkIRect().fRight), o7); +COMPILE_ASSERT(sizeof(RECT().bottom) == sizeof(SkIRect().fBottom), o8); +COMPILE_ASSERT(sizeof(RECT) == sizeof(SkIRect), o9); + +} // namespace + +namespace gfx { + +POINT SkPointToPOINT(const SkPoint& point) { + POINT win_point = { SkScalarRound(point.fX), SkScalarRound(point.fY) }; + return win_point; +} + +SkRect RECTToSkRect(const RECT& rect) { + SkRect sk_rect = { SkIntToScalar(rect.left), SkIntToScalar(rect.top), + SkIntToScalar(rect.right), SkIntToScalar(rect.bottom) }; + return sk_rect; +} + +SkShader* CreateGradientShader(int start_point, + int end_point, + SkColor start_color, + SkColor end_color) { + SkColor grad_colors[2] = { start_color, end_color}; + SkPoint grad_points[2]; + grad_points[0].set(SkIntToScalar(0), SkIntToScalar(start_point)); + grad_points[1].set(SkIntToScalar(0), SkIntToScalar(end_point)); + + return SkGradientShader::CreateLinear( + grad_points, grad_colors, NULL, 2, SkShader::kRepeat_TileMode); +} + + +SkColor COLORREFToSkColor(COLORREF color) { +#ifndef _MSC_VER + return SkColorSetRGB(GetRValue(color), GetGValue(color), GetBValue(color)); +#else + // ARGB = 0xFF000000 | ((0BGR -> RGB0) >> 8) + return 0xFF000000u | (_byteswap_ulong(color) >> 8); +#endif +} + +COLORREF SkColorToCOLORREF(SkColor color) { + // Currently, Alpha is always 255 or the color is 0 so there is no need to + // demultiply the channels. If this DCHECK() is ever hit, the full + // (SkColorGetX(color) * 255 / a) will have to be added in the conversion. + DCHECK((0xFF == SkColorGetA(color)) || (0 == color)); +#ifndef _MSC_VER + return RGB(SkColorGetR(color), SkColorGetG(color), SkColorGetB(color)); +#else + // 0BGR = ((ARGB -> BGRA) >> 8) + return (_byteswap_ulong(color) >> 8); +#endif +} + +} // namespace gfx + diff --git a/skia/ext/skia_utils_win.h b/base/gfx/skia_utils.h index 297608a..8509072 100644 --- a/skia/ext/skia_utils_win.h +++ b/base/gfx/skia_utils.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef SKIA_EXT_SKIA_UTILS_WIN_H_ -#define SKIA_EXT_SKIA_UTILS_WIN_H_ +#ifndef BASE_GFX_SKIA_UTILS_H__ +#define BASE_GFX_SKIA_UTILS_H__ #include "SkColor.h" #include "SkShader.h" @@ -16,7 +16,7 @@ typedef DWORD COLORREF; typedef struct tagPOINT POINT; typedef struct tagRECT RECT; -namespace skia { +namespace gfx { // Converts a Skia point to a Windows POINT. POINT SkPointToPOINT(const SkPoint& point); @@ -50,7 +50,7 @@ SkColor COLORREFToSkColor(COLORREF color); // Converts ARGB to COLORREFs (0BGR). COLORREF SkColorToCOLORREF(SkColor color); -} // namespace skia +} // namespace gfx -#endif // SKIA_EXT_SKIA_UTILS_WIN_H_ +#endif diff --git a/skia/ext/skia_utils_mac.cc b/base/gfx/skia_utils_mac.cc index a7610aa..b5962c3 100644 --- a/skia/ext/skia_utils_mac.cc +++ b/base/gfx/skia_utils_mac.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "skia/ext/skia_utils_mac.h" +#include "base/gfx/skia_utils_mac.h" #include "base/logging.h" #include "SkMatrix.h" diff --git a/skia/ext/skia_utils_mac.h b/base/gfx/skia_utils_mac.h index a99905f..a99905f 100644 --- a/skia/ext/skia_utils_mac.h +++ b/base/gfx/skia_utils_mac.h diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc index 4cd2d76..cfef6a6 100644 --- a/chrome/browser/autocomplete/autocomplete_edit.cc +++ b/chrome/browser/autocomplete/autocomplete_edit.cc @@ -8,6 +8,7 @@ #include "base/base_drag_source.h" #include "base/clipboard.h" +#include "base/gfx/skia_utils.h" #include "base/iat_patch.h" #include "base/ref_counted.h" #include "base/scoped_clipboard_writer.h" diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc index 5af7c47..262c507 100644 --- a/chrome/browser/download/download_util.cc +++ b/chrome/browser/download/download_util.cc @@ -11,6 +11,7 @@ #include "base/base_drag_source.h" #include "base/file_util.h" #include "base/scoped_clipboard_writer.h" +#include "base/gfx/image_operations.h" #include "base/string_util.h" #include "chrome/app/locales/locale_settings.h" #include "chrome/app/theme/theme_resources.h" @@ -24,7 +25,6 @@ #include "chrome/common/resource_bundle.h" #include "chrome/views/view.h" #include "generated_resources.h" -#include "skia/ext/image_operations.h" #include "SkPath.h" #include "SkShader.h" diff --git a/chrome/browser/fav_icon_helper.cc b/chrome/browser/fav_icon_helper.cc index 2f05357..f77b05c 100644 --- a/chrome/browser/fav_icon_helper.cc +++ b/chrome/browser/fav_icon_helper.cc @@ -4,6 +4,7 @@ #include "chrome/browser/fav_icon_helper.h" +#include "base/gfx/image_operations.h" #include "base/gfx/png_decoder.h" #include "base/gfx/png_encoder.h" #include "chrome/browser/navigation_entry.h" @@ -12,7 +13,6 @@ #include "chrome/browser/render_view_host.h" #include "chrome/browser/web_contents.h" #include "chrome/common/gfx/favicon_size.h" -#include "skia/ext/image_operations.h" FavIconHelper::FavIconHelper(WebContents* web_contents) : web_contents_(web_contents), @@ -257,8 +257,8 @@ SkBitmap FavIconHelper::ConvertToFavIconSize(const SkBitmap& image) { int height = image.height(); if (width > 0 && height > 0) { calc_favicon_target_size(&width, &height); - return skia::ImageOperations::Resize( - image, skia::ImageOperations::RESIZE_LANCZOS3, + return gfx::ImageOperations::Resize( + image, gfx::ImageOperations::RESIZE_LANCZOS3, gfx::Size(width, height)); } return image; diff --git a/chrome/browser/importer/importer.cc b/chrome/browser/importer/importer.cc index a329cfb..3ce8996 100644 --- a/chrome/browser/importer/importer.cc +++ b/chrome/browser/importer/importer.cc @@ -8,6 +8,7 @@ #include <set> #include "base/file_util.h" +#include "base/gfx/image_operations.h" #include "base/gfx/png_encoder.h" #include "base/string_util.h" #include "chrome/browser/bookmarks/bookmark_model.h" @@ -30,7 +31,6 @@ #include "chrome/common/pref_service.h" #include "chrome/common/win_util.h" #include "chrome/views/window.h" -#include "skia/ext/image_operations.h" #include "webkit/glue/image_decoder.h" #include "generated_resources.h" @@ -384,8 +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 = skia::ImageOperations::Resize( - decoded, skia::ImageOperations::RESIZE_LANCZOS3, + decoded = gfx::ImageOperations::Resize( + decoded, gfx::ImageOperations::RESIZE_LANCZOS3, gfx::Size(new_width, new_height)); } diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc index 49d817b..aaca5af 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -7,6 +7,7 @@ #include <limits> #include "base/base_drag_source.h" +#include "base/gfx/skia_utils.h" #include "chrome/app/theme/theme_resources.h" #include "chrome/browser/bookmarks/bookmark_context_menu.h" #include "chrome/browser/bookmarks/bookmark_utils.h" @@ -44,7 +45,6 @@ #include "chrome/views/widget.h" #include "chrome/views/window.h" #include "generated_resources.h" -#include "skia/ext/skia_utils.h" using views::BaseButton; using views::DropTargetEvent; @@ -255,7 +255,7 @@ class BookmarkButton : public views::TextButton { // the parent's actual bounds because they differ from what is painted. SkPaint paint; paint.setAlpha(static_cast<int>((1.0 - animation_value) * 255)); - paint.setShader(skia::CreateGradientShader(0, + paint.setShader(gfx::CreateGradientShader(0, view->height() + kTopMargin + kBottomMargin, kTopBorderColor, kBackgroundColor))->safeUnref(); @@ -603,16 +603,16 @@ class ButtonSeparatorView : public views::View { virtual void Paint(ChromeCanvas* canvas) { SkPaint paint; - paint.setShader(skia::CreateGradientShader(0, - height() / 2, - kTopBorderColor, - kSeparatorColor))->safeUnref(); + paint.setShader(gfx::CreateGradientShader(0, + height() / 2, + kTopBorderColor, + kSeparatorColor))->safeUnref(); SkRect rc = {SkIntToScalar(kSeparatorStartX), SkIntToScalar(0), SkIntToScalar(1), SkIntToScalar(height() / 2) }; canvas->drawRect(rc, paint); SkPaint paint_down; - paint_down.setShader(skia::CreateGradientShader(height() / 2, + paint_down.setShader(gfx::CreateGradientShader(height() / 2, height(), kSeparatorColor, kBackgroundColor))->safeUnref(); @@ -904,10 +904,10 @@ void BookmarkBarView::Paint(ChromeCanvas* canvas) { // Draw our background. SkPaint paint; paint.setAntiAlias(true); - paint.setShader(skia::CreateGradientShader(0, - height(), - kTopBorderColor, - kBackgroundColor))->safeUnref(); + paint.setShader(gfx::CreateGradientShader(0, + height(), + kTopBorderColor, + kBackgroundColor))->safeUnref(); canvas->drawRoundRect(rect, SkDoubleToScalar(roundness), @@ -924,10 +924,10 @@ void BookmarkBarView::Paint(ChromeCanvas* canvas) { SkDoubleToScalar(roundness), border_paint); } else { SkPaint paint; - paint.setShader(skia::CreateGradientShader(0, - height(), - kTopBorderColor, - kBackgroundColor))->safeUnref(); + paint.setShader(gfx::CreateGradientShader(0, + height(), + kTopBorderColor, + kBackgroundColor))->safeUnref(); canvas->FillRectInt(0, 0, width(), height(), paint); canvas->FillRectInt(kTopBorderColor, 0, 0, width(), 1); diff --git a/chrome/browser/views/bookmark_manager_view.cc b/chrome/browser/views/bookmark_manager_view.cc index 684c252..c0c307e 100644 --- a/chrome/browser/views/bookmark_manager_view.cc +++ b/chrome/browser/views/bookmark_manager_view.cc @@ -6,6 +6,7 @@ #include <algorithm> +#include "base/gfx/skia_utils.h" #include "chrome/app/locales/locale_settings.h" #include "chrome/browser/bookmarks/bookmark_folder_tree_model.h" #include "chrome/browser/bookmarks/bookmark_html_writer.h" @@ -30,8 +31,8 @@ #include "chrome/views/menu_button.h" #include "chrome/views/single_split_view.h" #include "chrome/views/window.h" + #include "generated_resources.h" -#include "skia/ext/skia_utils.h" // If non-null, there is an open editor and this is the window it is contained // in it. @@ -298,7 +299,7 @@ void BookmarkManagerView::PaintBackground(ChromeCanvas* canvas) { canvas->drawColor(kBackgroundColorBottom, SkPorterDuff::kSrc_Mode); SkPaint paint; - paint.setShader(skia::CreateGradientShader(0, kBackgroundGradientHeight, + paint.setShader(gfx::CreateGradientShader(0, kBackgroundGradientHeight, kBackgroundColorTop, kBackgroundColorBottom))->safeUnref(); canvas->FillRectInt(0, 0, width(), kBackgroundGradientHeight, paint); diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/views/options/content_page_view.cc index a534a4b..e4e443d 100644 --- a/chrome/browser/views/options/content_page_view.cc +++ b/chrome/browser/views/options/content_page_view.cc @@ -11,6 +11,7 @@ #include "base/file_util.h" #include "base/gfx/native_theme.h" +#include "base/gfx/skia_utils.h" #include "chrome/app/theme/theme_resources.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/shell_dialogs.h" @@ -30,7 +31,6 @@ #include "chrome/views/text_field.h" #include "chrome/views/widget.h" #include "generated_resources.h" -#include "skia/ext/skia_utils_win.h" #include "skia/include/SkBitmap.h" namespace { @@ -102,7 +102,7 @@ void FileDisplayArea::Paint(ChromeCanvas* canvas) { RECT rect = { 0, 0, width(), height() }; gfx::NativeTheme::instance()->PaintTextField( dc, EP_EDITTEXT, ETS_READONLY, 0, &rect, - skia::SkColorToCOLORREF(text_field_background_color_), true, true); + gfx::SkColorToCOLORREF(text_field_background_color_), true, true); canvas->endPlatformPaint(); canvas->DrawBitmapInt(default_folder_icon_, icon_bounds_.x(), icon_bounds_.y()); diff --git a/chrome/browser/views/options/fonts_page_view.cc b/chrome/browser/views/options/fonts_page_view.cc index d73191b..b41fb55 100644 --- a/chrome/browser/views/options/fonts_page_view.cc +++ b/chrome/browser/views/options/fonts_page_view.cc @@ -10,6 +10,7 @@ #include "base/file_util.h" #include "base/gfx/native_theme.h" +#include "base/gfx/skia_utils.h" #include "base/string_util.h" #include "chrome/app/theme/theme_resources.h" #include "chrome/app/locales/locale_settings.h" diff --git a/chrome/browser/views/options/languages_page_view.cc b/chrome/browser/views/options/languages_page_view.cc index e9a1e8b..118ac10 100644 --- a/chrome/browser/views/options/languages_page_view.cc +++ b/chrome/browser/views/options/languages_page_view.cc @@ -11,6 +11,7 @@ #include "base/file_util.h" #include "base/string_util.h" #include "base/gfx/native_theme.h" +#include "base/gfx/skia_utils.h" #include "base/string_util.h" #include "chrome/app/theme/theme_resources.h" #include "chrome/browser/browser_process.h" diff --git a/chrome/browser/views/options/options_group_view.cc b/chrome/browser/views/options/options_group_view.cc index 9ff07f5..bdf76ea 100644 --- a/chrome/browser/views/options/options_group_view.cc +++ b/chrome/browser/views/options/options_group_view.cc @@ -8,6 +8,7 @@ #include "chrome/browser/views/options/options_group_view.h" #include "base/gfx/native_theme.h" +#include "base/gfx/skia_utils.h" #include "chrome/app/locales/locale_settings.h" #include "chrome/browser/views/standard_layout.h" #include "chrome/common/gfx/chrome_font.h" diff --git a/chrome/browser/views/sad_tab_view.cc b/chrome/browser/views/sad_tab_view.cc index e22aea2..7b34bcb 100644 --- a/chrome/browser/views/sad_tab_view.cc +++ b/chrome/browser/views/sad_tab_view.cc @@ -10,7 +10,6 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/resource_bundle.h" #include "generated_resources.h" -#include "skia/ext/skia_utils.h" #include "skia/include/SkGradientShader.h" static const int kSadTabOffset = -64; @@ -35,9 +34,17 @@ SadTabView::SadTabView() { InitClass(); } +static SkShader* CreateGradientShader(int end_point) { + SkColor grad_colors[2] = { kBackgroundColor, kBackgroundEndColor }; + SkPoint grad_points[2]; + grad_points[0].set(SkIntToScalar(0), SkIntToScalar(0)); + grad_points[1].set(SkIntToScalar(0), SkIntToScalar(end_point)); + return SkGradientShader::CreateLinear( + grad_points, grad_colors, NULL, 2, SkShader::kRepeat_TileMode); +} + void SadTabView::Paint(ChromeCanvas* canvas) { - SkShader* background_shader = skia::CreateGradientShader( - 0, height(), kBackgroundColor, kBackgroundEndColor); + SkShader* background_shader = CreateGradientShader(height()); SkPaint paint; paint.setShader(background_shader); background_shader->unref(); diff --git a/chrome/browser/views/tabs/tab_renderer.cc b/chrome/browser/views/tabs/tab_renderer.cc index 4581f6d..f1d00b3 100644 --- a/chrome/browser/views/tabs/tab_renderer.cc +++ b/chrome/browser/views/tabs/tab_renderer.cc @@ -6,6 +6,7 @@ #include "chrome/browser/views/tabs/tab_renderer.h" +#include "base/gfx/image_operations.h" #include "chrome/app/theme/theme_resources.h" #include "chrome/browser/browser.h" #include "chrome/browser/tabs/tab_strip_model.h" @@ -16,7 +17,6 @@ #include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" #include "generated_resources.h" -#include "skia/ext/image_operations.h" static const int kLeftPadding = 16; static const int kTopPadding = 6; @@ -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 = skia::ImageOperations::CreateBlendedBitmap( + SkBitmap left = gfx::ImageOperations::CreateBlendedBitmap( (is_otr ? *tab_inactive_otr_l : *tab_inactive_l), *tab_hover_l, opacity); - SkBitmap center = skia::ImageOperations::CreateBlendedBitmap( + SkBitmap center = gfx::ImageOperations::CreateBlendedBitmap( (is_otr ? *tab_inactive_otr_c : *tab_inactive_c), *tab_hover_c, opacity); - SkBitmap right = skia::ImageOperations::CreateBlendedBitmap( + SkBitmap right = gfx::ImageOperations::CreateBlendedBitmap( (is_otr ? *tab_inactive_otr_r : *tab_inactive_r), *tab_hover_r, opacity); diff --git a/chrome/common/gfx/color_utils.cc b/chrome/common/gfx/color_utils.cc index cdb4c0c..0b40436 100644 --- a/chrome/common/gfx/color_utils.cc +++ b/chrome/common/gfx/color_utils.cc @@ -12,13 +12,10 @@ #include "chrome/common/gfx/color_utils.h" #include "base/basictypes.h" +#include "base/gfx/skia_utils.h" #include "base/logging.h" #include "skia/include/SkBitmap.h" -#if defined(OS_WIN) -#include "skia/ext/skia_utils_win.h" -#endif - namespace color_utils { // These transformations are based on the equations in: @@ -255,7 +252,7 @@ SkColor SetColorAlpha(SkColor c, SkAlpha alpha) { SkColor GetSysSkColor(int which) { #if defined(OS_WIN) - return skia::COLORREFToSkColor(::GetSysColor(which)); + return gfx::COLORREFToSkColor(::GetSysColor(which)); #else NOTIMPLEMENTED(); return SK_ColorLTGRAY; diff --git a/chrome/common/gfx/icon_util.cc b/chrome/common/gfx/icon_util.cc index ae5e174..e717c79 100644 --- a/chrome/common/gfx/icon_util.cc +++ b/chrome/common/gfx/icon_util.cc @@ -3,12 +3,11 @@ // found in the LICENSE file. #include "chrome/common/gfx/icon_util.h" - #include "base/file_util.h" +#include "base/gfx/image_operations.h" #include "base/gfx/size.h" #include "base/logging.h" #include "chrome/common/win_util.h" -#include "skia/ext/image_operations.h" #include "skia/include/SkBitmap.h" // Defining the dimensions for the icon images. We store only one value because @@ -404,8 +403,8 @@ void IconUtil::CreateResizedBitmapSet(const SkBitmap& bitmap_to_resize, inserted_original_bitmap = true; } } - bitmaps->push_back(skia::ImageOperations::Resize( - bitmap_to_resize, skia::ImageOperations::RESIZE_LANCZOS3, + bitmaps->push_back(gfx::ImageOperations::Resize( + bitmap_to_resize, gfx::ImageOperations::RESIZE_LANCZOS3, gfx::Size(icon_dimensions_[i], icon_dimensions_[i]))); } diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index e28a6c7..23fab18 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -10,6 +10,7 @@ #include "base/command_line.h" #include "base/gfx/gdi_util.h" +#include "base/gfx/image_operations.h" #include "base/gfx/native_theme.h" #include "base/gfx/png_encoder.h" #include "base/string_piece.h" @@ -37,7 +38,6 @@ #include "net/base/escape.h" #include "net/base/net_errors.h" #include "skia/ext/bitmap_platform_device.h" -#include "skia/ext/image_operations.h" #include "skia/ext/vector_canvas.h" #include "webkit/default_plugin/default_plugin_shared.h" #include "webkit/glue/dom_operations.h" @@ -57,6 +57,7 @@ #include "webkit/glue/weburlrequest.h" #include "webkit/glue/webview.h" #include "webkit/glue/plugins/webplugin_delegate_impl.h" +//#include "webkit/port/platform/graphics/PlatformContextSkia.h" #include "generated_resources.h" @@ -797,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 = skia::ImageOperations::Resize( - subset, skia::ImageOperations::RESIZE_LANCZOS3, gfx::Size(w, h)); + *thumbnail = gfx::ImageOperations::Resize( + subset, gfx::ImageOperations::RESIZE_LANCZOS3, gfx::Size(w, h)); score->boring_score = CalculateBoringScore(thumbnail); diff --git a/chrome/views/background.cc b/chrome/views/background.cc index 1aa631e..72352b7 100644 --- a/chrome/views/background.cc +++ b/chrome/views/background.cc @@ -4,11 +4,11 @@ #include "chrome/views/background.h" +#include "base/gfx/skia_utils.h" #include "base/logging.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/views/painter.h" #include "chrome/views/view.h" -#include "skia/ext/skia_utils_win.h" #include "skia/include/SkPaint.h" namespace views { @@ -68,7 +68,7 @@ Background::~Background() { void Background::SetNativeControlColor(SkColor color) { DeleteObject(native_control_brush_); - native_control_brush_ = CreateSolidBrush(skia::SkColorToCOLORREF(color)); + native_control_brush_ = CreateSolidBrush(gfx::SkColorToCOLORREF(color)); } //static diff --git a/chrome/views/button.cc b/chrome/views/button.cc index 36c228a..93e2e3c 100644 --- a/chrome/views/button.cc +++ b/chrome/views/button.cc @@ -7,12 +7,12 @@ #include <atlbase.h> #include <atlapp.h> +#include "base/gfx/image_operations.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/l10n_util.h" #include "chrome/common/throb_animation.h" #include "chrome/views/event.h" -#include "skia/ext/image_operations.h" #include "generated_resources.h" @@ -105,7 +105,7 @@ SkBitmap Button::GetImageToPaint() { SkBitmap img; if (!images_[BS_HOT].isNull() && hover_animation_->IsAnimating()) { - img = skia::ImageOperations::CreateBlendedBitmap(images_[BS_NORMAL], + img = gfx::ImageOperations::CreateBlendedBitmap(images_[BS_NORMAL], images_[BS_HOT], hover_animation_->GetCurrentValue()); } else { img = images_[GetState()]; diff --git a/chrome/views/chrome_menu.cc b/chrome/views/chrome_menu.cc index 4d12f3b..549bedf 100644 --- a/chrome/views/chrome_menu.cc +++ b/chrome/views/chrome_menu.cc @@ -10,6 +10,7 @@ #include "base/base_drag_source.h" #include "base/gfx/native_theme.h" +#include "base/gfx/skia_utils.h" #include "base/message_loop.h" #include "base/task.h" #include "base/timer.h" diff --git a/chrome/views/single_split_view.cc b/chrome/views/single_split_view.cc index a7832b6..2550c57 100644 --- a/chrome/views/single_split_view.cc +++ b/chrome/views/single_split_view.cc @@ -4,9 +4,9 @@ #include "chrome/views/single_split_view.h" +#include "base/gfx/skia_utils.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/views/background.h" -#include "skia/ext/skia_utils_win.h" namespace views { @@ -19,7 +19,7 @@ SingleSplitView::SingleSplitView(View* leading, View* trailing) AddChildView(trailing); set_background( views::Background::CreateSolidBackground( - skia::COLORREFToSkColor(GetSysColor(COLOR_3DFACE)))); + gfx::COLORREFToSkColor(GetSysColor(COLOR_3DFACE)))); } void SingleSplitView::Layout() { diff --git a/chrome/views/tabbed_pane.cc b/chrome/views/tabbed_pane.cc index 4a63b47..2638972 100644 --- a/chrome/views/tabbed_pane.cc +++ b/chrome/views/tabbed_pane.cc @@ -7,6 +7,7 @@ #include <vssym32.h> #include "base/gfx/native_theme.h" +#include "base/gfx/skia_utils.h" #include "base/logging.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/chrome_font.h" diff --git a/chrome/views/table_view.cc b/chrome/views/table_view.cc index 73f456f1..8298cf6 100644 --- a/chrome/views/table_view.cc +++ b/chrome/views/table_view.cc @@ -9,6 +9,7 @@ #include "base/string_util.h" #include "base/win_util.h" +#include "base/gfx/skia_utils.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/favicon_size.h" #include "chrome/common/gfx/icon_util.h" @@ -17,7 +18,6 @@ #include "chrome/views/hwnd_view.h" #include "SkBitmap.h" #include "SkColorFilter.h" -#include "skia/ext/skia_utils_win.h" namespace views { @@ -1203,10 +1203,10 @@ LRESULT TableView::OnCustomDraw(NMLVCUSTOMDRAW* draw_info) { custom_cell_font_ = CreateFontIndirect(&logfont); SelectObject(draw_info->nmcd.hdc, custom_cell_font_); draw_info->clrText = foreground.color_is_set - ? skia::SkColorToCOLORREF(foreground.color) + ? gfx::SkColorToCOLORREF(foreground.color) : CLR_DEFAULT; draw_info->clrTextBk = background.color_is_set - ? skia::SkColorToCOLORREF(background.color) + ? gfx::SkColorToCOLORREF(background.color) : CLR_DEFAULT; return CDRF_NEWFONT; } @@ -1256,7 +1256,7 @@ LRESULT TableView::OnCustomDraw(NMLVCUSTOMDRAW* draw_info) { // background (or rather windows paints background, then invokes // this twice). As such, we always fill in the background. canvas.drawColor( - skia::COLORREFToSkColor(GetSysColor(bg_color_index)), + gfx::COLORREFToSkColor(GetSysColor(bg_color_index)), SkPorterDuff::kSrc_Mode); // + 1 for padding (we declared the image as 18x18 in the list- // view when they are 16x16 so we get an extra pixel of padding). diff --git a/chrome/views/text_field.cc b/chrome/views/text_field.cc index 92797a4..24fdc5a 100644 --- a/chrome/views/text_field.cc +++ b/chrome/views/text_field.cc @@ -12,6 +12,7 @@ #include <vsstyle.h> #include "base/gfx/native_theme.h" +#include "base/gfx/skia_utils.h" #include "base/scoped_clipboard_writer.h" #include "base/string_util.h" #include "base/win_util.h" @@ -24,8 +25,8 @@ #include "chrome/views/hwnd_view.h" #include "chrome/views/menu.h" #include "chrome/views/widget.h" + #include "generated_resources.h" -#include "skia/ext/skia_utils_win.h" using gfx::NativeTheme; @@ -1086,7 +1087,7 @@ void TextField::UpdateEditBackgroundColor() { COLORREF bg_color; if (!use_default_background_color_) - bg_color = skia::SkColorToCOLORREF(background_color_); + bg_color = gfx::SkColorToCOLORREF(background_color_); else bg_color = GetSysColor(read_only_ ? COLOR_3DFACE : COLOR_WINDOW); edit_->SetBackgroundColor(bg_color); diff --git a/skia/SConscript b/skia/SConscript index fbafc92..00b8e1b 100644 --- a/skia/SConscript +++ b/skia/SConscript @@ -152,10 +152,6 @@ input_files = [ 'sgl/SkUtils.cpp', 'sgl/SkWriter32.cpp', 'sgl/SkXfermode.cpp', - - 'ext/convolver.cc', - 'ext/image_operations.cc', - 'ext/skia_utils.cc', ] if env['PLATFORM'] == 'posix': @@ -180,13 +176,11 @@ if env['PLATFORM'] == 'darwin': input_files.append('ext/bitmap_platform_device_mac.cc') input_files.append('ext/platform_canvas_mac.cc') input_files.append('ext/platform_device_mac.cc') - input_files.append('ext/skia_utils_mac.cc') if env['PLATFORM'] == 'win32': input_files.append('ext/bitmap_platform_device_win.cc') input_files.append('ext/platform_canvas_win.cc') input_files.append('ext/platform_device_win.cc') - input_files.append('ext/skia_utils_win.cc') input_files.append('ext/vector_canvas.cc') input_files.append('ext/vector_device.cc') diff --git a/skia/ext/bitmap_platform_device_mac.cc b/skia/ext/bitmap_platform_device_mac.cc index 52ce586..d4458d7 100755 --- a/skia/ext/bitmap_platform_device_mac.cc +++ b/skia/ext/bitmap_platform_device_mac.cc @@ -10,8 +10,8 @@ #include "SkRegion.h" #include "SkUtils.h" +#include "base/gfx/skia_utils_mac.h" #include "base/logging.h" -#include "skia/ext/skia_utils_mac.h" namespace gfx { diff --git a/skia/ext/platform_device_mac.cc b/skia/ext/platform_device_mac.cc index 3cc6fb4..9539e0f 100755 --- a/skia/ext/platform_device_mac.cc +++ b/skia/ext/platform_device_mac.cc @@ -5,7 +5,7 @@ #include "skia/ext/bitmap_platform_device_mac.h" #include "base/logging.h" -#include "skia/ext/skia_utils_mac.h" +#include "base/gfx/skia_utils_mac.h" #include "SkMatrix.h" #include "SkPath.h" #include "SkUtils.h" diff --git a/skia/ext/platform_device_win.cc b/skia/ext/platform_device_win.cc index 1e8301d..15201c0 100644 --- a/skia/ext/platform_device_win.cc +++ b/skia/ext/platform_device_win.cc @@ -5,14 +5,11 @@ #include "skia/ext/platform_device_win.h" #include "base/logging.h" +#include "base/gfx/skia_utils.h" #include "SkMatrix.h" #include "SkPath.h" #include "SkRegion.h" #include "SkUtils.h" -#include "skia/ext/skia_utils_win.h" - -// TODO(brettw) remove this when this file is converted to namespace skia. -using namespace skia; namespace gfx { diff --git a/skia/ext/skia_utils.cc b/skia/ext/skia_utils.cc deleted file mode 100644 index 651670e..0000000 --- a/skia/ext/skia_utils.cc +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "skia/ext/skia_utils_win.h" - -#include "SkRect.h" -#include "SkGradientShader.h" - -namespace skia { - -SkShader* CreateGradientShader(int start_point, - int end_point, - SkColor start_color, - SkColor end_color) { - SkColor grad_colors[2] = { start_color, end_color}; - SkPoint grad_points[2]; - grad_points[0].set(SkIntToScalar(0), SkIntToScalar(start_point)); - grad_points[1].set(SkIntToScalar(0), SkIntToScalar(end_point)); - - return SkGradientShader::CreateLinear( - grad_points, grad_colors, NULL, 2, SkShader::kRepeat_TileMode); -} - -} // namespace skia - diff --git a/skia/ext/skia_utils.h b/skia/ext/skia_utils.h deleted file mode 100644 index acfab28..0000000 --- a/skia/ext/skia_utils.h +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This file contains cross-platform Skia helper routines. - -#ifndef SKIA_EXT_SKIA_UTILS_H_ -#define SKIA_EXT_SKIA_UTILS_H_ - -#include "SkShader.h" - -namespace skia { - -// Creates a vertical gradient shader. The caller owns the shader. -SkShader* CreateGradientShader(int start_point, - int end_point, - SkColor start_color, - SkColor end_color); - -} // namespace skia - -#endif // SKIA_EXT_SKIA_UTILS_H_ - diff --git a/skia/ext/skia_utils_win.cc b/skia/ext/skia_utils_win.cc deleted file mode 100644 index f695a63..0000000 --- a/skia/ext/skia_utils_win.cc +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include <windows.h> - -#include "skia/ext/skia_utils_win.h" - -#include "SkRect.h" -#include "SkGradientShader.h" - -namespace { - -// Compiler assert from base/logging.h -template <bool> -struct CompileAssert { -}; -#undef COMPILE_ASSERT -#define COMPILE_ASSERT(expr, msg) \ - typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] - -COMPILE_ASSERT(SK_OFFSETOF(RECT, left) == SK_OFFSETOF(SkIRect, fLeft), o1); -COMPILE_ASSERT(SK_OFFSETOF(RECT, top) == SK_OFFSETOF(SkIRect, fTop), o2); -COMPILE_ASSERT(SK_OFFSETOF(RECT, right) == SK_OFFSETOF(SkIRect, fRight), o3); -COMPILE_ASSERT(SK_OFFSETOF(RECT, bottom) == SK_OFFSETOF(SkIRect, fBottom), o4); -COMPILE_ASSERT(sizeof(RECT().left) == sizeof(SkIRect().fLeft), o5); -COMPILE_ASSERT(sizeof(RECT().top) == sizeof(SkIRect().fTop), o6); -COMPILE_ASSERT(sizeof(RECT().right) == sizeof(SkIRect().fRight), o7); -COMPILE_ASSERT(sizeof(RECT().bottom) == sizeof(SkIRect().fBottom), o8); -COMPILE_ASSERT(sizeof(RECT) == sizeof(SkIRect), o9); - -} // namespace - -namespace skia { - -POINT SkPointToPOINT(const SkPoint& point) { - POINT win_point = { SkScalarRound(point.fX), SkScalarRound(point.fY) }; - return win_point; -} - -SkRect RECTToSkRect(const RECT& rect) { - SkRect sk_rect = { SkIntToScalar(rect.left), SkIntToScalar(rect.top), - SkIntToScalar(rect.right), SkIntToScalar(rect.bottom) }; - return sk_rect; -} - -SkColor COLORREFToSkColor(COLORREF color) { - return SkColorSetRGB(GetRValue(color), GetGValue(color), GetBValue(color)); -} - -COLORREF SkColorToCOLORREF(SkColor color) { - // Currently, Alpha is always 255 or the color is 0 so there is no need to - // demultiply the channels. If this is needed, (SkColorGetX(color) * 255 / a) - // will have to be added in the conversion. - return RGB(SkColorGetR(color), SkColorGetG(color), SkColorGetB(color)); -} - -} // namespace skia - diff --git a/skia/ext/vector_device.cc b/skia/ext/vector_device.cc index 2dc0c30..a587e0c 100644 --- a/skia/ext/vector_device.cc +++ b/skia/ext/vector_device.cc @@ -5,13 +5,11 @@ #include "skia/ext/vector_device.h" #include "base/gfx/gdi_util.h" +#include "base/gfx/skia_utils.h" #include "base/logging.h" #include "base/scoped_handle.h" -#include "skia/ext/skia_utils_win.h" -#include "SkUtils.h" -// TOOD(brettw) remove this when this file is changed over to namespace skia. -using namespace skia; +#include "SkUtils.h" namespace gfx { diff --git a/skia/skia.vcproj b/skia/skia.vcproj index 65453c1..5e06d73 100644 --- a/skia/skia.vcproj +++ b/skia/skia.vcproj @@ -1321,22 +1321,6 @@ > </File> <File - RelativePath=".\ext\convolver.cc" - > - </File> - <File - RelativePath=".\ext\convolver.h" - > - </File> - <File - RelativePath=".\ext\image_operations.cc" - > - </File> - <File - RelativePath=".\ext\image_operations.h" - > - </File> - <File RelativePath=".\ext\platform_canvas.h" > </File> @@ -1361,22 +1345,6 @@ > </File> <File - RelativePath=".\ext\skia_utils.cc" - > - </File> - <File - RelativePath=".\ext\skia_utils.h" - > - </File> - <File - RelativePath=".\ext\skia_utils_win.cc" - > - </File> - <File - RelativePath=".\ext\skia_utils_win.h" - > - </File> - <File RelativePath=".\ext\vector_canvas.cc" > </File> diff --git a/skia/skia.xcodeproj/project.pbxproj b/skia/skia.xcodeproj/project.pbxproj index 2fb458c..7ecdb3b 100644 --- a/skia/skia.xcodeproj/project.pbxproj +++ b/skia/skia.xcodeproj/project.pbxproj @@ -13,8 +13,6 @@ A70A3BAE0ED7385F00C31871 /* bitmap_platform_device_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = A70A3BA80ED7385F00C31871 /* bitmap_platform_device_mac.cc */; }; A70A3BAF0ED7385F00C31871 /* platform_canvas_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = A70A3BAA0ED7385F00C31871 /* platform_canvas_mac.cc */; }; A70A3BB00ED7385F00C31871 /* platform_device_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = A70A3BAC0ED7385F00C31871 /* platform_device_mac.cc */; }; - A74368350EE5C759003562CC /* skia_utils.cc in Sources */ = {isa = PBXBuildFile; fileRef = A74368310EE5C759003562CC /* skia_utils.cc */; }; - A74368360EE5C759003562CC /* skia_utils_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = A74368330EE5C759003562CC /* skia_utils_mac.cc */; }; E48EE4D20E34E873009DE966 /* Sk1DPathEffect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C46860DAE9C4F00FC0DB7 /* Sk1DPathEffect.cpp */; }; E48EE4D30E34E873009DE966 /* Sk2DPathEffect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C46870DAE9C4F00FC0DB7 /* Sk2DPathEffect.cpp */; }; E48EE4D40E34E873009DE966 /* Sk64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB4C465C0DAE9C4A00FC0DB7 /* Sk64.cpp */; }; @@ -155,10 +153,6 @@ A70A3BAB0ED7385F00C31871 /* platform_canvas_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = platform_canvas_mac.h; path = ext/platform_canvas_mac.h; sourceTree = "<group>"; }; A70A3BAC0ED7385F00C31871 /* platform_device_mac.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = platform_device_mac.cc; path = ext/platform_device_mac.cc; sourceTree = "<group>"; }; A70A3BAD0ED7385F00C31871 /* platform_device_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = platform_device_mac.h; path = ext/platform_device_mac.h; sourceTree = "<group>"; }; - A74368310EE5C759003562CC /* skia_utils.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = skia_utils.cc; path = ext/skia_utils.cc; sourceTree = "<group>"; }; - A74368320EE5C759003562CC /* skia_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = skia_utils.h; path = ext/skia_utils.h; sourceTree = "<group>"; }; - A74368330EE5C759003562CC /* skia_utils_mac.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = skia_utils_mac.cc; path = ext/skia_utils_mac.cc; sourceTree = "<group>"; }; - A74368340EE5C759003562CC /* skia_utils_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = skia_utils_mac.h; path = ext/skia_utils_mac.h; sourceTree = "<group>"; }; AB4C45B00DAE9C3700FC0DB7 /* SkTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkTime.cpp; sourceTree = "<group>"; }; AB4C465C0DAE9C4A00FC0DB7 /* Sk64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Sk64.cpp; sourceTree = "<group>"; }; AB4C465D0DAE9C4A00FC0DB7 /* SkBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkBuffer.cpp; sourceTree = "<group>"; }; @@ -500,10 +494,6 @@ A70A3BAB0ED7385F00C31871 /* platform_canvas_mac.h */, A70A3BAC0ED7385F00C31871 /* platform_device_mac.cc */, A70A3BAD0ED7385F00C31871 /* platform_device_mac.h */, - A74368310EE5C759003562CC /* skia_utils.cc */, - A74368320EE5C759003562CC /* skia_utils.h */, - A74368330EE5C759003562CC /* skia_utils_mac.cc */, - A74368340EE5C759003562CC /* skia_utils_mac.h */, ); name = ext; sourceTree = "<group>"; @@ -1049,8 +1039,6 @@ E48EE5380E34E873009DE966 /* SkUtils.cpp in Sources */, E48EE5390E34E873009DE966 /* SkWriter32.cpp in Sources */, E48EE53A0E34E873009DE966 /* SkXfermode.cpp in Sources */, - A74368350EE5C759003562CC /* skia_utils.cc in Sources */, - A74368360EE5C759003562CC /* skia_utils_mac.cc in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/webkit/port/platform/graphics/FontWin.cpp b/webkit/port/platform/graphics/FontWin.cpp index 0fa5a26..ac28623 100644 --- a/webkit/port/platform/graphics/FontWin.cpp +++ b/webkit/port/platform/graphics/FontWin.cpp @@ -35,8 +35,8 @@ #include "SkiaUtils.h" #include "UniscribeHelperTextRun.h" +#include "base/gfx/skia_utils.h" // TODO(brettw) remove this dependency. #include "skia/ext/platform_canvas_win.h" -#include "skia/ext/skia_utils_win.h" namespace WebCore { @@ -69,7 +69,7 @@ void Font::drawGlyphs(GraphicsContext* graphicsContext, color = SkColorSetRGB(SkColorGetR(color), SkColorGetG(color), SkColorGetB(color)); - SetTextColor(hdc, skia::SkColorToCOLORREF(color)); + SetTextColor(hdc, gfx::SkColorToCOLORREF(color)); SetBkMode(hdc, TRANSPARENT); // Windows needs the characters and the advances in nice contiguous @@ -168,7 +168,7 @@ void Font::drawComplexText(GraphicsContext* graphicsContext, color = SkColorSetRGB(SkColorGetR(color), SkColorGetG(color), SkColorGetB(color)); - SetTextColor(hdc, skia::SkColorToCOLORREF(color)); + SetTextColor(hdc, gfx::SkColorToCOLORREF(color)); SetBkMode(hdc, TRANSPARENT); // Uniscribe counts the coordinates from the upper left, while WebKit uses diff --git a/webkit/port/platform/graphics/ImageSkia.cpp b/webkit/port/platform/graphics/ImageSkia.cpp index 12d5ae9..cfdc739 100644 --- a/webkit/port/platform/graphics/ImageSkia.cpp +++ b/webkit/port/platform/graphics/ImageSkia.cpp @@ -43,7 +43,7 @@ #include "SkiaUtils.h" #include "SkShader.h" -#include "skia/ext/image_operations.h" +#include "base/gfx/image_operations.h" // TODO(brettw) remove this dependency. #include "skia/ext/platform_canvas.h" namespace WebCore { @@ -217,8 +217,8 @@ void drawResampledBitmap(SkCanvas& canvas, destBitmapSubsetSkI.height()); // Resample the needed part of the image. - SkBitmap resampled = skia::ImageOperations::Resize(subset, - skia::ImageOperations::RESIZE_LANCZOS3, + SkBitmap resampled = gfx::ImageOperations::Resize(subset, + gfx::ImageOperations::RESIZE_LANCZOS3, gfx::Size(destRectRounded.width(), destRectRounded.height()), destBitmapSubset); @@ -350,8 +350,8 @@ void Image::drawPattern(GraphicsContext* context, if (resampling == RESAMPLE_AWESOME) { // Do nice resampling. - SkBitmap resampled = skia::ImageOperations::Resize(src_subset, - skia::ImageOperations::RESIZE_LANCZOS3, + 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))); shader = SkShader::CreateBitmapShader( diff --git a/webkit/port/platform/graphics/NativeImageSkia.cpp b/webkit/port/platform/graphics/NativeImageSkia.cpp index 7158d06..fb765eb 100644 --- a/webkit/port/platform/graphics/NativeImageSkia.cpp +++ b/webkit/port/platform/graphics/NativeImageSkia.cpp @@ -28,11 +28,11 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "config.h" -#include "NativeImageSkia.h" -#include "SkiaUtils.h" +#include "base/gfx/image_operations.h" -#include "skia/ext/image_operations.h" +#include "NativeImageSkia.h" +#include "SkiaUtils.h" NativeImageSkia::NativeImageSkia() : SkBitmap(), @@ -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 = skia::ImageOperations::Resize(*this, - skia::ImageOperations::RESIZE_LANCZOS3, gfx::Size(w, h)); + m_resizedImage = gfx::ImageOperations::Resize(*this, + gfx::ImageOperations::RESIZE_LANCZOS3, gfx::Size(w, h)); } return m_resizedImage; } diff --git a/webkit/port/platform/graphics/PlatformContextSkia.cpp b/webkit/port/platform/graphics/PlatformContextSkia.cpp index 1c63927..06b3c0a 100644 --- a/webkit/port/platform/graphics/PlatformContextSkia.cpp +++ b/webkit/port/platform/graphics/PlatformContextSkia.cpp @@ -34,6 +34,8 @@ #include "SkiaUtils.h" #include "wtf/MathExtras.h" +#include "base/gfx/image_operations.h" // TODO(brettw) remove this depencency. +#include "base/gfx/skia_utils.h" // TODO(brettw) remove this depencency. #include "skia/ext/platform_canvas.h" #include "SkBitmap.h" diff --git a/webkit/port/rendering/RenderThemeWin.cpp b/webkit/port/rendering/RenderThemeWin.cpp index 48a8947..907a6e4 100644 --- a/webkit/port/rendering/RenderThemeWin.cpp +++ b/webkit/port/rendering/RenderThemeWin.cpp @@ -37,8 +37,9 @@ #include "SkiaUtils.h" #include "ThemeHelperWin.h" -#include "base/gfx/native_theme.h" // TODO(brettw) fix this dependency. -#include "base/win_util.h" // TODO(brettw) fix this dependency. +#include "base/gfx/native_theme.h" +#include "base/gfx/skia_utils.h" +#include "base/win_util.h" namespace { @@ -571,7 +572,7 @@ bool RenderThemeWin::paintTextFieldInternal(RenderObject* o, gfx::PlatformCanvas* canvas = helper.context()->platformContext()->canvas(); HDC hdc = canvas->beginPlatformPaint(); - COLORREF clr = o->style()->backgroundColor().rgb() & 0xFFFFFF; + COLORREF clr = gfx::SkColorToCOLORREF(o->style()->backgroundColor().rgb()); RECT renderRect = helper.rect(); gfx::NativeTheme::instance()->PaintTextField(hdc, diff --git a/webkit/tools/test_shell/test_shell_tests.vcproj b/webkit/tools/test_shell/test_shell_tests.vcproj index cebf759..4f6a036 100644 --- a/webkit/tools/test_shell/test_shell_tests.vcproj +++ b/webkit/tools/test_shell/test_shell_tests.vcproj @@ -307,10 +307,6 @@ > </File> <File - RelativePath="..\..\..\skia\ext\convolver_unittest.cc" - > - </File> - <File RelativePath="..\..\glue\cpp_bound_class_unittest.cc" > </File> @@ -343,10 +339,6 @@ > </File> <File - RelativePath="..\..\..\skia\ext\image_operations_unittest.cc" - > - </File> - <File RelativePath=".\keyboard_unittest.cc" > </File> |