blob: c2e52cd9e12ccb02b5bea2bf92a674927c7926c1 [file] [log] [blame]
reed@google.comf6627b72012-07-27 18:02:50 +00001/*
2 * Copyright 2012 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkDataPixelRef_DEFINED
9#define SkDataPixelRef_DEFINED
10
11#include "SkPixelRef.h"
12
13class SkData;
14
15class SkDataPixelRef : public SkPixelRef {
16public:
reed@google.com473f0aa2013-12-06 20:31:45 +000017 SkDataPixelRef(const SkImageInfo&, SkData* data, size_t rowBytes);
reed@google.comf6627b72012-07-27 18:02:50 +000018 virtual ~SkDataPixelRef();
rmistry@google.comfbfcd562012-08-23 18:09:54 +000019
reed@google.comf6627b72012-07-27 18:02:50 +000020 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDataPixelRef)
rmistry@google.comfbfcd562012-08-23 18:09:54 +000021
reed@google.comf6627b72012-07-27 18:02:50 +000022protected:
reed@google.com473f0aa2013-12-06 20:31:45 +000023 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE;
reed@google.comf6627b72012-07-27 18:02:50 +000024 virtual void onUnlockPixels() SK_OVERRIDE;
commit-bot@chromium.orgcd3b15c2013-12-04 17:06:49 +000025 virtual size_t getAllocatedSizeInBytes() const SK_OVERRIDE;
rmistry@google.comfbfcd562012-08-23 18:09:54 +000026
reed@google.comf6627b72012-07-27 18:02:50 +000027 SkDataPixelRef(SkFlattenableReadBuffer& buffer);
28 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
rmistry@google.comfbfcd562012-08-23 18:09:54 +000029
reed@google.comf6627b72012-07-27 18:02:50 +000030private:
reed@google.com473f0aa2013-12-06 20:31:45 +000031 SkData* fData;
32 size_t fRB;
rmistry@google.comfbfcd562012-08-23 18:09:54 +000033
reed@google.comf6627b72012-07-27 18:02:50 +000034 typedef SkPixelRef INHERITED;
35};
36
37#endif