| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ui/gfx/ozone/impl/file_surface_factory.h" | 5 #include "ui/gfx/ozone/impl/file_surface_factory.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 11 #include "base/threading/worker_pool.h" | 11 #include "base/threading/worker_pool.h" |
| 12 #include "third_party/skia/include/core/SkBitmapDevice.h" | 12 #include "third_party/skia/include/core/SkBitmapDevice.h" |
| 13 #include "third_party/skia/include/core/SkDevice.h" | 13 #include "third_party/skia/include/core/SkDevice.h" |
| 14 #include "ui/gfx/codec/png_codec.h" | 14 #include "ui/gfx/codec/png_codec.h" |
| 15 #include "ui/gfx/vsync_provider.h" | 15 #include "ui/gfx/vsync_provider.h" |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 void WriteDataToFile(const base::FilePath& location, | 19 void WriteDataToFile(const base::FilePath& location, |
| 20 const SkBitmap& bitmap) { | 20 const SkBitmap& bitmap) { |
| 21 std::vector<unsigned char> png_data; | 21 std::vector<unsigned char> png_data; |
| 22 gfx::PNGCodec::FastEncodeBGRASkBitmap(bitmap, true, &png_data); | 22 gfx::PNGCodec::FastEncodeBGRASkBitmap(bitmap, true, &png_data); |
| 23 file_util::WriteFile(location, | 23 base::WriteFile(location, |
| 24 (char*)vector_as_array(&png_data), | 24 static_cast<const char*>(vector_as_array(&png_data)), |
| 25 png_data.size()); | 25 png_data.size()); |
| 26 } | 26 } |
| 27 | 27 |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace gfx { | 30 namespace gfx { |
| 31 | 31 |
| 32 FileSurfaceFactory::FileSurfaceFactory( | 32 FileSurfaceFactory::FileSurfaceFactory( |
| 33 const base::FilePath& dump_location) | 33 const base::FilePath& dump_location) |
| 34 : location_(dump_location) { | 34 : location_(dump_location) { |
| 35 CHECK(!base::DirectoryExists(location_)) | 35 CHECK(!base::DirectoryExists(location_)) |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 SkCanvas* FileSurfaceFactory::GetCanvasForWidget(AcceleratedWidget w) { | 89 SkCanvas* FileSurfaceFactory::GetCanvasForWidget(AcceleratedWidget w) { |
| 90 return canvas_.get(); | 90 return canvas_.get(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 scoped_ptr<VSyncProvider> FileSurfaceFactory::CreateVSyncProvider( | 93 scoped_ptr<VSyncProvider> FileSurfaceFactory::CreateVSyncProvider( |
| 94 AcceleratedWidget w) { | 94 AcceleratedWidget w) { |
| 95 return scoped_ptr<VSyncProvider>(); | 95 return scoped_ptr<VSyncProvider>(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace gfx | 98 } // namespace gfx |
| OLD | NEW |