summaryrefslogtreecommitdiffstats
path: root/chromium/cc/resources/etc1_pixel_ref.cc
blob: 7176562317b430402607464d370a1b5c2c7e3ce1 (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.

#include "cc/resources/etc1_pixel_ref.h"

#include "base/memory/scoped_ptr.h"
#include "third_party/skia/include/core/SkPixelRef.h"

namespace cc {

#ifdef SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR
// Takes ownership of pixels.
ETC1PixelRef::ETC1PixelRef(scoped_ptr<uint8_t[]> pixels)
    : pixels_(pixels.Pass()) {
  setImmutable();
}
#endif

// Takes ownership of pixels.
ETC1PixelRef::ETC1PixelRef(const SkImageInfo& info,
                           scoped_ptr<uint8_t[]> pixels)
    : SkPixelRef(info), pixels_(pixels.Pass()) {
  setImmutable();
}

ETC1PixelRef::~ETC1PixelRef() {}

void* ETC1PixelRef::onLockPixels(SkColorTable** color_table) {
  *color_table = NULL;
  return static_cast<void*>(pixels_.get());
}

void ETC1PixelRef::onUnlockPixels() {}

SkFlattenable::Factory ETC1PixelRef::getFactory() const { return NULL; }

}  // namespace cc