Bug 988309 - Add nsRenderingContext constructor for a DrawTarget. r=roc, a=sledru
authorMatt Woodrow <mwoodrow@mozilla.com>
Mon, 07 Apr 2014 15:47:06 +1200
changeset 183764 843dc71f729b
parent 183763 a27d9f49afac
child 183765 55422890fb8f
push id3476
push userryanvm@gmail.com
push date2014-04-15 17:26 +0000
treeherdermozilla-beta@c8f1a4f5ca4d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, sledru
bugs988309
milestone29.0
Bug 988309 - Add nsRenderingContext constructor for a DrawTarget. r=roc, a=sledru
gfx/src/nsRenderingContext.cpp
gfx/src/nsRenderingContext.h
--- a/gfx/src/nsRenderingContext.cpp
+++ b/gfx/src/nsRenderingContext.cpp
@@ -78,16 +78,23 @@ nsRenderingContext::Init(nsDeviceContext
 {
     mDeviceContext = aContext;
     mThebes = aThebesContext;
 
     mThebes->SetLineWidth(1.0);
     mP2A = mDeviceContext->AppUnitsPerDevPixel();
 }
 
+void
+nsRenderingContext::Init(nsDeviceContext* aContext,
+                         DrawTarget *aDrawTarget)
+{
+    Init(aContext, new gfxContext(aDrawTarget));
+}
+
 //
 // graphics state
 //
 
 void
 nsRenderingContext::PushState()
 {
     mThebes->Save();
--- a/gfx/src/nsRenderingContext.h
+++ b/gfx/src/nsRenderingContext.h
@@ -43,16 +43,17 @@ class nsRenderingContext
 public:
     nsRenderingContext() : mP2A(0.) {}
     // ~nsRenderingContext() {}
 
     NS_INLINE_DECL_REFCOUNTING(nsRenderingContext)
 
     void Init(nsDeviceContext* aContext, gfxASurface* aThebesSurface);
     void Init(nsDeviceContext* aContext, gfxContext* aThebesContext);
+    void Init(nsDeviceContext* aContext, DrawTarget* aDrawTarget);
 
     // These accessors will never return null.
     gfxContext *ThebesContext() { return mThebes; }
     DrawTarget *GetDrawTarget() { return mThebes->GetDrawTarget(); }
     nsDeviceContext *DeviceContext() { return mDeviceContext; }
     int32_t AppUnitsPerDevPixel() { return NSToIntRound(mP2A); }
 
     // Graphics state