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 191812 65566909c15a1083342b3ba0da17a8f8f17a9c32
parent 191811 58eb097f355413ae96e1655719fccdf748508fee
child 191813 668a99c8678e3534858f4eb2fda8f0a6adf2056a
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, sledru
bugs988309
milestone30.0a2
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