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

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

Issue 171723007: add new copyTo version to SkBitmap, which takes SkColorType (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/image/SkImage_Gpu.cpp ('k') | src/images/SkDecodingImageGenerator.h » ('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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 } 120 }
121 121
122 bool SkImage_Raster::onReadPixels(SkBitmap* dst, const SkIRect& subset) const { 122 bool SkImage_Raster::onReadPixels(SkBitmap* dst, const SkIRect& subset) const {
123 if (dst->pixelRef()) { 123 if (dst->pixelRef()) {
124 return this->INHERITED::onReadPixels(dst, subset); 124 return this->INHERITED::onReadPixels(dst, subset);
125 } else { 125 } else {
126 SkBitmap src; 126 SkBitmap src;
127 if (!fBitmap.extractSubset(&src, subset)) { 127 if (!fBitmap.extractSubset(&src, subset)) {
128 return false; 128 return false;
129 } 129 }
130 return src.copyTo(dst, src.config()); 130 return src.copyTo(dst, src.colorType());
131 } 131 }
132 } 132 }
133 133
134 const void* SkImage_Raster::onPeekPixels(SkImageInfo* infoPtr, 134 const void* SkImage_Raster::onPeekPixels(SkImageInfo* infoPtr,
135 size_t* rowBytesPtr) const { 135 size_t* rowBytesPtr) const {
136 SkImageInfo info; 136 SkImageInfo info;
137 if (!fBitmap.asImageInfo(&info) || !fBitmap.getPixels()) { 137 if (!fBitmap.asImageInfo(&info) || !fBitmap.getPixels()) {
138 return NULL; 138 return NULL;
139 } 139 }
140 *infoPtr = info; 140 *infoPtr = info;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 } 189 }
190 190
191 SkImage* SkNewImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr, 191 SkImage* SkNewImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr,
192 size_t rowBytes) { 192 size_t rowBytes) {
193 return SkNEW_ARGS(SkImage_Raster, (info, pr, rowBytes)); 193 return SkNEW_ARGS(SkImage_Raster, (info, pr, rowBytes));
194 } 194 }
195 195
196 SkPixelRef* SkBitmapImageGetPixelRef(SkImage* image) { 196 SkPixelRef* SkBitmapImageGetPixelRef(SkImage* image) {
197 return ((SkImage_Raster*)image)->getPixelRef(); 197 return ((SkImage_Raster*)image)->getPixelRef();
198 } 198 }
OLDNEW
« no previous file with comments | « src/image/SkImage_Gpu.cpp ('k') | src/images/SkDecodingImageGenerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698