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