| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ozone/platform/caca/caca_surface_factory.h" | 5 #include "ui/ozone/platform/caca/caca_surface_factory.h" |
| 6 | 6 |
| 7 #include "third_party/skia/include/core/SkBitmap.h" | 7 #include "third_party/skia/include/core/SkBitmap.h" |
| 8 #include "third_party/skia/include/core/SkCanvas.h" | 8 #include "third_party/skia/include/core/SkCanvas.h" |
| 9 #include "third_party/skia/include/core/SkSurface.h" | 9 #include "third_party/skia/include/core/SkSurface.h" |
| 10 #include "ui/gfx/skia_util.h" | 10 #include "ui/gfx/skia_util.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 CacaSurface::CacaSurface(CacaConnection* connection) | 44 CacaSurface::CacaSurface(CacaConnection* connection) |
| 45 : connection_(connection) {} | 45 : connection_(connection) {} |
| 46 | 46 |
| 47 CacaSurface::~CacaSurface() { | 47 CacaSurface::~CacaSurface() { |
| 48 caca_free_dither(dither_); | 48 caca_free_dither(dither_); |
| 49 } | 49 } |
| 50 | 50 |
| 51 bool CacaSurface::Initialize() { | 51 bool CacaSurface::Initialize() { |
| 52 SkImageInfo info = SkImageInfo::Make(connection_->bitmap_size().width(), | 52 SkImageInfo info = SkImageInfo::Make(connection_->bitmap_size().width(), |
| 53 connection_->bitmap_size().height(), | 53 connection_->bitmap_size().height(), |
| 54 kPMColor_SkColorType, | 54 kN32_SkColorType, |
| 55 kPremul_SkAlphaType); | 55 kPremul_SkAlphaType); |
| 56 | 56 |
| 57 surface_ = skia::AdoptRef(SkSurface::NewRaster(info)); | 57 surface_ = skia::AdoptRef(SkSurface::NewRaster(info)); |
| 58 if (!surface_) { | 58 if (!surface_) { |
| 59 LOG(ERROR) << "Failed to create SkCanvas"; | 59 LOG(ERROR) << "Failed to create SkCanvas"; |
| 60 return false; | 60 return false; |
| 61 } | 61 } |
| 62 | 62 |
| 63 dither_ = caca_create_dither( | 63 dither_ = caca_create_dither( |
| 64 info.bytesPerPixel() * 8, | 64 info.bytesPerPixel() * 8, |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 gfx::AcceleratedWidget widget) { | 138 gfx::AcceleratedWidget widget) { |
| 139 CHECK_EQ(INITIALIZED, state_); | 139 CHECK_EQ(INITIALIZED, state_); |
| 140 CHECK_EQ(kDefaultWidgetHandle, widget); | 140 CHECK_EQ(kDefaultWidgetHandle, widget); |
| 141 | 141 |
| 142 scoped_ptr<CacaSurface> canvas(new CacaSurface(connection_)); | 142 scoped_ptr<CacaSurface> canvas(new CacaSurface(connection_)); |
| 143 CHECK(canvas->Initialize()); | 143 CHECK(canvas->Initialize()); |
| 144 return canvas.PassAs<ui::SurfaceOzoneCanvas>(); | 144 return canvas.PassAs<ui::SurfaceOzoneCanvas>(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace ui | 147 } // namespace ui |
| OLD | NEW |