diff options
author | clholgat@chromium.org <clholgat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-26 22:47:24 +0000 |
---|---|---|
committer | clholgat@chromium.org <clholgat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-26 22:47:24 +0000 |
commit | 1ab91054908884d72b418b24e533dc02fc3dc46e (patch) | |
tree | f53fb0078a105ada06bb9a2eaaa3ebccdacfe87c /cc/test/pixel_test_utils.cc | |
parent | 833c1dab9e02316e31804e3049169b7ceb5c6495 (diff) | |
download | chromium_src-1ab91054908884d72b418b24e533dc02fc3dc46e.zip chromium_src-1ab91054908884d72b418b24e533dc02fc3dc46e.tar.gz chromium_src-1ab91054908884d72b418b24e533dc02fc3dc46e.tar.bz2 |
Optimize SkColorFilters when drawing RenderPassQuads
Pull the color transformation matrix from the SkImageFilter if possible
and apply with a shader. Handles all permutations of shaders.
BUG=168719
Review URL: https://chromiumcodereview.appspot.com/12803003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190786 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/pixel_test_utils.cc')
-rw-r--r-- | cc/test/pixel_test_utils.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/cc/test/pixel_test_utils.cc b/cc/test/pixel_test_utils.cc index ead2f6f..cedb386 100644 --- a/cc/test/pixel_test_utils.cc +++ b/cc/test/pixel_test_utils.cc @@ -14,9 +14,9 @@ namespace cc { -bool WritePNGFile(const SkBitmap& bitmap, const base::FilePath& file_path) { +bool WritePNGFile(const SkBitmap& bitmap, const base::FilePath& file_path, + bool discard_transparency) { std::vector<unsigned char> png_data; - const bool discard_transparency = true; if (gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, discard_transparency, &png_data) && @@ -37,7 +37,8 @@ bool ReadPNGFile(const base::FilePath& file_path, SkBitmap* bitmap) { bitmap); } -bool IsSameAsPNGFile(const SkBitmap& gen_bmp, base::FilePath ref_img_path) { +bool IsSameAsPNGFile(const SkBitmap& gen_bmp, base::FilePath ref_img_path, + bool discard_transparency) { SkBitmap ref_bmp; if (!ReadPNGFile(ref_img_path, &ref_bmp)) { LOG(ERROR) << "Cannot read reference image: " << ref_img_path.value(); @@ -60,7 +61,12 @@ bool IsSameAsPNGFile(const SkBitmap& gen_bmp, base::FilePath ref_img_path) { SkAutoLockPixels lock_ref_bmp(ref_bmp); // The reference images were saved with no alpha channel. Use the mask to // set alpha to 0. - uint32_t kAlphaMask = 0x00FFFFFF; + uint32_t kAlphaMask; + if (discard_transparency) + kAlphaMask = 0x00FFFFFF; + else + kAlphaMask = 0xFFFFFFFF; + for (int x = 0; x < gen_bmp.width(); ++x) { for (int y = 0; y < gen_bmp.height(); ++y) { if ((*gen_bmp.getAddr32(x, y) & kAlphaMask) != |