gfx/layers/basic/AutoMaskData.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     2  * This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef GFX_AUTOMASKDATA_H_
     7 #define GFX_AUTOMASKDATA_H_
     9 #include "mozilla/layers/LayersSurfaces.h"  // for SurfaceDescriptor
    11 namespace mozilla {
    12 namespace layers {
    14 /**
    15  * Drawing with a mask requires a mask surface and a transform.
    16  *
    17  * This helper class manages the SourceSurface logic.
    18  */
    19 class MOZ_STACK_CLASS AutoMoz2DMaskData {
    20 public:
    21   AutoMoz2DMaskData() { }
    22   ~AutoMoz2DMaskData() { }
    24   void Construct(const gfx::Matrix& aTransform,
    25                  gfx::SourceSurface* aSurface)
    26   {
    27     MOZ_ASSERT(!IsConstructed());
    28     mTransform = aTransform;
    29     mSurface = aSurface;
    30   }
    32   gfx::SourceSurface* GetSurface()
    33   {
    34     MOZ_ASSERT(IsConstructed());
    35     return mSurface.get();
    36   }
    38   const gfx::Matrix& GetTransform()
    39   {
    40     MOZ_ASSERT(IsConstructed());
    41     return mTransform;
    42   }
    44 private:
    45   bool IsConstructed()
    46   {
    47     return !!mSurface;
    48   }
    50   gfx::Matrix mTransform;
    51   RefPtr<gfx::SourceSurface> mSurface;
    53   AutoMoz2DMaskData(const AutoMoz2DMaskData&) MOZ_DELETE;
    54   AutoMoz2DMaskData& operator=(const AutoMoz2DMaskData&) MOZ_DELETE;
    55 };
    57 }
    58 }
    60 #endif // GFX_AUTOMASKDATA_H_

mercurial