| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/test/skia_common.h" | 5 #include "cc/test/skia_common.h" |
| 6 | 6 |
| 7 #include "cc/resources/picture.h" | 7 #include "cc/resources/picture.h" |
| 8 #include "skia/ext/refptr.h" | 8 #include "skia/ext/refptr.h" |
| 9 #include "third_party/skia/include/core/SkBitmapDevice.h" | 9 #include "third_party/skia/include/core/SkBitmapDevice.h" |
| 10 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
| 11 #include "ui/gfx/skia_util.h" | 11 #include "ui/gfx/skia_util.h" |
| 12 | 12 |
| 13 namespace cc { | 13 namespace cc { |
| 14 | 14 |
| 15 TestPixelRef::TestPixelRef(int width, int height) | 15 TestPixelRef::TestPixelRef(int width, int height) |
| 16 : pixels_(new char[4 * width * height]) {} | 16 : pixels_(new char[4 * width * height]) {} |
| 17 | 17 |
| 18 TestPixelRef::~TestPixelRef() {} | 18 TestPixelRef::~TestPixelRef() {} |
| 19 | 19 |
| 20 SkFlattenable::Factory TestPixelRef::getFactory() { return NULL; } | 20 SkFlattenable::Factory TestPixelRef::getFactory() const { return NULL; } |
| 21 | 21 |
| 22 void* TestPixelRef::onLockPixels(SkColorTable** color_table) { | 22 void* TestPixelRef::onLockPixels(SkColorTable** color_table) { |
| 23 return pixels_.get(); | 23 return pixels_.get(); |
| 24 } | 24 } |
| 25 | 25 |
| 26 SkPixelRef* TestPixelRef::deepCopy( | 26 SkPixelRef* TestPixelRef::deepCopy( |
| 27 SkBitmap::Config config, | 27 SkBitmap::Config config, |
| 28 const SkIRect* subset) { | 28 const SkIRect* subset) { |
| 29 this->ref(); | 29 this->ref(); |
| 30 return this; | 30 return this; |
| 31 } | 31 } |
| 32 | 32 |
| 33 | 33 |
| 34 TestLazyPixelRef::TestLazyPixelRef(int width, int height) | 34 TestLazyPixelRef::TestLazyPixelRef(int width, int height) |
| 35 : pixels_(new char[4 * width * height]) {} | 35 : pixels_(new char[4 * width * height]) {} |
| 36 | 36 |
| 37 TestLazyPixelRef::~TestLazyPixelRef() {} | 37 TestLazyPixelRef::~TestLazyPixelRef() {} |
| 38 | 38 |
| 39 SkFlattenable::Factory TestLazyPixelRef::getFactory() { return NULL; } | 39 SkFlattenable::Factory TestLazyPixelRef::getFactory() const { return NULL; } |
| 40 | 40 |
| 41 void* TestLazyPixelRef::onLockPixels(SkColorTable** color_table) { | 41 void* TestLazyPixelRef::onLockPixels(SkColorTable** color_table) { |
| 42 return pixels_.get(); | 42 return pixels_.get(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 bool TestLazyPixelRef::PrepareToDecode(const PrepareParams& params) { | 45 bool TestLazyPixelRef::PrepareToDecode(const PrepareParams& params) { |
| 46 return true; | 46 return true; |
| 47 } | 47 } |
| 48 | 48 |
| 49 bool TestLazyPixelRef::MaybeDecoded() { | 49 bool TestLazyPixelRef::MaybeDecoded() { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 77 lazy_pixel_ref->setURI(uri); | 77 lazy_pixel_ref->setURI(uri); |
| 78 | 78 |
| 79 bitmap->setConfig(SkBitmap::kARGB_8888_Config, | 79 bitmap->setConfig(SkBitmap::kARGB_8888_Config, |
| 80 size.width(), | 80 size.width(), |
| 81 size.height()); | 81 size.height()); |
| 82 bitmap->setPixelRef(lazy_pixel_ref.get()); | 82 bitmap->setPixelRef(lazy_pixel_ref.get()); |
| 83 } | 83 } |
| 84 | 84 |
| 85 | 85 |
| 86 } // namespace cc | 86 } // namespace cc |
| OLD | NEW |