| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 fBitmap.setInfo(info, info.minRowBytes()); | 99 fBitmap.setInfo(info, info.minRowBytes()); |
| 100 fBitmap.setPixelRef(pr); | 100 fBitmap.setPixelRef(pr); |
| 101 fWeOwnThePixels = true; | 101 fWeOwnThePixels = true; |
| 102 | 102 |
| 103 if (!info.isOpaque()) { | 103 if (!info.isOpaque()) { |
| 104 fBitmap.eraseColor(SK_ColorTRANSPARENT); | 104 fBitmap.eraseColor(SK_ColorTRANSPARENT); |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 | 107 |
| 108 SkCanvas* SkSurface_Raster::onNewCanvas() { | 108 SkCanvas* SkSurface_Raster::onNewCanvas() { |
| 109 return SkNEW_ARGS(SkCanvas, (fBitmap, this->props())); | 109 return SkNEW_ARGS(SkCanvas, (fBitmap, &this->props())); |
| 110 } | 110 } |
| 111 | 111 |
| 112 SkSurface* SkSurface_Raster::onNewSurface(const SkImageInfo& info) { | 112 SkSurface* SkSurface_Raster::onNewSurface(const SkImageInfo& info) { |
| 113 return SkSurface::NewRaster(info); | 113 return SkSurface::NewRaster(info); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void SkSurface_Raster::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, | 116 void SkSurface_Raster::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, |
| 117 const SkPaint* paint) { | 117 const SkPaint* paint) { |
| 118 canvas->drawBitmap(fBitmap, x, y, paint); | 118 canvas->drawBitmap(fBitmap, x, y, paint); |
| 119 } | 119 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 if (!SkSurface_Raster::Valid(info)) { | 169 if (!SkSurface_Raster::Valid(info)) { |
| 170 return NULL; | 170 return NULL; |
| 171 } | 171 } |
| 172 | 172 |
| 173 SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewAllocate(info, 0, NULL)); | 173 SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewAllocate(info, 0, NULL)); |
| 174 if (NULL == pr.get()) { | 174 if (NULL == pr.get()) { |
| 175 return NULL; | 175 return NULL; |
| 176 } | 176 } |
| 177 return SkNEW_ARGS(SkSurface_Raster, (pr, props)); | 177 return SkNEW_ARGS(SkSurface_Raster, (pr, props)); |
| 178 } | 178 } |
| OLD | NEW |