Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1413)

Side by Side Diff: content/browser/compositor/software_output_device_ozone_unittest.cc

Issue 249413003: ozone: dri: Composite to intermediate surface & copy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: document damage calculation, remove success return from present/resize Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "ui/compositor/compositor.h" 11 #include "ui/compositor/compositor.h"
12 #include "ui/compositor/test/context_factories_for_test.h" 12 #include "ui/compositor/test/context_factories_for_test.h"
13 #include "ui/gfx/ozone/surface_factory_ozone.h" 13 #include "ui/gfx/ozone/surface_factory_ozone.h"
14 #include "ui/gfx/ozone/surface_ozone_canvas.h" 14 #include "ui/gfx/ozone/surface_ozone_canvas.h"
15 #include "ui/gfx/size.h" 15 #include "ui/gfx/size.h"
16 #include "ui/gfx/skia_util.h" 16 #include "ui/gfx/skia_util.h"
17 #include "ui/gfx/vsync_provider.h" 17 #include "ui/gfx/vsync_provider.h"
18 #include "ui/gl/gl_implementation.h" 18 #include "ui/gl/gl_implementation.h"
19 19
20 namespace { 20 namespace {
21 21
22 class MockSurfaceOzone : public gfx::SurfaceOzoneCanvas { 22 class MockSurfaceOzone : public gfx::SurfaceOzoneCanvas {
23 public: 23 public:
24 MockSurfaceOzone() {} 24 MockSurfaceOzone() {}
25 virtual ~MockSurfaceOzone() {} 25 virtual ~MockSurfaceOzone() {}
26 26
27 // gfx::SurfaceOzoneCanvas overrides: 27 // gfx::SurfaceOzoneCanvas overrides:
28 virtual bool ResizeCanvas(const gfx::Size& size) OVERRIDE { 28 virtual void 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;
32 } 31 }
33 virtual skia::RefPtr<SkCanvas> GetCanvas() OVERRIDE { 32 virtual skia::RefPtr<SkCanvas> GetCanvas() OVERRIDE {
34 return skia::SharePtr(surface_->getCanvas()); 33 return skia::SharePtr(surface_->getCanvas());
35 } 34 }
36 virtual bool PresentCanvas() OVERRIDE { 35 virtual void PresentCanvas(const gfx::Rect& damage) OVERRIDE {
37 NOTIMPLEMENTED(); 36 NOTIMPLEMENTED();
38 return true;
39 } 37 }
40 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() OVERRIDE { 38 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() OVERRIDE {
41 return scoped_ptr<gfx::VSyncProvider>(); 39 return scoped_ptr<gfx::VSyncProvider>();
42 } 40 }
43 41
44 private: 42 private:
45 skia::RefPtr<SkSurface> surface_; 43 skia::RefPtr<SkSurface> surface_;
46 44
47 DISALLOW_COPY_AND_ASSIGN(MockSurfaceOzone); 45 DISALLOW_COPY_AND_ASSIGN(MockSurfaceOzone);
48 }; 46 };
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 const SkPMColor black = SkPreMultiplyColor(SK_ColorBLACK); 213 const SkPMColor black = SkPreMultiplyColor(SK_ColorBLACK);
216 for (int i = 0; i < area.height(); ++i) { 214 for (int i = 0; i < area.height(); ++i) {
217 for (int j = 0; j < area.width(); ++j) { 215 for (int j = 0; j < area.width(); ++j) {
218 if (j < damage.width() && i < damage.height()) 216 if (j < damage.width() && i < damage.height())
219 EXPECT_EQ(white, pixels[i * area.width() + j]); 217 EXPECT_EQ(white, pixels[i * area.width() + j]);
220 else 218 else
221 EXPECT_EQ(black, pixels[i * area.width() + j]); 219 EXPECT_EQ(black, pixels[i * area.width() + j]);
222 } 220 }
223 } 221 }
224 } 222 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698