summaryrefslogtreecommitdiffstats
path: root/cc/resources/etc1_pixel_ref.h
blob: c64d3a87a710c1f4e7366190c90e981fb8e7e452 (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
38
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CC_RESOURCES_ETC1_PIXEL_REF_H_
#define CC_RESOURCES_ETC1_PIXEL_REF_H_

#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "cc/base/cc_export.h"
#include "third_party/skia/include/core/SkPixelRef.h"

namespace cc {

class CC_EXPORT ETC1PixelRef : public SkPixelRef {
 public:
  // Takes ownership of pixels.
  explicit ETC1PixelRef(scoped_ptr<uint8_t[]> pixels);
  virtual ~ETC1PixelRef();

  // SK_DECLARE_UNFLATTENABLE_OBJECT
  virtual Factory getFactory() const OVERRIDE;

 protected:
  // Implementation of SkPixelRef.
  virtual void* onLockPixels(SkColorTable** color_table) OVERRIDE;
  virtual void onUnlockPixels() OVERRIDE;

 private:
  scoped_ptr<uint8_t[]> pixels_;

  DISALLOW_COPY_AND_ASSIGN(ETC1PixelRef);
};

}  // namespace cc

#endif  // CC_RESOURCES_ETC1_PIXEL_REF_H_