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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "cc/output/software_frame_data.h" | 7 #include "cc/output/software_frame_data.h" |
8 #include "content/browser/compositor/software_output_device_ozone.h" | 8 #include "content/browser/compositor/software_output_device_ozone.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "third_party/skia/include/core/SkSurface.h" | 10 #include "third_party/skia/include/core/SkSurface.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 // gfx::SurfaceOzoneCanvas overrides: | 27 // gfx::SurfaceOzoneCanvas overrides: |
28 virtual bool ResizeCanvas(const gfx::Size& size) OVERRIDE { | 28 virtual bool ResizeCanvas(const gfx::Size& size) OVERRIDE { |
29 surface_ = skia::AdoptRef(SkSurface::NewRaster( | 29 surface_ = skia::AdoptRef(SkSurface::NewRaster( |
30 SkImageInfo::MakeN32Premul(size.width(), size.height()))); | 30 SkImageInfo::MakeN32Premul(size.width(), size.height()))); |
31 return true; | 31 return true; |
32 } | 32 } |
33 virtual skia::RefPtr<SkCanvas> GetCanvas() OVERRIDE { | 33 virtual skia::RefPtr<SkCanvas> GetCanvas() OVERRIDE { |
34 return skia::SharePtr(surface_->getCanvas()); | 34 return skia::SharePtr(surface_->getCanvas()); |
35 } | 35 } |
36 virtual bool PresentCanvas() OVERRIDE { | 36 virtual bool PresentCanvas(const gfx::Rect& damage) OVERRIDE { |
37 NOTIMPLEMENTED(); | 37 NOTIMPLEMENTED(); |
38 return true; | 38 return true; |
39 } | 39 } |
40 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() OVERRIDE { | 40 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() OVERRIDE { |
41 return scoped_ptr<gfx::VSyncProvider>(); | 41 return scoped_ptr<gfx::VSyncProvider>(); |
42 } | 42 } |
43 | 43 |
44 private: | 44 private: |
45 skia::RefPtr<SkSurface> surface_; | 45 skia::RefPtr<SkSurface> surface_; |
46 | 46 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 const SkPMColor black = SkPreMultiplyColor(SK_ColorBLACK); | 215 const SkPMColor black = SkPreMultiplyColor(SK_ColorBLACK); |
216 for (int i = 0; i < area.height(); ++i) { | 216 for (int i = 0; i < area.height(); ++i) { |
217 for (int j = 0; j < area.width(); ++j) { | 217 for (int j = 0; j < area.width(); ++j) { |
218 if (j < damage.width() && i < damage.height()) | 218 if (j < damage.width() && i < damage.height()) |
219 EXPECT_EQ(white, pixels[i * area.width() + j]); | 219 EXPECT_EQ(white, pixels[i * area.width() + j]); |
220 else | 220 else |
221 EXPECT_EQ(black, pixels[i * area.width() + j]); | 221 EXPECT_EQ(black, pixels[i * area.width() + j]); |
222 } | 222 } |
223 } | 223 } |
224 } | 224 } |
OLD | NEW |