• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "ui/gfx/ozone/surface_factory_ozone.h"
6 
7 #include <stdlib.h>
8 
9 #include "base/command_line.h"
10 
11 namespace gfx {
12 
13 // static
14 SurfaceFactoryOzone* SurfaceFactoryOzone::impl_ = NULL;
15 
16 class SurfaceFactoryOzoneStub : public SurfaceFactoryOzone {
17  public:
SurfaceFactoryOzoneStub()18   SurfaceFactoryOzoneStub() {}
~SurfaceFactoryOzoneStub()19   virtual ~SurfaceFactoryOzoneStub() {}
20 
InitializeHardware()21   virtual HardwareState InitializeHardware() OVERRIDE { return INITIALIZED; }
ShutdownHardware()22   virtual void ShutdownHardware() OVERRIDE {}
GetAcceleratedWidget()23   virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE { return 0; }
RealizeAcceleratedWidget(gfx::AcceleratedWidget w)24   virtual gfx::AcceleratedWidget RealizeAcceleratedWidget(
25       gfx::AcceleratedWidget w) OVERRIDE {
26     return 0;
27   }
LoadEGLGLES2Bindings(AddGLLibraryCallback add_gl_library,SetGLGetProcAddressProcCallback set_gl_get_proc_address)28   virtual bool LoadEGLGLES2Bindings(
29       AddGLLibraryCallback add_gl_library,
30       SetGLGetProcAddressProcCallback set_gl_get_proc_address) OVERRIDE {
31     return true;
32   }
AttemptToResizeAcceleratedWidget(gfx::AcceleratedWidget w,const gfx::Rect & bounds)33   virtual bool AttemptToResizeAcceleratedWidget(
34       gfx::AcceleratedWidget w,
35       const gfx::Rect& bounds) OVERRIDE {
36     return false;
37   }
GetVSyncProvider(gfx::AcceleratedWidget w)38   virtual gfx::VSyncProvider* GetVSyncProvider(
39       gfx::AcceleratedWidget w) OVERRIDE {
40     return NULL;
41   }
42 };
43 
SurfaceFactoryOzone()44 SurfaceFactoryOzone::SurfaceFactoryOzone() {
45 }
46 
~SurfaceFactoryOzone()47 SurfaceFactoryOzone::~SurfaceFactoryOzone() {
48 }
49 
GetInstance()50 SurfaceFactoryOzone* SurfaceFactoryOzone::GetInstance() {
51   CHECK(impl_) << "No SurfaceFactoryOzone implementation set.";
52   return impl_;
53 }
54 
SetInstance(SurfaceFactoryOzone * impl)55 void SurfaceFactoryOzone::SetInstance(SurfaceFactoryOzone* impl) {
56   impl_ = impl;
57 }
58 
DefaultDisplaySpec()59 const char* SurfaceFactoryOzone::DefaultDisplaySpec() {
60   char* envvar = getenv("ASH_DISPLAY_SPEC");
61   if (envvar)
62     return envvar;
63   return  "720x1280*2";
64 }
65 
CreateDesktopScreen()66 gfx::Screen* SurfaceFactoryOzone::CreateDesktopScreen() {
67   return NULL;
68 }
69 
GetNativeDisplay()70 intptr_t SurfaceFactoryOzone::GetNativeDisplay() {
71   return 0;
72 }
73 
SchedulePageFlip(gfx::AcceleratedWidget w)74 bool SurfaceFactoryOzone::SchedulePageFlip(gfx::AcceleratedWidget w) {
75   return true;
76 }
77 
GetCanvasForWidget(gfx::AcceleratedWidget w)78 SkCanvas* SurfaceFactoryOzone::GetCanvasForWidget(gfx::AcceleratedWidget w) {
79   return NULL;
80 }
81 
GetEGLSurfaceProperties(const int32 * desired_attributes)82 const int32* SurfaceFactoryOzone::GetEGLSurfaceProperties(
83     const int32* desired_attributes) {
84   return desired_attributes;
85 }
86 
87 // static
CreateTestHelper()88 SurfaceFactoryOzone* SurfaceFactoryOzone::CreateTestHelper() {
89   return new SurfaceFactoryOzoneStub;
90 }
91 
92 }  // namespace gfx
93