OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkImage_Base.h" | 8 #include "SkImage_Base.h" |
9 #include "SkImagePriv.h" | 9 #include "SkImagePriv.h" |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 static void release_data(void* addr, void* context) { | 87 static void release_data(void* addr, void* context) { |
88 SkData* data = static_cast<SkData*>(context); | 88 SkData* data = static_cast<SkData*>(context); |
89 data->unref(); | 89 data->unref(); |
90 } | 90 } |
91 | 91 |
92 SkImage_Raster::SkImage_Raster(const Info& info, SkData* data, size_t rowBytes) | 92 SkImage_Raster::SkImage_Raster(const Info& info, SkData* data, size_t rowBytes) |
93 : INHERITED(info.fWidth, info.fHeight) | 93 : INHERITED(info.fWidth, info.fHeight) |
94 { | 94 { |
95 data->ref(); | 95 data->ref(); |
96 void* addr = const_cast<void*>(data->data()); | 96 void* addr = const_cast<void*>(data->data()); |
97 SkColorTable* ctable = NULL; | |
97 | 98 |
98 fBitmap.installPixels(info, addr, rowBytes, release_data, data); | 99 fBitmap.installPixels(info, addr, rowBytes, ctable, release_data, data); |
scroggo
2014/05/28 18:16:36
Why not just pass NULL here?
reed1
2014/05/28 18:36:43
Documentation. Not required.
| |
99 fBitmap.setImmutable(); | 100 fBitmap.setImmutable(); |
100 fBitmap.lockPixels(); | 101 fBitmap.lockPixels(); |
101 } | 102 } |
102 | 103 |
103 SkImage_Raster::SkImage_Raster(const Info& info, SkPixelRef* pr, size_t rowBytes ) | 104 SkImage_Raster::SkImage_Raster(const Info& info, SkPixelRef* pr, size_t rowBytes ) |
104 : INHERITED(info.fWidth, info.fHeight) | 105 : INHERITED(info.fWidth, info.fHeight) |
105 { | 106 { |
106 fBitmap.setConfig(info, rowBytes); | 107 fBitmap.setConfig(info, rowBytes); |
107 fBitmap.setPixelRef(pr); | 108 fBitmap.setPixelRef(pr); |
108 fBitmap.lockPixels(); | 109 fBitmap.lockPixels(); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
189 } | 190 } |
190 | 191 |
191 SkImage* SkNewImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr, | 192 SkImage* SkNewImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr, |
192 size_t rowBytes) { | 193 size_t rowBytes) { |
193 return SkNEW_ARGS(SkImage_Raster, (info, pr, rowBytes)); | 194 return SkNEW_ARGS(SkImage_Raster, (info, pr, rowBytes)); |
194 } | 195 } |
195 | 196 |
196 SkPixelRef* SkBitmapImageGetPixelRef(SkImage* image) { | 197 SkPixelRef* SkBitmapImageGetPixelRef(SkImage* image) { |
197 return ((SkImage_Raster*)image)->getPixelRef(); | 198 return ((SkImage_Raster*)image)->getPixelRef(); |
198 } | 199 } |
OLD | NEW |