Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: src/image/SkImage_Raster.cpp

Issue 300263005: Revert "Revert of add colortable support to imagegenerator (https://codereview.chromium.org/3044430… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/SkBlurMaskFilter.cpp ('k') | src/images/SkDecodingImageGenerator.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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);
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
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 }
OLDNEW
« no previous file with comments | « src/effects/SkBlurMaskFilter.cpp ('k') | src/images/SkDecodingImageGenerator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698