| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |