| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "cc/tiles/gpu_image_decode_cache.h" | 5 #include "cc/tiles/gpu_image_decode_cache.h" |
| 6 | 6 |
| 7 #include "cc/paint/draw_image.h" | 7 #include "cc/paint/draw_image.h" |
| 8 #include "cc/test/test_context_provider.h" | 8 #include "cc/test/test_context_provider.h" |
| 9 #include "cc/test/test_tile_task_runner.h" | 9 #include "cc/test/test_tile_task_runner.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 ResourceFormat::RGBA_8888, | 25 ResourceFormat::RGBA_8888, |
| 26 kGpuMemoryLimitBytes, | 26 kGpuMemoryLimitBytes, |
| 27 kGpuMemoryLimitBytes) {} | 27 kGpuMemoryLimitBytes) {} |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 sk_sp<SkImage> CreateImage(int width, int height) { | 30 sk_sp<SkImage> CreateImage(int width, int height) { |
| 31 SkBitmap bitmap; | 31 SkBitmap bitmap; |
| 32 gfx::ColorSpace color_space = gfx::ColorSpace::CreateSRGB(); | 32 gfx::ColorSpace color_space = gfx::ColorSpace::CreateSRGB(); |
| 33 bitmap.allocPixels( | 33 bitmap.allocPixels( |
| 34 SkImageInfo::MakeN32Premul(width, height, color_space.ToSkColorSpace())); | 34 SkImageInfo::MakeN32Premul(width, height, color_space.ToSkColorSpace())); |
| 35 bitmap.eraseColor(0); |
| 35 return SkImage::MakeFromBitmap(bitmap); | 36 return SkImage::MakeFromBitmap(bitmap); |
| 36 } | 37 } |
| 37 | 38 |
| 38 SkMatrix CreateMatrix(const SkSize& scale, bool is_decomposable) { | 39 SkMatrix CreateMatrix(const SkSize& scale, bool is_decomposable) { |
| 39 SkMatrix matrix; | 40 SkMatrix matrix; |
| 40 matrix.setScale(scale.width(), scale.height()); | 41 matrix.setScale(scale.width(), scale.height()); |
| 41 | 42 |
| 42 if (!is_decomposable) { | 43 if (!is_decomposable) { |
| 43 // Perspective is not decomposable, add it. | 44 // Perspective is not decomposable, add it. |
| 44 matrix[SkMatrix::kMPersp0] = 0.1f; | 45 matrix[SkMatrix::kMPersp0] = 0.1f; |
| (...skipping 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1844 TestTileTaskRunner::ProcessTask(second_task->dependencies()[0].get()); | 1845 TestTileTaskRunner::ProcessTask(second_task->dependencies()[0].get()); |
| 1845 TestTileTaskRunner::ProcessTask(second_task.get()); | 1846 TestTileTaskRunner::ProcessTask(second_task.get()); |
| 1846 | 1847 |
| 1847 cache.UnrefImage(first_draw_image); | 1848 cache.UnrefImage(first_draw_image); |
| 1848 cache.UnrefImage(second_draw_image); | 1849 cache.UnrefImage(second_draw_image); |
| 1849 cache.UnrefImage(third_draw_image); | 1850 cache.UnrefImage(third_draw_image); |
| 1850 } | 1851 } |
| 1851 | 1852 |
| 1852 } // namespace | 1853 } // namespace |
| 1853 } // namespace cc | 1854 } // namespace cc |
| OLD | NEW |