summaryrefslogtreecommitdiff
path: root/image/SkDataPixelRef.h
blob: c2e52cd9e12ccb02b5bea2bf92a674927c7926c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * Copyright 2012 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkDataPixelRef_DEFINED
#define SkDataPixelRef_DEFINED

#include "SkPixelRef.h"

class SkData;

class SkDataPixelRef : public SkPixelRef {
public:
            SkDataPixelRef(const SkImageInfo&, SkData* data, size_t rowBytes);
    virtual ~SkDataPixelRef();

    SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDataPixelRef)

protected:
    virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE;
    virtual void onUnlockPixels() SK_OVERRIDE;
    virtual size_t getAllocatedSizeInBytes() const SK_OVERRIDE;

    SkDataPixelRef(SkFlattenableReadBuffer& buffer);
    virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;

private:
    SkData*     fData;
    size_t      fRB;

    typedef SkPixelRef INHERITED;
};

#endif