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 #ifdef SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR 13 // Takes ownership of pixels. 14 ETC1PixelRef::ETC1PixelRef(scoped_ptr<uint8_t[]> pixels) 15 : pixels_(pixels.Pass()) { 16 setImmutable(); 17 } 18 #endif 19 20 // Takes ownership of pixels. 21 ETC1PixelRef::ETC1PixelRef(const SkImageInfo& info, 22 scoped_ptr<uint8_t[]> pixels) 23 : SkPixelRef(info), pixels_(pixels.Pass()) { 24 setImmutable(); 25 } 26 27 ETC1PixelRef::~ETC1PixelRef() {} 28 29 void* ETC1PixelRef::onLockPixels(SkColorTable** color_table) { 30 *color_table = NULL; 31 return static_cast<void*>(pixels_.get()); 32 } 33 34 void ETC1PixelRef::onUnlockPixels() {} 35 36 SkFlattenable::Factory ETC1PixelRef::getFactory() const { return NULL; } 37 38 } // namespace cc 39