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/SkSurface.cpp

Issue 789993002: add readPixels to SkSurface (later try to remove it from SkCanvas) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « include/core/SkSurface.h ('k') | no next file » | 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 163
164 void SkSurface::draw(SkCanvas* canvas, SkScalar x, SkScalar y, 164 void SkSurface::draw(SkCanvas* canvas, SkScalar x, SkScalar y,
165 const SkPaint* paint) { 165 const SkPaint* paint) {
166 return asSB(this)->onDraw(canvas, x, y, paint); 166 return asSB(this)->onDraw(canvas, x, y, paint);
167 } 167 }
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,
174 int srcX, int srcY) {
175 return this->getCanvas()->readPixels(dstInfo, dstPixels, dstRowBytes, srcX, srcY);
176 }
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
173 //////////////////////////////////////////////////////////////////////////////// ////// 187 //////////////////////////////////////////////////////////////////////////////// //////
174 #ifdef SK_SUPPORT_LEGACY_TEXTRENDERMODE 188 #ifdef SK_SUPPORT_LEGACY_TEXTRENDERMODE
175 189
176 static SkSurfaceProps make_props(SkSurface::TextRenderMode trm) { 190 static SkSurfaceProps make_props(SkSurface::TextRenderMode trm) {
177 uint32_t propsFlags = 0; 191 uint32_t propsFlags = 0;
178 if (SkSurface::kDistanceField_TextRenderMode == trm) { 192 if (SkSurface::kDistanceField_TextRenderMode == trm) {
179 propsFlags |= SkSurfaceProps::kUseDistanceFieldFonts_Flag; 193 propsFlags |= SkSurfaceProps::kUseDistanceFieldFonts_Flag;
180 } 194 }
181 return SkSurfaceProps(propsFlags, SkSurfaceProps::kLegacyFontHost_InitType); 195 return SkSurfaceProps(propsFlags, SkSurfaceProps::kLegacyFontHost_InitType);
182 } 196 }
(...skipping 26 matching lines...) Expand all
209 SkSurface* SkSurface::NewRenderTarget(GrContext*, const SkImageInfo&, int, const SkSurfaceProps*) { 223 SkSurface* SkSurface::NewRenderTarget(GrContext*, const SkImageInfo&, int, const SkSurfaceProps*) {
210 return NULL; 224 return NULL;
211 } 225 }
212 226
213 SkSurface* SkSurface::NewScratchRenderTarget(GrContext*, const SkImageInfo&, int sampleCount, 227 SkSurface* SkSurface::NewScratchRenderTarget(GrContext*, const SkImageInfo&, int sampleCount,
214 const SkSurfaceProps*) { 228 const SkSurfaceProps*) {
215 return NULL; 229 return NULL;
216 } 230 }
217 231
218 #endif 232 #endif
OLDNEW
« no previous file with comments | « include/core/SkSurface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698