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/ozone/surface_ozone_canvas.h" | 10 #include "ui/gfx/ozone/surface_ozone_canvas.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, |
65 info.width(), | 65 info.width(), |
66 info.height(), | 66 info.height(), |
67 SkBitmap::ComputeRowBytes(SkBitmap::kARGB_8888_Config, info.width()), | 67 info.minRowBytes(), |
68 0x00ff0000, | 68 0x00ff0000, |
69 0x0000ff00, | 69 0x0000ff00, |
70 0x000000ff, | 70 0x000000ff, |
71 0xff000000); | 71 0xff000000); |
72 | 72 |
73 return true; | 73 return true; |
74 } | 74 } |
75 | 75 |
76 skia::RefPtr<SkCanvas> CacaSurface::GetCanvas() { | 76 skia::RefPtr<SkCanvas> CacaSurface::GetCanvas() { |
77 return skia::SharePtr<SkCanvas>(surface_->getCanvas()); | 77 return skia::SharePtr<SkCanvas>(surface_->getCanvas()); |
(...skipping 60 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<gfx::SurfaceOzoneCanvas>(); | 144 return canvas.PassAs<gfx::SurfaceOzoneCanvas>(); |
145 } | 145 } |
146 | 146 |
147 } // namespace ui | 147 } // namespace ui |
OLD | NEW |