gfx/2d/SourceSurfaceSkia.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
michael@0 2 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef MOZILLA_GFX_SOURCESURFACESKIA_H_
michael@0 7 #define MOZILLA_GFX_SOURCESURFACESKIA_H_
michael@0 8
michael@0 9 #include "2D.h"
michael@0 10 #include <vector>
michael@0 11 #include "skia/SkCanvas.h"
michael@0 12 #include "skia/SkBitmap.h"
michael@0 13
michael@0 14 namespace mozilla {
michael@0 15 namespace gfx {
michael@0 16
michael@0 17 class DrawTargetSkia;
michael@0 18
michael@0 19 class SourceSurfaceSkia : public DataSourceSurface
michael@0 20 {
michael@0 21 public:
michael@0 22 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(DataSourceSurfaceSkia)
michael@0 23 SourceSurfaceSkia();
michael@0 24 ~SourceSurfaceSkia();
michael@0 25
michael@0 26 virtual SurfaceType GetType() const { return SurfaceType::SKIA; }
michael@0 27 virtual IntSize GetSize() const;
michael@0 28 virtual SurfaceFormat GetFormat() const;
michael@0 29
michael@0 30 SkBitmap& GetBitmap() { return mBitmap; }
michael@0 31
michael@0 32 bool InitFromData(unsigned char* aData,
michael@0 33 const IntSize &aSize,
michael@0 34 int32_t aStride,
michael@0 35 SurfaceFormat aFormat);
michael@0 36
michael@0 37 bool InitFromCanvas(SkCanvas* aCanvas,
michael@0 38 SurfaceFormat aFormat,
michael@0 39 DrawTargetSkia* aOwner);
michael@0 40
michael@0 41 virtual unsigned char *GetData();
michael@0 42
michael@0 43 virtual int32_t Stride() { return mStride; }
michael@0 44
michael@0 45 private:
michael@0 46 friend class DrawTargetSkia;
michael@0 47
michael@0 48 void DrawTargetWillChange();
michael@0 49 void MaybeUnlock();
michael@0 50
michael@0 51 SkBitmap mBitmap;
michael@0 52 SurfaceFormat mFormat;
michael@0 53 IntSize mSize;
michael@0 54 int32_t mStride;
michael@0 55 RefPtr<DrawTargetSkia> mDrawTarget;
michael@0 56 bool mLocked;
michael@0 57 };
michael@0 58
michael@0 59 }
michael@0 60 }
michael@0 61
michael@0 62 #endif /* MOZILLA_GFX_SOURCESURFACESKIA_H_ */

mercurial