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

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

Issue 793723002: add readPixels to SkImage (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use better name on test Created 6 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
« no previous file with comments | « src/image/SkReadPixelsRec.h ('k') | tests/SurfaceTest.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 "SkSurface_Base.h" 8 #include "SkSurface_Base.h"
9 #include "SkImagePriv.h" 9 #include "SkImagePriv.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 const void* SkSurface::peekPixels(SkImageInfo* info, size_t* rowBytes) { 169 const void* SkSurface::peekPixels(SkImageInfo* info, size_t* rowBytes) {
170 return this->getCanvas()->peekPixels(info, rowBytes); 170 return this->getCanvas()->peekPixels(info, rowBytes);
171 } 171 }
172 172
173 bool SkSurface::readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t d stRowBytes, 173 bool SkSurface::readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t d stRowBytes,
174 int srcX, int srcY) { 174 int srcX, int srcY) {
175 return this->getCanvas()->readPixels(dstInfo, dstPixels, dstRowBytes, srcX, srcY); 175 return this->getCanvas()->readPixels(dstInfo, dstPixels, dstRowBytes, srcX, srcY);
176 } 176 }
177 177
178 bool SkSurface::readPixels(SkBitmap* dst, const SkIRect* srcRect) {
179 SkIRect storage;
180 if (NULL == srcRect) {
181 storage.set(0, 0, this->width(), this->height());
182 srcRect = &storage;
183 }
184 return this->getCanvas()->readPixels(*srcRect, dst);
185 }
186
187 //////////////////////////////////////////////////////////////////////////////// ////// 178 //////////////////////////////////////////////////////////////////////////////// //////
188 #ifdef SK_SUPPORT_LEGACY_TEXTRENDERMODE 179 #ifdef SK_SUPPORT_LEGACY_TEXTRENDERMODE
189 180
190 static SkSurfaceProps make_props(SkSurface::TextRenderMode trm) { 181 static SkSurfaceProps make_props(SkSurface::TextRenderMode trm) {
191 uint32_t propsFlags = 0; 182 uint32_t propsFlags = 0;
192 if (SkSurface::kDistanceField_TextRenderMode == trm) { 183 if (SkSurface::kDistanceField_TextRenderMode == trm) {
193 propsFlags |= SkSurfaceProps::kUseDistanceFieldFonts_Flag; 184 propsFlags |= SkSurfaceProps::kUseDistanceFieldFonts_Flag;
194 } 185 }
195 return SkSurfaceProps(propsFlags, SkSurfaceProps::kLegacyFontHost_InitType); 186 return SkSurfaceProps(propsFlags, SkSurfaceProps::kLegacyFontHost_InitType);
196 } 187 }
(...skipping 26 matching lines...) Expand all
223 SkSurface* SkSurface::NewRenderTarget(GrContext*, const SkImageInfo&, int, const SkSurfaceProps*) { 214 SkSurface* SkSurface::NewRenderTarget(GrContext*, const SkImageInfo&, int, const SkSurfaceProps*) {
224 return NULL; 215 return NULL;
225 } 216 }
226 217
227 SkSurface* SkSurface::NewScratchRenderTarget(GrContext*, const SkImageInfo&, int sampleCount, 218 SkSurface* SkSurface::NewScratchRenderTarget(GrContext*, const SkImageInfo&, int sampleCount,
228 const SkSurfaceProps*) { 219 const SkSurfaceProps*) {
229 return NULL; 220 return NULL;
230 } 221 }
231 222
232 #endif 223 #endif
OLDNEW
« no previous file with comments | « src/image/SkReadPixelsRec.h ('k') | tests/SurfaceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698