summaryrefslogtreecommitdiff
path: root/chromium/cc/resources/etc1_pixel_ref.h
blob: 166e185f533d119fa2529a3685f84bd122957939 (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
39
40
41
42
43
44
// 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:
#ifdef SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR
  // DEPRECATED -- will remove once blink updates to pass info
  // TODO(reed)
  explicit ETC1PixelRef(scoped_ptr<uint8_t[]> pixels);
#endif

  // Takes ownership of pixels.
  ETC1PixelRef(const SkImageInfo& info, 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_