| 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" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 virtual void ResizeCanvas(const Size& viewport_size) OVERRIDE { | 38 virtual void ResizeCanvas(const Size& viewport_size) OVERRIDE { |
| 39 surface_ = skia::AdoptRef(SkSurface::NewRaster( | 39 surface_ = skia::AdoptRef(SkSurface::NewRaster( |
| 40 SkImageInfo::MakeN32Premul(viewport_size.width(), | 40 SkImageInfo::MakeN32Premul(viewport_size.width(), |
| 41 viewport_size.height()))); | 41 viewport_size.height()))); |
| 42 } | 42 } |
| 43 virtual skia::RefPtr<SkCanvas> GetCanvas() OVERRIDE { | 43 virtual skia::RefPtr<SkCanvas> GetCanvas() OVERRIDE { |
| 44 return skia::SharePtr(surface_->getCanvas()); | 44 return skia::SharePtr(surface_->getCanvas()); |
| 45 } | 45 } |
| 46 virtual void PresentCanvas(const gfx::Rect& damage) OVERRIDE { | 46 virtual void PresentCanvas(const gfx::Rect& damage) OVERRIDE { |
| 47 SkBitmap bitmap; | 47 SkBitmap bitmap; |
| 48 bitmap.setConfig(surface_->getCanvas()->imageInfo()); | 48 bitmap.setInfo(surface_->getCanvas()->imageInfo()); |
| 49 | 49 |
| 50 // TODO(dnicoara) Use SkImage instead to potentially avoid a copy. | 50 // TODO(dnicoara) Use SkImage instead to potentially avoid a copy. |
| 51 // See crbug.com/361605 for details. | 51 // See crbug.com/361605 for details. |
| 52 if (surface_->getCanvas()->readPixels(&bitmap, 0, 0)) { | 52 if (surface_->getCanvas()->readPixels(&bitmap, 0, 0)) { |
| 53 base::WorkerPool::PostTask( | 53 base::WorkerPool::PostTask( |
| 54 FROM_HERE, base::Bind(&WriteDataToFile, location_, bitmap), true); | 54 FROM_HERE, base::Bind(&WriteDataToFile, location_, bitmap), true); |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() OVERRIDE { | 57 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() OVERRIDE { |
| 58 return scoped_ptr<gfx::VSyncProvider>(); | 58 return scoped_ptr<gfx::VSyncProvider>(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 return make_scoped_ptr<SurfaceOzoneCanvas>(new FileSurface(location_)); | 92 return make_scoped_ptr<SurfaceOzoneCanvas>(new FileSurface(location_)); |
| 93 } | 93 } |
| 94 | 94 |
| 95 bool FileSurfaceFactory::LoadEGLGLES2Bindings( | 95 bool FileSurfaceFactory::LoadEGLGLES2Bindings( |
| 96 AddGLLibraryCallback add_gl_library, | 96 AddGLLibraryCallback add_gl_library, |
| 97 SetGLGetProcAddressProcCallback set_gl_get_proc_address) { | 97 SetGLGetProcAddressProcCallback set_gl_get_proc_address) { |
| 98 return false; | 98 return false; |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace gfx | 101 } // namespace gfx |
| OLD | NEW |