gfx/layers/basic/BasicCanvasLayer.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/layers/basic/BasicCanvasLayer.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,51 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef GFX_BASICCANVASLAYER_H
    1.10 +#define GFX_BASICCANVASLAYER_H
    1.11 +
    1.12 +#include "BasicImplData.h"              // for BasicImplData
    1.13 +#include "BasicLayers.h"                // for BasicLayerManager
    1.14 +#include "CopyableCanvasLayer.h"        // for CopyableCanvasLayer
    1.15 +#include "Layers.h"                     // for CanvasLayer, etc
    1.16 +#include "nsDebug.h"                    // for NS_ASSERTION
    1.17 +#include "nsRegion.h"                   // for nsIntRegion
    1.18 +
    1.19 +class gfxContext;
    1.20 +
    1.21 +namespace mozilla {
    1.22 +namespace layers {
    1.23 +
    1.24 +class BasicCanvasLayer : public CopyableCanvasLayer,
    1.25 +                         public BasicImplData
    1.26 +{
    1.27 +public:
    1.28 +  BasicCanvasLayer(BasicLayerManager* aLayerManager) :
    1.29 +    CopyableCanvasLayer(aLayerManager,
    1.30 +                        static_cast<BasicImplData*>(MOZ_THIS_IN_INITIALIZER_LIST()))
    1.31 +  { }
    1.32 +  
    1.33 +  virtual void SetVisibleRegion(const nsIntRegion& aRegion)
    1.34 +  {
    1.35 +    NS_ASSERTION(BasicManager()->InConstruction(),
    1.36 +                 "Can only set properties in construction phase");
    1.37 +    CanvasLayer::SetVisibleRegion(aRegion);
    1.38 +  }
    1.39 +  
    1.40 +  virtual void Paint(gfx::DrawTarget* aDT,
    1.41 +                     const gfx::Point& aDeviceOffset,
    1.42 +                     Layer* aMaskLayer) MOZ_OVERRIDE;
    1.43 + 
    1.44 +protected:
    1.45 +  BasicLayerManager* BasicManager()
    1.46 +  {
    1.47 +    return static_cast<BasicLayerManager*>(mManager);
    1.48 +  }
    1.49 +};
    1.50 +
    1.51 +}
    1.52 +}
    1.53 +
    1.54 +#endif

mercurial