OLD | NEW |
| (Empty) |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "cc/resources/etc1_pixel_ref.h" | |
6 | |
7 #include "base/memory/scoped_ptr.h" | |
8 #include "third_party/skia/include/core/SkPixelRef.h" | |
9 | |
10 namespace cc { | |
11 | |
12 // Takes ownership of pixels. | |
13 ETC1PixelRef::ETC1PixelRef(const SkImageInfo& info, | |
14 size_t rowBytes, | |
15 scoped_ptr<uint8_t[]> pixels) | |
16 : SkPixelRef(info), rowBytes_(rowBytes), pixels_(pixels.Pass()) { | |
17 setImmutable(); | |
18 } | |
19 | |
20 ETC1PixelRef::~ETC1PixelRef() {} | |
21 | |
22 #ifdef SK_SUPPORT_LEGACY_ONLOCKPIXELS | |
23 void* ETC1PixelRef::onLockPixels(SkColorTable** color_table) { | |
24 *color_table = NULL; | |
25 return static_cast<void*>(pixels_.get()); | |
26 } | |
27 #endif | |
28 | |
29 bool ETC1PixelRef::onNewLockPixels(LockRec* rec) { | |
30 if (pixels_.get()) { | |
31 rec->fPixels = pixels_.get(); | |
32 rec->fColorTable = NULL; | |
33 rec->fRowBytes = rowBytes_; | |
34 return true; | |
35 } | |
36 return false; | |
37 } | |
38 | |
39 void ETC1PixelRef::onUnlockPixels() {} | |
40 | |
41 SkFlattenable::Factory ETC1PixelRef::getFactory() const { return NULL; } | |
42 | |
43 } // namespace cc | |
OLD | NEW |