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

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

Issue 110503003: PixelRef now returns (nearly) everything that is currently in SkBitmap. The goal is to refactor bit… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « src/image/SkDataPixelRef.cpp ('k') | src/image/SkSurface_Raster.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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 static SkImage* gEmpty; 77 static SkImage* gEmpty;
78 if (NULL == gEmpty) { 78 if (NULL == gEmpty) {
79 gEmpty = SkNEW(SkImage_Raster); 79 gEmpty = SkNEW(SkImage_Raster);
80 } 80 }
81 gEmpty->ref(); 81 gEmpty->ref();
82 return gEmpty; 82 return gEmpty;
83 } 83 }
84 84
85 SkImage_Raster::SkImage_Raster(const Info& info, SkData* data, size_t rowBytes) 85 SkImage_Raster::SkImage_Raster(const Info& info, SkData* data, size_t rowBytes)
86 : INHERITED(info.fWidth, info.fHeight) { 86 : INHERITED(info.fWidth, info.fHeight) {
87 SkBitmap::Config config = SkImageInfoToBitmapConfig(info); 87 fBitmap.setConfig(info, rowBytes);
88 88 fBitmap.setPixelRef(SkNEW_ARGS(SkDataPixelRef, (info, data, rowBytes)))->unr ef();
89 fBitmap.setConfig(config, info.fWidth, info.fHeight, rowBytes, info.fAlphaTy pe);
90 fBitmap.setPixelRef(SkNEW_ARGS(SkDataPixelRef, (data)))->unref();
91 fBitmap.setImmutable(); 89 fBitmap.setImmutable();
92 } 90 }
93 91
94 SkImage_Raster::SkImage_Raster(const Info& info, SkPixelRef* pr, size_t rowBytes ) 92 SkImage_Raster::SkImage_Raster(const Info& info, SkPixelRef* pr, size_t rowBytes )
95 : INHERITED(info.fWidth, info.fHeight) { 93 : INHERITED(info.fWidth, info.fHeight) {
96 SkBitmap::Config config = SkImageInfoToBitmapConfig(info); 94 SkBitmap::Config config = SkImageInfoToBitmapConfig(info);
97 95
98 fBitmap.setConfig(config, info.fWidth, info.fHeight, rowBytes, info.fAlphaTy pe); 96 fBitmap.setConfig(config, info.fWidth, info.fHeight, rowBytes, info.fAlphaTy pe);
99 fBitmap.setPixelRef(pr); 97 fBitmap.setPixelRef(pr);
100 } 98 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 155 }
158 156
159 SkImage* SkNewImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr, 157 SkImage* SkNewImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr,
160 size_t rowBytes) { 158 size_t rowBytes) {
161 return SkNEW_ARGS(SkImage_Raster, (info, pr, rowBytes)); 159 return SkNEW_ARGS(SkImage_Raster, (info, pr, rowBytes));
162 } 160 }
163 161
164 SkPixelRef* SkBitmapImageGetPixelRef(SkImage* image) { 162 SkPixelRef* SkBitmapImageGetPixelRef(SkImage* image) {
165 return ((SkImage_Raster*)image)->getPixelRef(); 163 return ((SkImage_Raster*)image)->getPixelRef();
166 } 164 }
OLDNEW
« no previous file with comments | « src/image/SkDataPixelRef.cpp ('k') | src/image/SkSurface_Raster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698