Chromium Code Reviews| Index: cc/resources/resource_provider.cc |
| diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc |
| index cf79940c44f36c87384c99fc9730c20d19e9411c..9b7d9b17ec294a5626c14f943d581e07723552a8 100644 |
| --- a/cc/resources/resource_provider.cc |
| +++ b/cc/resources/resource_provider.cc |
| @@ -109,25 +109,16 @@ GrPixelConfig ToGrPixelConfig(ResourceFormat format) { |
| return kSkia8888_GrPixelConfig; |
| } |
| -class IdentityAllocator : public SkBitmap::Allocator { |
| - public: |
| - explicit IdentityAllocator(void* buffer) : buffer_(buffer) {} |
| - virtual bool allocPixelRef(SkBitmap* dst, SkColorTable*) OVERRIDE { |
| - dst->setPixels(buffer_); |
| - return true; |
| - } |
| - |
| - private: |
| - void* buffer_; |
| -}; |
| - |
| void CopyBitmap(const SkBitmap& src, uint8_t* dst, SkColorType dst_colorType) { |
| - SkBitmap dst_bitmap; |
| - IdentityAllocator allocator(dst); |
| - src.copyTo(&dst_bitmap, dst_colorType, &allocator); |
| + SkImageInfo dst_info = src.info(); |
| + dst_info.fColorType = dst_colorType; |
|
enne (OOO)
2014/07/24 17:58:18
This was here before you, but you can you make thi
scroggo
2014/07/24 18:11:38
Done.
|
| // TODO(kaanb): The GL pipeline assumes a 4-byte alignment for the |
| - // bitmap data. This check will be removed once crbug.com/293728 is fixed. |
| - CHECK_EQ(0u, dst_bitmap.rowBytes() % 4); |
| + // bitmap data. There will be no need to call SkAlign4 once crbug.com/293728 |
| + // is fixed. |
| + const size_t dst_row_bytes = SkAlign4(dst_info.minRowBytes()); |
| + CHECK_EQ(0u, dst_row_bytes % 4); |
| + bool success = src.readPixels(dst_info, dst, dst_row_bytes, 0, 0); |
| + CHECK_EQ(true, success); |
| } |
| class ScopedSetActiveTexture { |