| 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkImagePriv.h" | 10 #include "SkImagePriv.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 SkSurface* SkSurface_Picture::onNewSurface(const SkImageInfo& info) { | 55 SkSurface* SkSurface_Picture::onNewSurface(const SkImageInfo& info) { |
| 56 return SkSurface::NewPicture(info.fWidth, info.fHeight); | 56 return SkSurface::NewPicture(info.fWidth, info.fHeight); |
| 57 } | 57 } |
| 58 | 58 |
| 59 SkImage* SkSurface_Picture::onNewImageSnapshot() { | 59 SkImage* SkSurface_Picture::onNewImageSnapshot() { |
| 60 if (fPicture) { | 60 if (fPicture) { |
| 61 return SkNewImageFromPicture(fPicture); | 61 return SkNewImageFromPicture(fPicture); |
| 62 } else { | 62 } else { |
| 63 SkImageInfo info; | 63 SkImageInfo info; |
| 64 info.fWidth = info.fHeight = 0; | 64 info.fWidth = info.fHeight = 0; |
| 65 info.fColorType = kPMColor_SkColorType; | 65 info.fColorType = kN32_SkColorType; |
| 66 info.fAlphaType = kOpaque_SkAlphaType; | 66 info.fAlphaType = kOpaque_SkAlphaType; |
| 67 return SkImage::NewRasterCopy(info, NULL, 0); | 67 return SkImage::NewRasterCopy(info, NULL, 0); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 void SkSurface_Picture::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, | 71 void SkSurface_Picture::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, |
| 72 const SkPaint* paint) { | 72 const SkPaint* paint) { |
| 73 if (!fPicture) { | 73 if (!fPicture) { |
| 74 return; | 74 return; |
| 75 } | 75 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 93 /////////////////////////////////////////////////////////////////////////////// | 93 /////////////////////////////////////////////////////////////////////////////// |
| 94 | 94 |
| 95 | 95 |
| 96 SkSurface* SkSurface::NewPicture(int width, int height) { | 96 SkSurface* SkSurface::NewPicture(int width, int height) { |
| 97 if ((width | height) < 0) { | 97 if ((width | height) < 0) { |
| 98 return NULL; | 98 return NULL; |
| 99 } | 99 } |
| 100 | 100 |
| 101 return SkNEW_ARGS(SkSurface_Picture, (width, height)); | 101 return SkNEW_ARGS(SkSurface_Picture, (width, height)); |
| 102 } | 102 } |
| OLD | NEW |