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 #ifndef CC_RESOURCES_ETC1_PIXEL_REF_H_ 6 #define CC_RESOURCES_ETC1_PIXEL_REF_H_ 7 8 #include "base/basictypes.h" 9 #include "base/compiler_specific.h" 10 #include "base/memory/scoped_ptr.h" 11 #include "cc/base/cc_export.h" 12 #include "third_party/skia/include/core/SkPixelRef.h" 13 14 namespace cc { 15 16 class CC_EXPORT ETC1PixelRef : public SkPixelRef { 17 public: 18 #ifdef SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR 19 // DEPRECATED -- will remove once blink updates to pass info 20 // TODO(reed) 21 explicit ETC1PixelRef(scoped_ptr<uint8_t[]> pixels); 22 #endif 23 24 // Takes ownership of pixels. 25 ETC1PixelRef(const SkImageInfo& info, scoped_ptr<uint8_t[]> pixels); 26 virtual ~ETC1PixelRef(); 27 28 // SK_DECLARE_UNFLATTENABLE_OBJECT 29 virtual Factory getFactory() const OVERRIDE; 30 31 protected: 32 // Implementation of SkPixelRef. 33 virtual void* onLockPixels(SkColorTable** color_table) OVERRIDE; 34 virtual void onUnlockPixels() OVERRIDE; 35 36 private: 37 scoped_ptr<uint8_t[]> pixels_; 38 39 DISALLOW_COPY_AND_ASSIGN(ETC1PixelRef); 40 }; 41 42 } // namespace cc 43 44 #endif // CC_RESOURCES_ETC1_PIXEL_REF_H_ 45