OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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/resources/ui_resource_bitmap.h" | 5 #include "cc/resources/ui_resource_bitmap.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 SkAlphaType alphaType = is_opaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType; | 74 SkAlphaType alphaType = is_opaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType; |
75 SkImageInfo info = | 75 SkImageInfo info = |
76 SkImageInfo::MakeN32(size.width(), size.height(), alphaType); | 76 SkImageInfo::MakeN32(size.width(), size.height(), alphaType); |
77 sk_sp<SkPixelRef> pixel_ref( | 77 sk_sp<SkPixelRef> pixel_ref( |
78 SkMallocPixelRef::MakeAllocate(info, info.minRowBytes(), NULL)); | 78 SkMallocPixelRef::MakeAllocate(info, info.minRowBytes(), NULL)); |
79 pixel_ref->setImmutable(); | 79 pixel_ref->setImmutable(); |
80 Create(std::move(pixel_ref), size, UIResourceBitmap::RGBA8); | 80 Create(std::move(pixel_ref), size, UIResourceBitmap::RGBA8); |
81 SetOpaque(is_opaque); | 81 SetOpaque(is_opaque); |
82 } | 82 } |
83 | 83 |
84 UIResourceBitmap::UIResourceBitmap(sk_sp<SkPixelRef> pixel_ref, | |
85 const gfx::Size& size) { | |
86 Create(std::move(pixel_ref), size, UIResourceBitmap::ETC1); | |
87 } | |
88 | |
89 UIResourceBitmap::UIResourceBitmap(const UIResourceBitmap& other) = default; | 84 UIResourceBitmap::UIResourceBitmap(const UIResourceBitmap& other) = default; |
90 | 85 |
91 UIResourceBitmap::~UIResourceBitmap() {} | 86 UIResourceBitmap::~UIResourceBitmap() {} |
92 } // namespace cc | 87 } // namespace cc |
OLD | NEW |